Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Taylor Series Expansion of cos(x) about x=0 and Error Analysis, Study notes of Signals and Systems

The Taylor series expansion of the cosine function about x=0 and analyzes the approximation error using MATLAB. how to calculate the Maclaurin series approximation of cos(x) with increasing terms and determines the number of terms required to achieve two significant digits of accuracy for x=pi/3. The document also discusses the challenges of finding a good step size for differentiating ill-conditioned equations and shares an example of a graduate student's difficulties calculating derivatives of a car model's deformation.

Typology: Study notes

2021/2022

Uploaded on 09/12/2022

rajeshi
rajeshi ๐Ÿ‡บ๐Ÿ‡ธ

4.1

(9)

237 documents

1 / 6

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Taylor๎˜ƒseries๎˜ƒexpansion๎˜ƒof๎˜ƒf=cos(x)๎˜ƒabout๎˜ƒx=0.๎˜ƒ๎˜ƒ
(3) (4)
'(0) sin(0) 0, "(0) cos(0) 1
(0) sin(0) 0, (0) cos(0) 1, .
ff
f
fetc
=โˆ’ = =โˆ’ =โˆ’
== = =๎˜ƒ
So๎˜ƒTaylor๎˜ƒseries๎˜ƒexpansion๎˜ƒis๎˜ƒ(as๎˜ƒgiven๎˜ƒin๎˜ƒProblem๎˜ƒ4.10)๎˜ƒ
2468
cos( ) 1 2! 4! 6! 8!
xxxx
x=โˆ’ + โˆ’ + +"
๎˜ƒ
An๎˜ƒmโ€file๎˜ƒthat๎˜ƒcalculates๎˜ƒthis๎˜ƒapproximation๎˜ƒwith๎˜ƒn๎˜ƒterms๎˜ƒis๎˜ƒ
function๎˜ƒapx=costaylor(x,n)๎˜ƒ
%Calculates๎˜ƒthe๎˜ƒMaclaurin๎˜ƒseries๎˜ƒapproximaton๎˜ƒto๎˜ƒcos(x)๎˜ƒusing๎˜ƒthe๎˜ƒfirst๎˜ƒn๎˜ƒ
%terms๎˜ƒin๎˜ƒthe๎˜ƒexpansion.๎˜ƒ
apx=0;๎˜ƒ
for๎˜ƒi=0:nโ€1๎˜ƒ
๎˜ƒ๎˜ƒ๎˜ƒ๎˜ƒapx=apx+(โ€1)^i*x^(2*i)/factorial(2*i);๎˜ƒ
end๎˜ƒ
Problem๎˜ƒ4.10๎˜ƒasks๎˜ƒus๎˜ƒto๎˜ƒincrement๎˜ƒn๎˜ƒfrom๎˜ƒ1๎˜ƒuntil๎˜ƒthe๎˜ƒapproximate๎˜ƒerror๎˜ƒindicates๎˜ƒ
that๎˜ƒwe๎˜ƒhave๎˜ƒaccuracy๎˜ƒto๎˜ƒtwo๎˜ƒsignificant๎˜ƒdigits๎˜ƒfor๎˜ƒx=pi/3.๎˜ƒ
We๎˜ƒstart๎˜ƒwith๎˜ƒ๎˜ƒ
>>๎˜ƒa1=costaylor(pi/3,1)๎˜ƒ
a1๎˜ƒ=๎˜ƒ
๎˜ƒ๎˜ƒ๎˜ƒ๎˜ƒ๎˜ƒ1๎˜ƒ
>>๎˜ƒa2=costaylor(pi/3,2)๎˜ƒ
a2๎˜ƒ=๎˜ƒ
๎˜ƒ๎˜ƒ๎˜ƒ๎˜ƒ0.4517๎˜ƒ
With๎˜ƒcos(pi/3)=0.5,๎˜ƒthe๎˜ƒtrue๎˜ƒerror๎˜ƒin๎˜ƒa1๎˜ƒis๎˜ƒ100%๎˜ƒand๎˜ƒin๎˜ƒa2๎˜ƒit๎˜ƒis๎˜ƒ๎˜ƒ
>>๎˜ƒtrue2=(a2โ€0.5)/0.5*100๎˜ƒ
pf3
pf4
pf5

Partial preview of the text

Download Taylor Series Expansion of cos(x) about x=0 and Error Analysis and more Study notes Signals and Systems in PDF only on Docsity!

Taylor series expansion of f=cos(x) about x=0. (3) (4) '(0) sin(0) 0, "(0) cos(0) 1 (0) sin(0) 0, (0) cos(0) 1,. f f f f etc = โˆ’ = = โˆ’ = โˆ’ = = = = So Taylor series expansion is (as given in Problem 4.10) 2 4 6 8 cos( ) 1 2! 4! 6! 8! x x x x x = โˆ’ + โˆ’ + +" An mโ€file that calculates this approximation with n terms is function apx=costaylor(x,n) %Calculates the Maclaurin series approximaton to cos(x) using the first n %terms in the expansion. apx=0; for i=0:nโ€ 1 apx=apx+(โ€1)^ix^(2i)/factorial(2*i); end Problem 4.10 asks us to increment n from 1 until the approximate error indicates that we have accuracy to two significant digits for x=pi/3. We start with

a1=costaylor(pi/3,1) a1 = 1 a2=costaylor(pi/3,2) a2 =

With cos(pi/3)=0.5, the true error in a1 is 100% and in a2 it is

true2=(a2โ€0.5)/0.5*

true2 = โ€9. That is about 9.7%. The approximate error, though is

aprerror=(a1โ€a2)/a2* aprerror = 121.3914% With one more term we get a3=costaylor(pi/3,3) a3 =

true3=(a3โ€0.5)/0.5* true3 =

aprerror=(a2โ€a3)/a3* aprerror = โ€9. So the actual error is only 0.36% while the estimated is 10%. Finally with a fourth term a4=costaylor(pi/3,4) a4 =

true4=(a4โ€0.5)/0.5* true4 = โ€0. aprerror=(a3โ€a4)/a4*

One of my graduate students ran into difficulties calculating derivatives of the deformation of a car model seen below

With respect to variables that define the dimensions of the car.