The Maclaurin series expansion for tan 1 x where 1 lessthan

The Maclaurin series expansion for tan^- 1 (x) where - 1 lessthan x lessthan l is.tan^- 1(x) = x - x^3/3 + x^5/5 - x^7/7 + middot middot middot Please use it to compute an estimate of tan~^l(0.7) by hand (with aid of a hand-held calculator). Please include step-by-step calculation for the approximations by adding one term at a time (up to 4 terms) and calculate the absolute value of the approximate percent relative error (epsilon _ alpha) at each step when appropriate. Please show your work for the three epsilon _ alpha values calculated. Please develop a MATLAB M-file function program named atanx based on the above Maclaurin series to carry out computation for an estimate of tan^- 1 (O. 7) with the epsilon _ alpha meeting a stopping criterion (epsilon _s) conforming to two significant figures. Please list your M-file program, the computed approximate percent relative error epsilon _ alpha values at each step and the computed final estimated approximation to tan^- 1 (0.7) should be printed out by your program. For example, using the function for an estimate of tan^- 1 (0.7) with two significant figures stopping criterion in command window can be: gg nfigure=2; gg atanx(0.7, figure)

Solution

MATLAB FUNCTION

Save the function as atanx.m

function atanx(x,nfigure ) % The function atanx
Val = 0; % Initial Value of the atanx
i = 1;j =0;
% Checking the percent relative error
while abs((atan(x)-Val)/atan(x))*100 >nfigure
% Calculating the function
Val = Val + ((-1)^j)*((x^i)/i);
i = i+2;j = j+1;
end
% printing the Final result and error
fprintf(\'atan(%f) = %f with percent relative error %2.2f\',x...
,Val, abs((atan(x)-Val)/atan(x))*100);
end

SAMPLE OUTPUT

>> nfigure = 2;
>> atanx(0.7,nfigure)
atan(0.700000) = 0.619281 with percent relative error 1.40

 The Maclaurin series expansion for tan^- 1 (x) where - 1 lessthan x lessthan l is.tan^- 1(x) = x - x^3/3 + x^5/5 - x^7/7 + middot middot middot Please use it t

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site