Question: The function f1(x0, h) = sin(x0 + h) sin(x0) can be transformed into another form, f2(x0, h), using the trigonometric formula, sin() sin() = 2cos(
- The function f1(x0, h) = sin(x0 + h) sin(x0) can be transformed into another form, f2(x0, h), using the trigonometric formula, sin() sin() = 2cos( + )sin( ). 22 Thus, f1 and f2 have the same values, in exact arithmetic, for any given argument values x0 and h.
- (a) Derive f2(x0, h)
- (b) Suggest a formula that avoids cancellation errors for computing the approx- imation (f(x0 + h) f(x0))/h to the derivative of f(x) = sin(x) at x = x0. Write a MATLAB program that implements your formula and computes an approximation of f (1.2), for h = 1e 20, 1e 19, ..., 1.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
