39. The first derivative of a function at a point can be approximated with the four-point central...
Question:
39. The first derivative of a function at a point can be approximated with the four-point central difference formula:
where h is a small number relative to . Write a user-defined function function (see Section 7.9) that calculates the derivative of a math function by using the four-point central difference formula. For the user-defined function name, use dfdx=FoPtder(Fun,x0), where Fun is a name for the function that is passed into FoPtder, and x0 is the point where the derivative is calculated. Use in the four-point central difference formula. Use the user-defined function FoPtder to calculate the following:
(a) The derivative of at .
(b) The derivative of at .
In both cases compare the answer obtained from FoPtder with the analytical solution (use format long).
Step by Step Answer: