Question: One way to compute the exponential function e* is to truncate its Taylor series expansion around x = 0, 1 et = 1+x+ 2!
One way to compute the exponential function e* is to truncate its Taylor series expansion around x = 0, 1 et = 1+x+ 2! 1 3! Unfortunately, many terms are required for accuracy if |x| is large. But a special property of the exponential is that e2x = (e*). This leads to a scaling and squaring method: Divide x by 2 repeatedly until |x| < 1/2, use the Taylor series (16 terms should be more than enough), and square the result repeatedly. Write a function expss (x) that performs these three steps. (The functions cumprod and polyval can help with evaluating the Taylor expansion.) Test your function on x values -30, -3, 3, 30.
Step by Step Solution
3.38 Rating (154 Votes )
There are 3 Steps involved in it
xinputEnter value of x take user input counter0 x1x ... View full answer
Get step-by-step solutions from verified subject matter experts
