Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 recalculateStep 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