ion of n (n ranging between 1 and 80) for (a) x = 15 and (b) x = −15. [You can plot the two cases either as different curves on the same plot or in different plots, whichever is clearer.] Discuss the contributions of truncation and roundoff to the fractional error for the different values of x and n. Also discuss how you could reduce truncation and roundoff errors in order to estimate e x more accurately using the Taylor series.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

USING PYTHON NOT MATLAB

We can use the sum of the first n terms of the Taylor series of e x with a = 0 to estimate the value of the exponential function. Using a logarithmic y axis, plot the fractional error in the estimated e x (compared to numpy.exp(x)) as a function of n (n ranging between 1 and 80) for (a) x = 15 and (b) x = −15. [You can plot the two cases either as different curves on the same plot or in different plots, whichever is clearer.] Discuss the contributions of truncation and roundoff to the fractional error for the different values of x and n. Also discuss how you could reduce truncation and roundoff errors in order to estimate e x more accurately using the Taylor series.

Expert Solution
Step 1: Program approach
  1. Import the necessary libraries (numpy and matplotlib.pyplot)
  2. Define the function to calculate the nth term of the Taylor series for ex (where x is the input parameter and n is the term number) and to calculate the estimated value of  ex using the first n terms of the Taylor series
  3. Define the function to calculate the fractional error between the estimated value of ex and the actual value (computed using numpy.exp(x))
  4. Set the values of x for which the error is to be calculated (x = 15 and x = -15 in this case)
  5. For each value of x, loop through the values of n from 1 to 80 (inclusive), and calculate the corresponding fractional error using the functions defined above
  6. Plot the fractional error as a function of n for each value of x, using a logarithmic y-axis
  7. Display the resulting plots
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY