write a function to approximate the function f x using a taylor series

Using python to solve problem3 and problem4

Problem 3

Write a function to approximate the function, f(x), using a Taylor series. The Taylor series for the function, f(x), evaluated at x0 is given by the expression:

f(x) =

∞ X n=0

f(n)(x0) n!

(x−x0)n (9)

, however, we often truncate this infinite sum at n = N and write the Taylor series as an approximation

f(x) ≈ PN(x) =

N X n=0

f(n)(x0) n!

(x−x0)n (10)

The function, f(x), can then be written as

f(x) = PN(x) + RN(x) (11)

By including more terms in the series, i.e., higher values of N, the truncation error reduces and the Taylor series becomes a better approximation for the function at x0. Demonstrate this by plotting the function RN(x) for different values of N for the following functions:

1. f(x) = ex at x0 = 0.

2. f(x) = 1 x2 at x0 = 4

Thanks

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.