Plot Taylor polynomial approximations to sin x. The sine function can be approximated by a…

Plot Taylor polynomial approximations to sin x.

Don't use plagiarized sources. Get Your Custom Essay on
Plot Taylor polynomial approximations to sin x. The sine function can be approximated by a…
Just from $13/Page
Order Essay

The sine function can be approximated by a polynomial
according to the following formula:

The expression (2j + 1)! is the factorial (see Exercise
3.14). The error in the approximation S(x; n) decreases as n increases and in
the limit we have that limn→∞ S(x; n) = sin x. The purpose of this
exercise is to visualize the quality of various approximations S(x; n) as n
increases.

The first part of the exercise is to write a Python function
S(x,

n) that computes S(x; n). Use a straightforward approach
where you compute each term as it stands in the formula, i.e., (−1)jx2j+1 divided by the factorial (2j + 1)!. (We remark that Exercise
A.16 outlines a much more efficient computation of the terms in the series.)

The next part of the exercise is to plot sin x on [0,
4π] together with the approximations S(x; 1), S(x; 2), S(x; 3), S(x; 6),
and S(x; 12). Name of program file: plot_Taylor_sin.py.

Leave a Reply

Your email address will not be published.

*

*

*