Taylor and Maclaurin Series Last Revision: October 5th, 2010 Maple Commands Formal Power Series and the coeftayl command Maple lets you find a formal Taylor series expansion in inert form by converting the function into a Taylor series. Example: Expand the function at the point c=1. First we define the function, and then we use the convert command f := x -> 1/x; (1.1.1) convert( f(x) , FormalPowerSeries, x=1, n); (1.1.2) The option x=1 communicates the center of the expansion, and the option 'n' selects the counting index in the sum. Evaluation of the sum returns the original function. value(%); 1 (1.1.3) With the command coeftayl you can calculate a particular coefficient in the Taylor series. In the example with and the coefficient associated with is -1, and here is the confirmation coeftayl( 1/x,x=1,13); (1.1.4) coeftayl computes the quantity and we can do that directly using the appropriate differentiation command. In our example it is (the definition is still in effect) (D@@13)(f)(1)/13!; (1.1.5) Example: What is the coefficient associated with in the expansion of centered at c=0? coeftayl( exp(-x)*sin(2*x),x=0,7); 139 2520 or in explicit computation f := x -> exp(-x)*sin(2*x); (1.1.6) (1.1.7) (D@@7)(f)(0)/7!; 139 2520 (1.1.7) The taylor and the series commands You can display the first few term in a series expansion with the taylor command. Example: We use at the point c=1 again. taylor( 1/x,x=1); (1.2.1) The last expression indicates the order of the approximation. It can be controlled with a third optional entry. taylor(1/x, x=1, 12); (1.2.2) Example: We expand sin(x) at c=0. Notice that the third option does not control the number of terms. taylor(sin(x),x=0,8); (1.2.3) taylor(sin(x),x=0,9); (1.2.4) taylor(sin(x),x=0,10); (1.2.5) The series command accomplishes the same task, and it can even find series expansions where the taylor command fails. Example: We take again at the point c=1 . series( 1/x,x=1); (1.2.6) Example: The function is undefined at x=0, and a Taylor series centered at c=0 does not exist. However, the series command finds an expansion anyway. taylor( 1/sin(x), x=0); # error, as expected Error, does not have a taylor expansion, try series() series( 1/sin(x),x=0); (1.2.7) (1.2.7) This series expansion approximates the pace at which the function approaches zero, as the graph below indicates. f := x -> 1/sin(x); as x goes to (1.2.8) p := x -> 1/x +x/6+7/360*x^3; (1.2.9) plot( [f,p],-4..4,view=[-4..4,-4..4],discont=true,color= [red,blue]); 4 3 2 1 1 2 3 4 Direct Construction of Taylor Polynomials We now turn to the direct construction of Taylor polynomials without the aid of explicit maple commands. For instance, the coeftayl command just calculates the quantity and we can do that directly using the appropriate differentiation command. In order to construct the Taylor polynomial of a given degree we need to 1. define the function 2. select the center c 3. select the desired degree N of the polynomial 4. assemble the polynomial Example: Construct the Maclaurin polynomial of degree 8 for the function now go through the steps described above. f := x -> exp(-x/2)*sin(x); We (2.1) c := 0; N := 8; (2.2) (2.2) p := x -> sum( (D@@n)(f)(c)*(x-c)^n/n!, n=0..N); (2.3) p(x); #it's there (2.4) Here are the function and its approximation in a common graph. plot( [f(x),p(x)], x=-5..5,color=[red,blue], view=[-5..5,-4. .6],numpoints=2000); 6 4 2 2 4 x Example: Find the Taylor polynomial of degree 5 centered at c=4 for the function We modify the steps in the last example, and conclude with a graph. . f := x -> sqrt(x); c := 4; N := 5; p := x -> sum( (D@@n)(f)(c)*(x-c)^n/n!, n=0..N); (2.5) p(x); (2.6) plot([f(x),p(x)], x=-2..12, color=[red,blue],view=[-2..12,-2. .5]); 5 4 3 2 1 2 4 6 x 8 10 12
© Copyright 2026 Paperzz