Question: In Python code Exercise B.3: Study a function and its derivative Consider the function f(x) = sin x + for x ranging from 0 to
In Python code

Exercise B.3: Study a function and its derivative Consider the function f(x) = sin x + for x ranging from 0 to 1, and the derivative f'(x) - x+8 cos (x + 8) Here, e is a given input parameter. a) Develop a program that creates a plot of the derivative of f = f(x) based on a finite difference approximation using n computational nodes. The program should also graph the exact derivative given by f' = f'(x) above. b) Test the program using n = 10 and = 1/5. c) How large do you have to choose n in order for the difference between these two functions to be less than 0.1? Hint Each function gives an array. Create a while loop and use the max function of the arrays to retrieve the maximum value and compare these. d) Let e = 1/10 and recalculate. Exercise B.3: Study a function and its derivative Consider the function f(x) = sin x + for x ranging from 0 to 1, and the derivative f'(x) - x+8 cos (x + 8) Here, e is a given input parameter. a) Develop a program that creates a plot of the derivative of f = f(x) based on a finite difference approximation using n computational nodes. The program should also graph the exact derivative given by f' = f'(x) above. b) Test the program using n = 10 and = 1/5. c) How large do you have to choose n in order for the difference between these two functions to be less than 0.1? Hint Each function gives an array. Create a while loop and use the max function of the arrays to retrieve the maximum value and compare these. d) Let e = 1/10 and recalculate
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
