This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: or (b) 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 1 2 3 4 5 6 7 8 9 10 xaxis f(x)=exp(x 2 )*sin(x) Taylor Series Approximations Function One Term Two Terms Three Terms 2. clc; clear; x=.1; oldterm = x^3; newterm = (x^5)/6; oldsum = oldterm; newsum = oldsum + newterm; n=2; while (abs(oldsum newsum)>10^8) oldsum = newsum; oldterm = newterm; newterm = oldterm*(x^2)/(2*n+1); newsum = oldsum + newterm; n=n+1; end fprintf( 'The approx value of f(x) is %10.8f\n' ,oldsum) fprintf( 'The exact value of f(x) is %10.8f\n' ,x^2*sin(x)) OUTPUT SCREEN: The approx value of f(x) is 0.00099833 The exact value of f(x) is 0.00099833...
View
Full
Document
This note was uploaded on 10/19/2009 for the course ENG 3361 taught by Professor Yao during the Fall '09 term at Dalhousie.
 Fall '09
 yao

Click to edit the document details