Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use MATLAB to complete this question Problem 4. Series expansion error of the exponential function. 4a. Write a while loop to evaluate the value of
Use MATLAB to complete this question
Problem 4. Series expansion error of the exponential function. 4a. Write a while loop to evaluate the value of exp(x) (exponential) where x is 10 using Taylor expansion 1+x +x_/2!+x/3!+.... Do so without worrying about roundoff errors or computation speed. Compare it with the Matlab build-in function exp(10) and screen output the absolute value of the fractional error (defined by abs((Your_sum-expected)/expected) at n=5 terms, 20 terms and 50 terms. I know this is cheating in reality since analytical solutions generally don't exist for hard problems (but if it is available why not use it?). Then change your input to x=-10 and do the same. Comment on whether there are convergence problems. I would like you to tabulate in the following manner in the screen output (where sum and fractional errors are formatted as %e): Terms Sum(your prog output). Fractional error (line 1) 1 1.234567e+01 8.901113-03 (line 2) 5 ... 4b. Write an improved script by adding IF statement(s) in the loop to avoid the subtraction of big numbers. Does your series converge better at the same numbers of terms above (comment)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started