Test your program for x 10 2 -2 and -10 from the plots


Consider the Taylor expansion for the exponential

ex = 1 + x + x2/2! + x3/3! +...... = limN→∞ S(x, N)

where S(x, N) is the partial sum with N +1 terms. (a) Write a program that plots the absolute fractional error of the sum, |S(x,N)- ex |ex, versus N (up to N = 60) for a given value of x. Test your program for x = 10, 2, -2, and -10. From the plots, explain why this is not a good way to evaluate 9 when x < 0449] (b) Modify your program so that it uses the identity ex =1/e-x = 1/S (-x, ∞) to evaluate the exponential when x is negative. Explain why this approach works better.

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Test your program for x 10 2 -2 and -10 from the plots
Reference No:- TGS01236014

Now Priced at $30 (50% Discount)

Recommended (92%)

Rated (4.4/5)