Sie sind auf Seite 1von 1

Question 3)

The order of truncation for any Taylor Expansion is O(x^(n+1)). Which means for Cos(x) that would
be 4th Order and for Sin(x) that would be 5th Order.

Taylor series approximation for sin(x) gets more inaccurate as x moves further from 0, hence we
can use the fact that:

sin 361 = sin 001

a) Value Sin Cos


Absolute Relative Absolute Relative
i) -2 1.253164E-14 1.256847E-14 2.512435E-12 3.284313E-11
ii) -1 1.006140E-16 1.480657E-16 3.919087E-14 5.341870E-14
iii) 0 0.000000E+00 0.000000E+00 0.000000E+00 0.000000E+00
iv) 1 1.006140E-16 1.480657E-16 3.919087E-14 5.341870E-14
v) 2 1.253164E-14 1.256847E-14 2.512435E-12 3.284313E-11
vi) 358 4.499017E+01 1.077754E+02 4.398839E+01 4.840790E+01
vii) 359 4.576316E+01 4.954098E+01 4.459130E+01 1.164229E+02
viii) 360 4.654673E+01 4.962478E+01 4.520019E+01 1.303702E+02
ix) 361 4.734098E+01 1.046085E+02 4.581508E+01 5.137734E+01
x) 362 4.814602E+01 1.757555E+02 4.643603E+01 4.828297E+01

b)
Division by a really small number (large numerator and small denominator) in g2 results
in rounding errors.

c)
function y = c3()

a = 2;
h = logspace(-20,1,10000);

b = a- 2.*h;
c = a - h;
d = a + h;
e = a + 2.*h;

f =(b.*exp(-b)-8*c.*exp(-c)+8*d.*exp(-d)-e.*exp(-e))./(12.*h);

dy = exp(-a) - a*exp(-a);

error = dy - f;

loglog(h,error);

Das könnte Ihnen auch gefallen