Download presentation
Presentation is loading. Please wait.
Published byEllie Jaggard Modified over 9 years ago
2
Calculus S. Awad, Ph.D. M. Corless, M.S.E.E. D. Cinpinski E.C.E. Department University of Michigan-Dearborn Math Review with Matlab: Taylor’s Series
3
Calculus:Taylor Series 2 Series Operations n Symbolic Summation Symbolic Summation n Taylor Series Taylor Series n Taylor Command Taylor Command n Taylor Series Example Taylor Series Example n Approximation and Comparison Example Approximation and Comparison Example
4
Calculus:Taylor Series 3 Symbolic Summation » s1=symsum(1/x^2,1,inf) s1 = 1/6*pi^2 » num = 4*x*x-x-3 » den = x^3+2*x » s2=symsum(num/den,1,inf) s2 = inf Diverges! n Example 1: n Example 2 Converges n Find the sum of the following series s1 and s2 if they converges
5
Calculus:Taylor Series 4 Summation Examples » s3=symsum(1/(x-1.5)^2,1,inf) s3 = 4+1/2*pi^2 » eval(s3) ans = 8.9348 n Example 3: » s4=symsum((1/x)*(-1)^(x+1),1,inf) s4 = log(2) » eval(s4) ans = 0.6931 n Example 4:
6
Calculus:Taylor Series 5 Finite Summation Example » syms x N; » s5=symsum((x+3)*(x+1),1,N) s5 = 7/6*N-11/6+3/2*(N+1)^2+1/3*(N+1)^3 » s5=simple(s5) s5 = 1/6*N*(31+15*N+2*N^2) n Example 5:
7
Calculus:Taylor Series 6 n MacLaurin Series is the Taylor series approximation with a=0: n Taylor Series approximation is defined as:
8
Calculus:Taylor Series 7 Taylor Command taylor(f) is the fifth order MacLaurin polynomial approximation to f taylor(f,n) is the ( n -1) -st order MacLaurin polynomial taylor(f,n,a) is the Taylor polynomial approximation about point a with order ( n -1).
9
Calculus:Taylor Series 8 Taylor Series Example n Given the function: » sym x; » f=log(1+x) % Matlab's Natural Log f = log(1+x) 1)Find the first 6 Taylor Series Terms (a=0) 2)Find the first 4 terms about the point a=2
10
Calculus:Taylor Series 9 Taylor Series Terms n Find the first 6 Taylor Series Terms (a=0) » taylor(f) %Default is 5th order ans = x-1/2*x^2+1/3*x^3-1/4*x^4+1/5*x^5 » taylor(f,4,2) ans = log(3)+1/3*x-2/3-1/18*(x-2)^2+1/81*(x-2)^3 n Find the first 4 terms about the point a=2 n Note that this is 3rd order
11
Calculus:Taylor Series 10 Taylor Series Approximation and Comparison Example n Given the function: 1)Plot f(x) from -2 to 2 2)Find the first 8 Taylor Series Terms (a=0) 3)Plot the approximation and compare against the original function f(x)
12
Calculus:Taylor Series 11 Plot f(x) The easiest way to generate a graph is to use ezplot ezplot leaves the axes unlabeled » syms x » f=1/(5+4*cos(x)); » ezplot(f,-2*pi,2*pi); » grid on » xlabel('x');ylabel('f(x)')
13
Calculus:Taylor Series 12 Plot of f(x)
14
Calculus:Taylor Series 13 Taylor Approximation n To find the first 8 terms of the Taylor series approximation: » ft_8=taylor(f,8) ft_8 = 1/9+2/81*x^2+5/1458*x^4+49/131220*x^6
15
Calculus:Taylor Series 14 n Approximation is only good for small x Comparison » hold on » ezplot(ft_8) » axis([-2*pi 2*pi 0 5]) n Plot approximation: Taylor approximation Original f(x)
16
Calculus:Taylor Series 15 Summary n The symbolic toolbox can be used to analyze definite and indefinite series summations n Taylor series can be used to approximate functions n MacLaurin series is a special case of the Taylor series approximated around x=0 n Increase the number of terms to increase approximation accuracy
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.