Question: Write a Matlab program that displays (see table below) the following in the commandline window: Chapter Example 3.6 page 79 Use two ways to compute

Write a Matlab program that displays (see table below) the following in the commandline window:

Chapter Example 3.6 page 79

Use two ways to compute ex. Conclude which one is better and why?

Use 20 iterations.

Sample output

Print your name and the output

x = 5.0000e-01

Taylor Series Method for Exponentials Demo

For x=0.500000 Actual e^(0.500000) = 1.648721

Exponential: Method1-->Direct method (1+x+x^2/2+...) Method2-->InDirect method 1/(1-x+x^2/2-...):

_______________________________________________________________________________________

Approximate Values True Relative Error Approximate Relative Error

Order Method1 Method2 Method1 Method2 Method1 Method2

----------------------------------------------------------------------------------------------------------------------

0 1.000000 1.000000 39.346934 39.346934

1 1.500000 2.000000 9.020401 21.306132 33.333333 50.000000

2 1.625000 1.600000 1.438768 2.955094 7.692308 25.000000

3 1.645833 1.655172 0.175162 0.391282 1.265823 3.333333

4 1.648438 1.648069 0.017212 0.039582 0.157978 0.431034

5 1.648698 1.648776 0.001416 0.003338 0.015795 0.042918

6 1.648720 1.648717 0.000100 0.000240 0.001316 0.003578

7 1.648721 1.648722 0.000006 0.000015 0.000094 0.000256

8 1.648721 1.648721 0.000000 0.000001 0.000006 0.000016

9 1.648721 1.648721 0.000000 0.000000 0.000000 0.000001

10 1.648721 1.648721 0.000000 0.000000 0.000000 0.000000

Elapsed time is 0.192878 seconds.

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!