Question: c o s ( x ) = i = 0 n ( - 1 ) i x 2 i ( 2 i ) ! is

cos(x)=i=0n(-1)ix2i(2i)! is the Taylor / McClaurin expansion of order n, centred at x=0 for cos(x).
(a)(10 points) Write a Matlab program that computes the n'th order expansion and plots this expansion and the real values of cos(x) on the interval -
Hints : try modifying the code snippet for computation of the Maclaurin expansion of sin(x) given in the week 6 lecture notes!
(b)(3 points) Modify your code to compute and plot the error between the expansion and the real value of cos(x) for all xin[-,]
(c)(2 points) Add commands to your code to compute the sum of the squared errors and comment on what happens to this as the order n of the expansion is increased.
c o s ( x ) = i = 0 n ( - 1 ) i x 2 i ( 2 i ) !

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 Programming Questions!