Sei sulla pagina 1di 34

Learn how to use Desmos

Maclaurin and Taylor series 1

I Go to www.desmos.com. Create an account (click on


bottom near top right of screen)
I Change the grid settings (click on the spanner) to

1 x 3, 1 y 12

I Get Desmos to sketch this graph

y = 10 (1 exp (x))

exp(x) means ex , and you find it under the


"functions">"misc" button

| 170615maclaurin
Differential equations
when we can solve them exactly 2

A differential equation is an equation which contains not


just variables, like y and x, but also derivatives, like dy
dx
2 3
and ddxy2 or even ddxy3 .
The differential equation
d 2s
=a
dx 2
(s=distance, x=time) we can solve exactly by integrating
twice
1
s = s0 + ux + ax 2
2
u=starting speed, s0 =starting distance, usually 0. We
always need to know some starting values to solve
differential equations.
| 170615maclaurin
Differential equations
when we cant solve them exactly 3

dy
= 10 y
dx
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 cant be solved exactly. In fact
this equation can.

y = 10 (1 exp (x))

Well take it as an example for how to find a solution by


better and better approximations so we can see those
approximations getting closer to an answer we already
know.
| 170615maclaurin
Trial and improvement
falling particle, air resistance 4

dy
= 10 y (1)
dx

I y = 0 when x = 0. Plug into equation (1) to get


dy
| = 10. Add to our approximation the simplest
dx x=0
function that makes dy dx
right (=10)
I differentiate equation (1) with respect to x, to get
d 2y
dx 2
= dy
dx
. Plug in dy | = 10 when x=0, get
dx x=0
d 2y
| = 10. Add to our approximation the simplest
dx 2 x=0
2
function that makes ddxy2 right (-10)
3
I Continue to get ddxy3 |x=0 and adding the simplest
3
function that makes ddxy3 right . . .
| 170615maclaurin
Trial and improvement
on the graph 5

| 170615maclaurin
Trial and improvement
the equations 6

| 170615maclaurin
Trial and improvement
the general method 7

I First approximation y = y0 is "anchored" by being the


simplest formula which has y correct at x=0
I Second approximation y = y0 + x dy |
dx x=0
is
dy
"anchored" by having both y and dx correct at x=0
2 2
I Third approximation y = y0 + x2 ddxy2 |x=0 is
2
"anchored" by having y, dy
dx
, and ddxy2 all correct at x=0
3 3
I Fourth approximation y = y0 + x6 ddxy3 |x=0 is
2 3
"anchored" by having y, dy , d y and ddxy3 all correct at
dx dx 2
x=0
I ...
x2 x3 x4
Example: y = 10x 2
10 + 6
10 24
10 + . . .
| 170615maclaurin
Trial and improvement
resistance = 2ym 8

I Use the same method to sketch approximations


when air resistance = 2ym, so, using g=10:
dy
= 10 2y (2)
dx

1. y = 0 (y is right when x=0)


2. plug that y = 0 into the differential equation and get
dy
dx
right, too, when x=0
dy
3. differentiate equation (1), plug in values for y and dx
2
when x=0, get ddxy2 right when x=0
dy
4. differentiate the new equation, plug in values for y, dx
,
2 3
and ddxy2 when t=0, get ddxy3 right when x=0
| 170615maclaurin
Trial and improvement
resistance = 2my 9

| 170615maclaurin
Trial and improvement
yet another differential equation 10

Use the same method for approximations when air


resistance = ym, and the particle is thrown downwards at
a starting speed of 2 ms1 . Use g=10; x = time. The
differential equation is: dy
dx
= 10 y
1. make y right (=2) when x=0
2. plug that y = 2 into the differential equation and get
dy
dx
right, too, when x=0
dy
3. differentiate equation, plug in values for y and dx
2
when x=0, get ddxy2 right when x=0
dy
4. differentiate the new equation, plug in values for y, dx
,
2 3
and ddxy2 when x=0, get ddxy3 right when x=0

| 170615maclaurin
Trial and improvement
falling, initial speed 2 11

| 170615maclaurin
Polynomials as approximations
solutions to differential equations 12

Even if you cant 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 better approximations for bigger
neighbourhoods by making the polynomial of higher
degree (including higher powers)
3. Each approximation builds on the previous ones (the
coefficients of smaller powers dont change)

| 170615maclaurin
Polynomials as approximations
Infinite series as perfect approximations 13

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 = a0 + a1 x + a2 x 2 + a3 x 3 + . . . + an x n + . . .

This is an exact solution to the problem we started with

1 1
10(x x 2 +. . .+(1)n+1 x n +. . .)
2 n (n 1) (n 2) . . . 3 2

| 170615maclaurin
"Coding" all functions
by polynomial approximations and exact infinite series 14

We could start with an ordinary equation y = sin x or


y = ex and get a Maclaurin series by choosing terms to
2 3
be right for y |x=0 , dy |
dx x=0
, ddxy2 |x=0 , ddxy3 |x=0 , etc.
So we can "code" every well-behaved-enough function by
better-and-better polynomial approximations, or exactly by
an infinite series.
That helps us work out e 2 and such and to do algebra
and calculus with functions using things we know about
polynomials

| 170615maclaurin
"Coding" all functions
by polynomial approximations and exact infinite series 15

I Calculate a Maclaurin series for powers up to x 3 for


1
y = 1x . (Choose terms to be right for y |x=0 , dy |
dx x=0
,
d 2y 3
| , d y| ,
dx 2 x=0 dx 3 x=0
etc.)
I What will the rest of the infinite series be? What is
the term in x 237 , for example?
1
I What is the infinite Maclaurin series for y = 1+x ?
I Check that series (terms up to x 5 ) on your calculator)
for x = 12 and for x = 2. Looks like this series works
only for some values of x. Which ones?

| 170615maclaurin
Polynomials as approximations
they can learn to "turn round": example, sin x 16

The approximation can even learn to "turn round". The


3 x5 x7 x9
best (red) approximation is y = x x6 + 120 5040 + 362880

| 170615maclaurin
The term n factorial, or n!
n! = n(n-1)(n-2) ... (2)(1) 17

By convention 0! = 1
1! = 1
2! = 2 1 = 2
3! = 3 2 1 = 6
n! = n (n 1) (n 2) . . . 3 2

I Calculate 4!, 5!, 6!, 7!, 8!, and check with your
calculator
I Does n! increase faster than n2 ? Than n100 ? Than
10n ?

| 170615maclaurin
Working out Maclaurin series
General rule 18

In the series (called a Maclaurin series)

y = a0 + a1 x + a2 x 2 + a3 x 3 + . . . + an x n + . . .

the term a0 "anchors" the polynomial to be right for y


when x=0
the term a1 "anchors" it to be right for dy
dx
, also called y 0 ,
when x=0
n
the term an "anchors" it to be right for ddxyn , also called y (n) ,
when x=0
dny
I Write the general formula connecting an and | ,
dx n x=0
also called y (n) (0)

| 170615maclaurin
Coefficients for Maclaurin series
General rule. Maclaurin series from ordinary equations 19

y (n) (0) 1 d ny
an = = |x=0
n! n! dx n

I Use this rule to calculate Maclaurin series up to the


x 5 term for these ordinary (not differential) equations

y = sin x

y = cos x
I Differentiate your series for y = sin x term by term to
d
find dx sin x
I What do you notice?
| 170615maclaurin
Working out the series
The formula 20

y 00 (0) 3 y 000 (0) y (n) (0)


y = y (0)+xy 0 (0)+x 2 +x +. . .+x n +. . .
2! 3! n!

I Use this formula to calculate a Maclaurin series for


y = ex up to the x 5 term
I Substitute iz for x to find a Maclaurin series for y = eiz
up to the z 5 term
I By adding Maclaurin series for cos z and sin z, find a
Maclaurin series for cos z + i sin z up to the z 5 term
I What do you notice?
| 170615maclaurin
Differential equation problems
from the textbook 21

I 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 2y
= x + 2y
dx 2

given at x=0, y=1 and dy


dx
=1
I Q.4. Find a series solution in ascending powers up to
x 4 for
d 2y dy
2
+x +y =0
dx dx
given that at x=0 y = 1, dy
dx
=2
| 170615maclaurin
Answers to problems
Textbook p.122 22

1. y = 1 + 21 x + x 2 + 13 x 3 + 16 x 4 + . . .

4. y = 1 + 2x 12 x 2 23 x 3 + 81 x 4 + . . .

| 170615maclaurin
More differential equation problems
from the textbook 23

I Exercise 6E, page 122. Q.2. The variable y satisfies


d 2y dy
(1 + x 2 ) 2
+x =0
dx dx
and at x=0 y = 0, dy
dx
= 1. Find a series expansion for
y in ascending powers of x up to and including the
term in x 3
I 3. Given that y satisfies the differential equation
dy
+ y ex = 0
dx
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
x3
| 170615maclaurin
Answers to problems
Textbook p.122 24

2. y = x 16 x 3 + . . .

3. y = 2 x + x 2 16 x 3 + . . .

| 170615maclaurin
Maclaurin series for functions
Example: calculating sin x 25

The Maclaurin series


y 00 (0) 3 y 000 (0) y (n) (0)
y = y (0)+xy 0 (0)+x 2 +x +. . .+x n +. . .
2! 3! n!
(3)
is useful for y = sin x, for example. How, apart from
drawing a big triangle and measuring carefully, can you
work out sin(10 ), which is sin( 18
)?

I Using equation (3), find a Maclaurin series up to x 5


sin x = a0 + a1 x + a2 x 2 + a3 x 3 + a4 x 4 + a5 x 5 + . . .

I Put x = 18 . Calculate the polynomial approximation
for sin x
I Compare it with what your calculator says.
| 170615maclaurin
Maclaurin series and integration
Example: the normal distribution 26

The normal distribution has the probability density


1 2
function p(t) = 12 e 2 t .
The Rcumulative probability of 0 error x is
x 1 t2
1 e 2 dt. But it is proved that it is impossible to
2 0
1 2
integrate e 2 t exactly! So...
I Calculate terms up to z 3 of a Maclaurin series for
y = ez
1
I Substitute x 2 for z to get terms up to x 6 of a
2 1 2
Maclaurin series for y = e 2 x
I Integrate that series term-by-term to get terms up to
Rx 1 2
x 7 for a Maclaurin series for 0 e 2 t dt
I Graph your result on Desmos with the grid set to
0 x 2, 0.1 y 1.3
| 170615maclaurin
Maclaurin series and integration
Normal distribution integrated 27

| 170615maclaurin
For what x are Maclaurin series valid?
Example: y=1/(1-x) 28

I Calculate terms up to x 4 of a Maclaurin series for


1
y = 1x
I Graph your result on Desmos with the grid set to
0.1 x 2, 10 y 10
I With the other Maclaurin series youve done, you get
closer and closer to the real graph with more terms,
and you can guess (what is in fact true) that with
infinitely many terms the series is exactly equal to the
function. Here the approximation collapses beyond a
certain value of x. What value?

| 170615maclaurin
For what x are Maclaurin series valid?
Graphs for y=1/(1-x) 29

| 170615maclaurin
For what x are Maclaurin series valid?
The rule 30

Rule: if a Maclaurin series is valid, its valid for complex as


well as real x. It is valid (we say: the function is analytic)
as far out from the origin as the nearest singularity (point
where the function "blows up").
I Calculate terms up to x 4 of a Maclaurin series for
1
y = 1+x 2

I Graph your result on Desmos with the grid set to


1.6 x 1.6, 7 y 7
I Where does this Maclaurin series start failing?

| 170615maclaurin
Maclaurin series for 1/(1 + x 2)
Fails for |x|>1 because blows up at x=1 31

The singularity which makes it fail is x = i, even though


you cant see that singularity, only its consequences,
when graphing the function for real x
| 170615maclaurin
For what x are Maclaurin series valid?
Examples 32

I For these functions, for what range of x will the


Maclaurin series be good (give as good an
approximation as you like, as long as you calculate
enough terms)?
1
I y = 12x
1
I y= 4+x 2
1 n
For y = e x 2 , the derivative over real numbers ddxyn |x=0 = 0
for all n. The Maclaurin series exists, but is invalid for all
x 6= 0
1
The function has a singularity at x=0. e z 2 approaches 0 if
z moves towards 0 along the real axis, but approaches
if z moves towards 0 along the imaginary axis.
| 170615maclaurin
Taylor series
Like Maclaurin, but centred somewhere 6= 0 33

If y = ln x, we cant calculate a Maclaurin series for y


because y and dy dx
(etc.) blow up at x=0
So take 1 as the centre instead of 0.

y = a0 + a1 (x 1) + a2 (x 1)2 + a3 (x 1)3 + . . .

y (n) (1) 1 d ny
an = = |x=1
n! n! dx n
I Work out this series up to the (x 1)3 term for ln x

| 170615maclaurin
Taylor series for y = ln x
Centred at x=1. And for y = sin x centred at 4 34

(x 1)2 (x 1)3 (x 1)4


ln x = (x 1) + + . . . (4)
2 3 4
This is a Taylor series centred at 1. A Maclaurin series is
a Taylor series centred at 0.
I Substitute z = x 1 in equation 4 to get a Maclaurin
series, y = a0 + a1 z + a2 z 2 + a3 z 3 + . . ., for
y = ln(1 + z)
I Differentiate that series term-by-term, and see what
d
dz
ln(1 + z) is
I Calculate a Taylor series with centre
4
2
y = a0 + a1 (x ) + a2 (x ) + a3 (x )3 + . . .
4 4 4
for y = sin x.
| 170615maclaurin

Potrebbero piacerti anche