NC assignment 2:
answer of question 2 = 122.2425 above answer is wrong correct it
code:
# Given data
h = 50 # Step size
p = 0 # p = (x - x0)/h = 0 at x = 200
# Use correct backward difference values
nabla2_f0 = 25 # Second backward difference at x = 200
nabla3_f0 = 5 # Third backward difference at x = 200
# Applying backward second derivative formula:
# f''(x0) = (1/h^2) * [∇²f0 + ((6p + 6)/3!) * ∇³f0]
second_derivative = (1 / h**2) * (nabla2_f0 + ((6 * p + 6) / 6) * nabla3_f0)
# Output the result
print(f"Approximate second derivative at x = 200 is: {second_derivative:.3f} ms/user²")



0 Comments