Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In Python Exponential function. The exponential function may be approximated by Taylor polynomials e^x almostequalto P_N(x) = sigma^N_n = 0 x^n!. The sum may be
In Python
Exponential function. The exponential function may be approximated by Taylor polynomials e^x almostequalto P_N(x) = sigma^N_n = 0 x^n!. The sum may be computed directly term by term using Algorithm I input: x s = 1.0 t = x for n = 1 to N{ s = s + t t = t * x } return s Or using the identity, P_N(x) = 1 + x(x/2(1 + x/2(1 + x/3(1 + x/N - 1(1 + x/N)...))): Algorithm II input: x s = 1.0 for n = N to 1 { s = s*x+1 } return s Use these algorithms to compute e^50 and e^-50. Assume that the built-in function in your environment (likely called "exp()") provides the exact value and plot the error of your numerical approximations, i.e., |P_N(50) - e^plusminus 50|, as the function of N. Values of N almostequalto 200 are probably as far as you need to go. (You should use the logarithmic plot to be able to display the entire range of error values in one figure, i.e., plot the logarithm of the error rather than the error itself.) If your environment uses very high precision arithmetic, you may not notice any significant difference between the algorithms, the error should become more noticeable if you use just single precision (32 bit) arithmetic. Discuss your findingsStep 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