Question
Code in python Finite Difference Methods vs. the Complex Step Method for Estimating Derivatives. Using the first-order forward difference formula, the second-order central difference formula,
Code in python
Finite Difference Methods vs. the Complex Step Method for Estimating Derivatives.
Using the first-order forward difference formula, the second-order central difference formula, the fourth-order central difference formula that you derived above, and the second-order complex step method, create a plot like the one found in Lecture 13. Display your graph in the command window where, instead of looking at the derivative of the sine function, evaluate the derivative of the function:
() = sinh() sin(^2) t = 3.5
Construct your errors by comparing your numeric results with the actual derivative of this function (you need to derive this). In your figure, use the step sizes and graphical format like the plot in lecture 13. The curves are to be drawn as dots connected by lines using the following color scheme: first-order forward difference in red, second-order central difference in blue, fourth-order central derivative in cyan, and the complex step method in green. The axes must be labeled, the plot titled, and a legend must be located so as to not obstruct the curves.
After the graph is displayed, print a statement for the grader to the command window addressing the following three topics: Effect of the order of the method on truncation error, on round-off error, and on the size of the optimal step to use when approximating the derivative using a finite difference with a specified order of accuracy.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started