Learn how to use Desmos Maclaurin and Taylor series 1 Go to www.desmos.com. Create an account (click on bottom near top right of screen) Change the grid settings (click on the spanner) to 1 x 3, 1 y 12 Get Desmos to sketch this graph y = 10 (1 exp ( x)) exp( x) means e x, and you find it under the "functions">"misc" button
Differential equations what they are 2 A differential equation is an equation which contains not just variables, like y and x, but also derivatives, like dy dx and d 2 y or even d 3 y. dx 2 dx 3 The differential equation d 2 s dx 2 = a (s=distance, x=time) we can solve exactly by integrating twice s = s 0 + ux + 1 2 ax 2 u=starting speed, s 0 =starting distance, usually 0. We always need to know some starting values to solve differential equations.
Differential equations Maclaurin series to solve them approximately 3 dy dx = 10 y is the equation for the speed y of a particle falling under gravity (taking g=10 for simplicity), slowed down by air resistance proportional to speed. Most differential equations can t be solved exactly. As it happens this equation can. Here s the solution, if y = 0 when x = 0. y = 10 (1 exp ( x)) But we ll take it as an example to find solutions by approximations like y = a 0 x + a 2 x 2 + a 3 x 3 +..., called Maclaurin series, which get better as you go on to include higher powers of x.
Maclaurin series and graphs Falling particle, air resistance 4 dy dx = 10 y (1) y = 0 when x = 0. Plug into equation (1) to get dy dx x=0= 10. Add to our approximation the simplest function that makes dy right (=10) dx differentiate equation (1) with respect to x, to get d 2 y = dy dy. Plug in dx dx x=0= 10 when x=0, get dx 2 d 2 y dx 2 x=0 = 10. Add to our approximation the simplest function that makes d 2 y right dx 2 Continue to get d 3 y dx 3 x=0 and adding the simplest function that makes d 3 y dx 3 right...
Maclaurin series and graphs falling particle on the graph 5
Maclaurin series and graphs series for falling particle 6
Maclaurin approximations making graphs fit better and better 7 Even if you can t solve a differential equation, you can find polynomials which approximate the solution. 1. You get the polynomials by looking at how things work just in the tiniest neighbourhood of one point (x=0) 2. You get a better fit for a bigger range of x by making the polynomial of higher degree (including higher powers) 3. Each approximation builds on the previous ones (the coefficients of smaller powers don t change)
Maclaurin approximations an infinite series fits perfectly 8 The approximation gets good as you like, as long as you go to big enough powers. Then the solution to the equation equals the infinite series. y = a 0 + a 1 x + a 2 x 2 + a 3 x 3 +... + a n x n +... So this infinite series is an exact solution to the problem we started with 10(x 1 2 x 2 +... + ( 1) n+1 1 n! x n +...)
Maclaurin series formulas 9 a n = 1 n! d n y dx n x=0 for the Maclaurin approximations y = a 0 + a 1 x + a 2 x 2 + a 3 x 3 +... + a n x n +... d n y can also be written as y (n) (0), or, if y = f (x), as dx n n! f (0), f (0), f (0), etc.
Maclaurin series formulas 10 Zero th approximation y = a 0 is "anchored" by being the simplest formula which has y correct at x = 0, so a 0 = y x=0 First approximation y = a 0 + a 1 x is "anchored" by also having dy correct at x = 0, so a dx 1 = dy dx x=0 Second approximation y = a 0 + a 1 x + a 2 x 2 is "anchored" by also having d 2 y correct at x = 0, so dx 2 a 2 = 1 d 2 y 2 dx 2 x=0 Third approximation y = a 0 + a 1 x + a 2 x 2 + a 3 x 3 is "anchored" by also having d 3 y correct at x = 0, so dx 3 a 3 = 1 d 3 y 3! dx 3 x=0... Example: y = 10x x 2 10 + x 3 10 x 4 10 +... 2! 3! 4!
Maclaurin series and graphs resistance = 2my 11 Use the same method to sketch approximations y = a 0 + a 1 x + a 2 x 2 + a 3 x 3 +... when air resistance = 2ym, so, using g=10: = 10 2y and y = 0 when x = 0 dy dx 1. a 0 = 0 (makes approximation right when x=0) 2. plug that y = 0 into the differential equation, get dy dx when x=0, choose a 1 to make that right 3. differentiate equation (1), plug in values for y and dy dx when x=0, get d 2 y when x = 0, choose a 2 to make dx 2 that right 4. differentiate the new equation, plug in values for y, dy d 2 y dx 2 that right... when x=0, get d 3 y dx 3 when x=0, choose a 3 to make dx,
Maclaurin series and graphs resistance = 2my 12
Maclaurin series and graphs resistance = ym, starting speed 2 13 Air resistance = ym, and the particle is thrown downwards at a starting speed of 2 ms 1. Use g=10; x = time. The differential equation is: dy = 10 y and y = 2 wnen x = 0 dx 1. choose a 0 to make y right (=2) when x=0 2. plug that y = 2 into the differential equation and get dy when x=0, choose a dx 1 to make that right 3. differentiate equation, plug in values for y and dy dx when x=0, get d 2 y when x=0, choose a dx 2 2 to make that right 4. differentiate the new equation, plug in values for y, dy and d 2 y when x=0, get d 3 y when x=0, choose a dx 2 dx 3 3 to make that right... dx,
Maclaurin series and graphs starting speed 2 14
Maclaurin series for functions examples 15 We could start with an ordinary equation y = e x or y = sin x or and get a Maclaurin series by choosing a 0 = y x=0, a 1 = dy dx x=0, a 2 = d 2 y dx 2 x=0, a 3 = d 3 y dx 3 x=0, etc. We can "code" every well-behaved-enough function by better-and-better polynomial approximations, or exactly by an infinite series. Why bother? Because to calculate e.g. e x or sin x we need to break the calculations down into adding, subtracting, multiplying, and dividing. It s like being able to "code" every real number as a decimal: 1 = 0.5, 1 = 0.33333..., π = 3.14159... 2 3 2 = 1.41421..., e = 2.71828..., etc.
Maclaurin series e x 16 a n = 1 n! d n y dx n x=0 for the Maclaurin approximations d n y dx n y = a 0 + a 1 x + a 2 x 2 + a 3 x 3 +... + a n x n +... can also be written as y (n) (0), or, if y = f (x), as f (0), f (0), f (0), etc. Calculate a Maclaurin series for y = e x
Maclaurin series e x 17
Maclaurin series sin x 18 Notice the approximation can even learn to "turn round". The best (red) approximation is y = x x 3 + x 5 x 7 + x 9 3! 5! 7! 9!
Maclaurin series shortcuts 19 The Maclaurin series for y = x e x can be got in the same way as the ones we ve done so far, by differentiating again and again and then putting x = 0. Or by a shortcut: just multiply the series for y = e x through by x. Do it both ways and confirm you get the same answer
Maclaurin series x e x 20
Maclaurin series shortcuts 21 Get these Maclaurin series (terms up to x 4 ) both by differentiating again and again and by the shortcut indicated. 1. y = e x 2. Shortcut: put x 2 in place of x in series for y = e x 2. y = sin (x 2 ). Shortcut: put x 2 in place of x in series for y = sin x 3. y = x sin x. Shortcut: multiply the series for y = sin x through by x 4. y = sin 2 x = (sin x) 2. Shortcut: write out two identical series for sin x, and then multiply them together.
Maclaurin series bounds to validity 22 Calculate Maclaurin approximations for y = 1 1 x. Our answers for e x, xe x, and sin x are valid for all values of x. This one isn t. Which values of x is it valid for?
Maclaurin series bounds to validity 23 What is the infinite Maclaurin series for y = 1 1+x 2? Which values of x does this work for?
Maclaurin series bounds to validity 24 For these functions, for what range of x do you think will the Maclaurin series will be good? y = 1 1 2x y = 1 4+x 2 Maclaurin series are valid within a circle in the complex plane, centre 0, and radius limited by the nearest point in the complex plane where the function blows up. Extreme case: y = e 1 z 2 blows up at x=0. e 1 z 2 approaches 0 if z moves towards 0 along the real axis, but approaches if z moves towards 0 along the imaginary axis, so the Maclaurin series is valid in a circle of radius... zero.
Maclaurin series from function and from diff eq 25 Calculate Maclaurin series up to the x 5 term for y = cos x y = cos x is also the solution to the differential equation d 2 y dx 2 = y with y = 1 and dy = 0 when x=0. dx Get the same Maclaurin series from the differential equation
Maclaurin series for ln(1 + x) 26 Calculate the Maclaurin series for y = ln(1 + x)
Maclaurin series for numerical approximations 27 e x 1 + x + x 2 2! + x 3 3! + x 4 4! + x 5 5! cos x 1 x 2 2! + x 4 4! sin x x x 3 3! + x 5 5! Use these approximations to calculate e, sin π 6, and cos π 6, and compare your answers with what you get from your calculator (set to radians).
Differential equation problems from the textbook 28 Exercise 6E, page 122. Q.1. Find a series solution, in ascending powers of x up to and including the term in x 4, for the differential equation d 2 y dx 2 = x + 2y given at x=0, y=1 and dy dx = 1 Q.4. Find a series solution in ascending powers up to x 4 for d 2 y dx + x dy 2 dx + y = 0 given that at x=0 y = 1, dy dx = 2
Answers to problems Textbook p.122 29 1. y = 1 + x + x 2 + 1 2 x 3 + 1 6 x 4 +... 4. y = 1 + 2x 1 2 x 2 2 3 x 3 + 1 6 x 4 +...
More differential equation problems from the textbook 30 Exercise 6E, page 122. Q.2. The variable y satisfies (1 + x 2 ) d 2 y dx 2 + x dy dx = 0 and at x=0 y = 0, dy = 1. Find a series expansion for dx y in ascending powers of x up to and including the term in x 3 3. Given that y satisfies the differential equation dy dx + y ex = 0 and that at x=0, y = 2, find a series solution for y in ascending powers of x up to and including the term in x 3
Answers to problems Textbook p.122 31 2. y = x 1 6 x 3 +... 3. y = 2 x + x 2 1 6 x 3 +...
Function problems from the textbook 32 (Q.4 from textbook, p.111): Using the series expansions for ln(1 + x), find, correct to 3 decimal places, the value of ln( 6 5 ) (Q.5 from textbook, p.111): Use Maclaurin s expansion and differentiation to expand, in ascending powers of x up to and including the term in x 4 : (a) e 3x ; (b) ln(1 + 2x); (c) sin 2 x [Note: sin 2 x means (sin x) 2 ]
Function problems from the textbook 33 (Example 8 from textbook, p.113): Given that terms in x n may be neglected for n > 4, use the series for e x and sin x to show that: e sin x 1 + x + x 2 2 x 4 8 [Note: means "is approximately equal to".] Find the first few terms of a Maclaurin series for y = (1 x) 2 (Q.8 from textbook, p.114) Expand sin x (1 x) 2 ascending powers of x as far as the term in x 4 by considering the product of the expansions of sin x and (1 x) 2. in
Taylor series Like Maclaurin, but centred somewhere 0 34 If y = ln z, or y = 1, or y = 1, we can t calculate a z z 2 Maclaurin series. Those functions blow up at z=0 But we can calculate ln(1 + x) = x + x 2 + x 3 + x 4 +... 2 3 4 Put z = 1 + x, and it translates into a series for ln z in powers of (z 1) Write out that series Say what range of z it is valid for By a similar method, get a series for 1 in powers of z (z 1), and say what range of z it s valid for. By a similar method, get a series for 1 in powers of z 2 (z 1), and say what range of z it s valid for. A series for f(x) like a Maclaurin series, but in powers of (x b) with b 0 rather than powers of x, is called a Taylor series.
Taylor series Another way of calculating 35 We may want a series for y = f (x) in powers of (x b) rather than powers of x. That may be because f (x) blows up at x = 0 but is ok at x = b. Or because we know f (b) and want an approximation for f (x) for values of x close to b. There are two ways of getting the series in powers of (x b). Put z = x b so y = f (z + b), get a Maclaurin series for f (z + b) in terms of powers of z, then substitute back x b for z. Or work out the series directly from this formula y = c 0 + c 1 (x b) + c 2 (x b) 2 + c 3 (x b) 3 +... c n = 1 n! d n y dx n x=b
2 ways of getting Taylor series y = sin x in powers of (x π) 36 Maclaurin formula sin(z + π) = z + z3 6... Put x = z + π Taylor formula y = c 0 +c 1 (x π)+c 2 (x π) 2 +... c n = 1 n! d n dx n (sin x) x=π c 1 = cos π, c 2 = 1 2 sin π... y = (x π) + (x π)3 6... y = (x π) + (x π)3 6... Calculate a series for y = cos x in powers of (x π) up to (x π) 2 by either method. Use your answer to get an approximation for cos(3.2).
Taylor series for y = sin x in powers of (x π 4 ) 37 Calculate (whichever way you like) a Taylor series for y = sin x in powers of (x π 4 ) up to the term in (x π 4 )3 y = c 0 + c 1 (x π 4 ) + c 2(x π 4 )2 + c 3 (x π 4 )3 +... Use your answer to get an approximations for sin π and 3 sin π, and check your answers against what you get from 6 your calculator.
Practice problems 1 from FP2 book Review Exercises 2 38
Practice problems 2 from FP2 book Review Exercises 2 39
Practice problems 3 from FP2 book Review Exercises 2 40