Question: For any differentiable function f(x), its derivative f(x) is defined by (20) f(x) = lim f(x + h) f(x) h0 h It can be approximated
For any differentiable function f(x), its derivative f(x) is defined by (20) f(x) = lim f(x + h) f(x) h0 h It can be approximated by the function g(x) = f(x+h)f(x) h where h > 0 is a small finite number. In the following, take f(x) = x2. (a) Write a program which applies the while-loop to calculate 20 values of g(1) for h=0.1, 0.01, 0.001, ... , 1020. Submit your source code and the program output. (b) Based on your result in part (a), for what values of h does g(1) poorly approximate f(1)? Why?
2. For any differentiable function f(x), its derivative f'() is defined by f'(x) = lim f(x + h) f(x) h h 0 It can be approximated by the function g(x) f(x + h) f(x) h where h > 0 is a small finite number. In the following, take f(x) = x2. (a) Write a program which applies the while-loop to calculate 20 values of g(1) for h=0.1, 0.01, 0.001, ... , 10-20. Submit your source code and the program output. (b) Based on your result in part (a), for what values of h does g(1) poorly approximate f'(1)? Why
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
