Question: MATLAB PLEASE! function y = oneminuscos (x) --------> USE THIS FUNCTION IN YOUR CODE %Compute 1 - cos(x) for scalar real inputs in the range

MATLAB PLEASE!

function y = oneminuscos (x) --------> USE THIS FUNCTION IN YOUR CODE

%Compute 1 - cos(x) for scalar real inputs in the range -1 < x < 1 %with fractional error under 10*eps. %For example, it should return oneminuscos(1E-8) = -2.2204e-15

Hint: Subtracting 1 cos(x) directly incurs subtractive cancellation when x is close to 0, but for such values of x, the truncation error from using the first few terms of the Taylor series of cos(x) with a = 0 and canceling out the 1 analytically is very small.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!