HW 1_4 Similar to problem 4.11 in your text. Follow the same directions as written in this problem, but instead of cos(x), use the Maclaurin series expansion of arctan(x), shown below, to estimate arctan(0.74). Display the results to the screen in a table like the one in Example 4.1 in your book. (use fprintf) arctan(x) = { 1732m x2 +20 = x -+ +2n * n = 0 EXAMPLE 4.1 Error Estimates for Iterative Methods Problem Statement. In mathematics, functions can often be represented by infinite se- ries. For example, the exponential function can be computed using e = 1 + x + + +...+ (E4.1.1) Thus, as more terms are added in sequence, the approximation becomes a better and better estimate of the true value of e. Equation (E4.1.1) is called a Maclaurin series expansion. Starting with the simplest version, e' = 1, add terms one at a time in order to estimate e". After each new term is added, compute the true and approximate percent relative errors with Eas. (4.3) and (4.5), respectively. Note that the true value is el. = 1.648721 ... Add terms until the absolute value of the approximate error estimate e, falls below a prespeci- fied error criterion e, conforming to three significant figures. Solution. First, Eq. (4.7) can be employed to determine the error criterion that ensures a result that is correct to at least three significant figures: E,= (0.5 x 102-3)% = 0.05% Thus, we will add terms to the series until e, falls below this level. The first estimate is simply equal to Eq. (E4.1.1) with a single term. Thus, the first estimate is equal to 1. The second estimate is then generated by adding the second term as in et = 1 + x or for x = 0.5 205 = 1 +0.5 = 1.5 This represents a true percent relative error of Eq. (4.3) 1.648721 - 1.5 x 100% = 9.02% , 1.6487211 Equation (4.5) can be used to determine an approximate estimate of the error, as in 88 = 11.5 = x 100% = 33.3% Because e is not less than the required value of e,, we would continue the computation by adding another term, x/2!, and repeating the error calculations. The process is continued until e I WN 1.5 1.625 1.645833333 1.648437500 1.648697917 39.3 9.02 1.44 0.175 0.0172 0.00142 33.3 7.69 1.27 0.158 0.0158 Thus, after six terms are included, the approximate error falls below e, = 0.05%, and the computation is terminated. However, notice that, rather than three significant figures, the result is accurate to five! This is because, for this case, both Eqs. (4.5) and (4.7) are conser- vative. That is, they ensure that the result is at least as good as they specify. Although, this is not always the case for Eq. (4.5), it is true most of the time