Login

Question

Show More

The Maclaurin series (special case of the Taylor series) is a power series where the coefficients are expressed in terms of the derivatives evaluated at a specific point (at zero for a Maclaurin series): <br/> <br/>\[ f(x) = \sum_{n=0}^{\infty} \frac{f^{(n)}(0)}{n!} x^n \] <br/> <br/>Where \( f^{(n)}(0) \) is the n-th derivative evaluated at zero. Write a script which evaluates the coefficients of this series into an array up to a parameter N, which should be prescribed at the top of the script, for the function \( f(x) = \cos(x) + e^{2x} \). Observe that the n-th derivative of this function evaluated at zero can be written explicitly in terms of n. Produce an array of coefficients for N=10. <br/> <br/>By using your script from above find the approximations for \( f(x) \) for values of N = 2, 5, 10, 20 and plot all of these on the same axis alongside the function \( f(x) \) itself. Plot this for \( x \in [0, 2] \), have a legend, color coding for each line and axis labels.
StudyStudy

Solution

PrepMate

Ask a tutor

If you have any additional questions, you can ask one of our experts.

Recently Asked Questions