{VERSION 6 0 "IBM INTEL NT" "6.0" } {USTYLETAB {CSTYLE "Maple Input" -1 0 "Courier" 0 1 255 0 0 1 0 1 0 0 1 0 0 0 0 1 }{CSTYLE "2D Math" -1 2 "Times" 0 1 0 0 0 0 0 0 2 0 0 0 0 0 0 1 }{CSTYLE "2D Comment" 2 18 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 } {CSTYLE "" -1 256 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 257 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 258 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 259 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 260 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 261 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 262 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 263 "" 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 264 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 265 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 } {CSTYLE "" -1 266 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 267 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{CSTYLE "" -1 268 "" 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }{PSTYLE "Normal" -1 0 1 {CSTYLE "" -1 -1 "Tim es" 1 12 0 0 0 1 2 2 2 2 2 2 1 1 1 1 }1 1 0 0 0 0 1 0 1 0 2 2 0 1 } {PSTYLE "Heading 1" 0 3 1 {CSTYLE "" -1 -1 "" 1 18 0 0 0 0 0 1 0 0 0 0 0 0 0 0 }1 0 0 0 8 4 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 256 1 {CSTYLE " " -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }{PSTYLE "" 0 257 1 {CSTYLE "" -1 -1 "" 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 }3 0 0 -1 -1 -1 0 0 0 0 0 0 -1 0 }} {SECT 0 {EXCHG {PARA 256 "" 0 "" {TEXT 261 38 "Taylor and Maclaurin Se ries\nApril 2006" }}{PARA 257 "" 0 "" {TEXT -1 32 "revised March 2007, October 2008" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 4 "The " }{TEXT 262 6 "taylor" }{TEXT -1 9 " and the " }{TEXT 263 6 "series" }{TEXT -1 9 " commands" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 64 "You can display the first few terms of a Taylor series wi th the " }{TEXT 256 6 "taylor" }{TEXT -1 107 " command. To do so, you need to communicate the function and the point where the expansion ta kes place. \n" }{TEXT 257 10 "Examples: " }{TEXT -1 8 " Expand " } {XPPEDIT 18 0 "f(x) = exp(x);" "6#/-%\"fG6#%\"xG-%$expG6#F'" }{TEXT -1 5 " at " }{XPPEDIT 18 0 "x = 0;" "6#/%\"xG\"\"!" }{TEXT -1 14 " a nd expand " }{XPPEDIT 18 0 "f(x) = 1/x;" "6#/-%\"fG6#%\"xG*&\"\"\"F)F '!\"\"" }{TEXT -1 6 " at " }{XPPEDIT 18 0 "x = 1;" "6#/%\"xG\"\"\"" }{TEXT -1 5 " : " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 19 "taylo r(exp(x),x=0);" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "taylor(1/ x,x=1);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 163 "The number of terms c an be controlled with a third optional entry. Note, that the number i ndicates the order of the approximation, and not the number of terms. \+ \n" }{TEXT 264 8 "Example:" }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 66 "tayl or(sin(x),x=0,8);\ntaylor(sin(x),x=0,9);\ntaylor(sin(x),x=0,10);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 4 "The " }{TEXT 258 6 "series" }{TEXT -1 39 " command accomplishes the same task. \n" }{TEXT 265 8 "Example :" }{TEXT -1 22 " Expand the function " }{XPPEDIT 18 0 "f(x) = ln(x); " "6#/-%\"fG6#%\"xG-%#lnG6#F'" }{TEXT -1 4 " at " }{XPPEDIT 18 0 "x = \+ 2;" "6#/%\"xG\"\"#" }{TEXT -1 1 "." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 39 "series(ln(x),x=2);\nseries(ln(x),x=2,8);" }}}{EXCHG {PARA 0 "" 0 " " {TEXT -1 72 "The series command lets you even find an expansion when taylor fails. \n" }{TEXT 266 8 "Example:" }{TEXT -1 6 " Let " } {XPPEDIT 18 0 "f(x) = 1/sin(x);" "6#/-%\"fG6#%\"xG*&\"\"\"F)-%$sinG6#F '!\"\"" }{TEXT -1 3 " = " }{XPPEDIT 18 0 "csc(x);" "6#-%$cscG6#%\"xG" }{TEXT -1 25 ". A Taylor expansion at " }{XPPEDIT 18 0 "x = 0;" "6#/% \"xG\"\"!" }{TEXT -1 22 " is impossible, since " }{XPPEDIT 18 0 "f(0); " "6#-%\"fG6#\"\"!" }{TEXT -1 14 " is undefined." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "taylor(1/sin(x),x=0);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "However, we can find a series for this function:" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 24 "series(1/sin(x),x=0,10);" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 63 "Let us check the respective graphs of f and its approximation:." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 55 "y \+ :=x^(-1)+1/6*x+7/360*x^3+31/15120*x^5+127/604800*x^7;" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 76 "plot([1/sin(x),y],x=-4..4,view=[-4. .4,-4..4],discont=true,color=[red,blue]);" }}}{EXCHG {PARA 0 "> " 0 " " {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 59 "The series \+ approximates the cosecant at x=0 by approaching " }{XPPEDIT 18 0 "infi nity;" "6#%)infinityG" }{TEXT -1 18 " at the same pace." }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}{SECT 1 {PARA 3 "" 0 "" {TEXT -1 42 "Taylor coefficients and Taylor polynomials" }}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 8 "restart;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT 267 46 "Throughout this part we shall use the function" }{TEXT -1 3 " " }{XPPEDIT 18 0 "f(x) = exp(-x/2)*sin(x);" "6#/-%\"fG6#%\"xG*&-%$expG6# ,$*&F'\"\"\"\"\"#!\"\"F0F.-%$sinG6#F'F." }{TEXT -1 2 " " }{TEXT 268 61 "as an example, and we begin by defining it once and for all.\n" }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 28 "f := x -> sin(x)*exp(-x/2);\n" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 60 "A particular series coefficient ca n be calculated using the " }{TEXT 259 8 "coeftayl" }{TEXT -1 55 " com mand. For example the fifth series coefficient is " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 21 "coeftayl(f(x),x=0,5);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 48 "This is mathematically equivalent to computing " } {XPPEDIT 18 0 "`@@`(D,5)(f)(0)/5!;" "6#*&---%#@@G6$%\"DG\"\"&6#%\"fG6# \"\"!\"\"\"-%*factorialG6#F*!\"\"" }{TEXT -1 65 " and of course we ge t the same result when using this statement." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 16 "(D@@5)(f)(0)/5!;" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 145 "I am not certain which of the two commands (coeftayl or direct de rivative calculation) is numerically more efficient. Let us check our result. " }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 17 "taylor(f(x),x=0);" }} }{EXCHG {PARA 0 "" 0 "" {TEXT -1 47 "We see that our number is the co efficient for " }{XPPEDIT 18 0 "x^5;" "6#*$%\"xG\"\"&" }{TEXT -1 15 ", as expected. " }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 19 "We now turn to the " }{TEXT 260 35 "construction of Taylor polynomials." }{TEXT -1 426 " The simplest way is to accomplish this task is to obtain the first few terms of th e series with the taylor or the series command, and then apply the pop ular copy-and-paste technique. A more elegant way is to calculate the Taylor coefficients in a loop, and then assemble the polynomial as a \+ sum. A fairly generic model follows; recall that the function has alr eady been defined, and we don't need to duplicate that step.. " } {MPLTEXT 1 0 0 "" }}}{EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 200 "N := 8 : # degree of the Taylor polynomial\nc := 0: # point of expansio n\n# begin the construction\nfor k from 0 to N do\n a[k] := coeftay l( f(x),x=c, k):\nod:\np := x -> sum( a[n]*(x-c)^n,n=0..N):\n" }}} {EXCHG {PARA 0 "" 0 "" {TEXT -1 29 "Yes, the polynomial is there." }} {PARA 0 "> " 0 "" {MPLTEXT 1 0 5 "p(x);" }}}{EXCHG {PARA 0 "" 0 "" {TEXT -1 87 "Let's look at the graph of the function along with its 8t h degree Taylor approximation." }}{PARA 0 "> " 0 "" {MPLTEXT 1 0 62 "p lot([f(x),p(x)],x=-5..5,color=[red,blue],view=[-5..5,-4..6]);" }}} {EXCHG {PARA 0 "> " 0 "" {MPLTEXT 1 0 0 "" }}}}}{MARK "0 1 0" 32 } {VIEWOPTS 1 1 0 1 1 1803 1 1 1 1 }{PAGENUMBERS 0 1 2 33 1 1 }