Question: MATLAB: One way to compute the exponential function e x is to truncate its Taylor series expansion around x = 0, e x = 1

MATLAB:

One way to compute the exponential function ex is to truncate its Taylor series expansion around x = 0,

ex = 1 + x + 1/2!*x2 + 1/3!*x3 +...

Unfortunately, many terms are required for accuracy if |x| is large. But a special property of the exponential is that e2x = (ex)2. 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

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!