Question: The inverse tangent function [40 points]: The tan-1 function can be evaluated by the following infinite Taylor series 1 3 5 7 9 ()= 3
The inverse tangent function [40 points]: The tan-1 function can be evaluated by the following infinite Taylor series
1 3 5 7 9 ()= 3 + 5 7 + 9 ,11
(a) Write a function that needs as an input the value of x and the acceptable true percent error from the user and then it calculates tan-1(x) using the above series until the acceptable error is satisfied. Make sure that the function does the following:
checks that x within the validity range of the expansion and reports to the user if its outside the range.
stores the true percent relative error (t%) for each number of terms taken from the series in an array.
plots the true percent relative error as a function of the number terms. Make sure to label the x- axis, the y-axis and to add a legend. The plot has to be logarithmic on the y-axis (i.e. semilog plot which can be done by using semilogy instead of plot)
times itself using tic; toc;
(b) Run the function for the case x = 0.75 and with acceptable error of 10-13 %. Report the final plot, and
the time of the calculation (using tic toc).
(c) From your log-log plot in part (b), how many terms are enough to reach percent relative error less than 10-8 %.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
