Math 3C Euler’s Method Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB.
-
date post
22-Dec-2015 -
Category
Documents
-
view
212 -
download
0
Transcript of Math 3C Euler’s Method Prepared by Vince Zaccone For Campus Learning Assistance Services at UCSB.
Math 3C
Euler’s Method
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Euler’s Method will find an approximate solution to an initial value problem.
Let’s work through a simple example:
Suppose we want to solve the following initial value problem:
1)0(y
y3.0y
a) First find an estimate for y(2) using Euler’s Method
with a step size of 1
b) Next get a better estimate by using a step size of 0.5.
c) Finally, solve the problem exactly and compare to the estimates from parts a) and b)
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Euler’s Method will find an approximate solution to an initial value problem.
Let’s work through a simple example:
Suppose we want to solve the following initial value problem:
1)0(y
y3.0y
a) First find an estimate for y(2) using Euler’s Method
with a step size of 1
b) Next get a better estimate by using a step size of 0.5.
c) Finally, solve the problem exactly and compare to the estimates from parts a) and b)
Euler’s method will create a piecewise linear approximation to y(t) by using the given differential equation to calculate the slope of the solution curve at each step, then following that slope to calculate the approximations.
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Euler’s Method will find an approximate solution to an initial value problem.
Let’s work through a simple example:
Suppose we want to solve the following initial value problem:
a) First find an estimate for y(2) using Euler’s Method with a step size of 1
b) Next get a better estimate by using a step size of 0.5.
c) Finally, solve the problem exactly and compare to the estimates from parts a) and b)
The first step is to use the given equation and initial value to find the initial slope (at t=0):
3.0)1(3.0)0(y3.0)0(y
1)0(y
y3.0y
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Euler’s Method will find an approximate solution to an initial value problem.
Let’s work through a simple example:
Suppose we want to solve the following initial value problem:
a) First find an estimate for y(2) using Euler’s Method with a step size of 1
b) Next get a better estimate by using a step size of 0.5.
c) Finally, solve the problem exactly and compare to the estimates from parts a) and b)
The first step is to use the given equation and initial value to find the initial slope (at t=0):
Next we use this slope to find the approximation for y(1):
3.1)1()3.0(1)1(y~t)0(y)0(y)1(y~
1)0(y
y3.0y
3.0)1(3.0)0(y3.0)0(y
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Euler’s Method will find an approximate solution to an initial value problem.
Let’s work through a simple example:
Suppose we want to solve the following initial value problem:
a) First find an estimate for y(2) using Euler’s Method with a step size of 1
b) Next get a better estimate by using a step size of 0.5.
c) Finally, solve the problem exactly and compare to the estimates from parts a) and b)
The first step is to use the given equation and initial value to find the initial slope (at t=0):
Next we use this slope to find the approximation for y(1):
Now we repeat this process, calculating the slope at t=1:
39.0)3.1()3.0()1(y~)3.0()1(y~
1)0(y
y3.0y
3.0)1(3.0)0(y3.0)0(y
3.1)1()3.0(1)1(y~t)0(y)0(y)1(y~
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Euler’s Method will find an approximate solution to an initial value problem.
Let’s work through a simple example:
Suppose we want to solve the following initial value problem:
a) First find an estimate for y(2) using Euler’s Method with a step size of 1
b) Next get a better estimate by using a step size of 0.5.
c) Finally, solve the problem exactly and compare to the estimates from parts a) and b)
The first step is to use the given equation and initial value to find the initial slope (at t=0):
Next we use this slope to find the approximation for y(1):
Now we repeat this process, calculating the slope at t=1:
We have one last step – calculate the approximation for y(2):
69.1)1()39.0(3.1)2(y~t)1(y~)1(y~)2(y~
Here is our answer to part a)
1)0(y
y3.0y
3.0)1(3.0)0(y3.0)0(y
3.1)1()3.0(1)1(y~t)0(y)0(y)1(y~
39.0)3.1()3.0()1(y~)3.0()1(y~
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
It is helpful to see a graph of our results.
y(step size 1)
00.20.40.60.8
11.21.41.61.8
2
0 0.5 1 1.5 2
Notice that we used two steps, and we have two straight line segments
(whose slopes we calculated from the given D.E.)
Slope=0.3
Slope=0.39
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0
0.5
1.0
1.5
2.0
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0
0.5
1.0
1.5
2.0
Calculate y’(0) from the original D.E.
y3.0y
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5
1.0
1.5
2.0
Calculate y’(0) from the original D.E.
y3.0y
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5
1.0
1.5
2.0
Find y(0.5) from the formula
t)0(y)0(y)5.0(y~
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15
1.0
1.5
2.0
Find y(0.5) from the formula
15.1)5.0()3.0(1)5.0(y~t)0(y)0(y)5.0(y~
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15
1.0
1.5
2.0
Calculate y’(0.5) from the original D.E.
y3.0y
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15 0.345
1.0
1.5
2.0
Calculate y’(0.5) from the original D.E.
345.0)15.1()3.0(y
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15 0.345
1.0
1.5
2.0
Find y(1.0) from the formula
t)5.0(y~)5.0(y~)0.1(y~
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15 0.345
1.0 1.3225
1.5
2.0
Find y(1.0) from the formula
3225.1)0.1(y~)5.0()345.0(15.1)0.1(y~
t)5.0(y~)5.0(y~)0.1(y~
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15 0.345
1.0 1.3225
1.5
2.0
Fill in the rest of the table in the same manner, calculating a slope, then using it to get the next value for y…
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15 0.345
1.0 1.3225 0.39675
1.5 1.520875
2.0
Fill in the rest of the table in the same manner, calculating a slope, then using it to get the next value for y…
I kept all the digits, but you can
probably round off a little bit
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Now we can run through the procedure for part b). We use 4 steps this time, each of step size 0.5.
This time let’s make a table to organize our calculations:
t y y’
0.0 1.0 0.3
0.5 1.15 0.345
1.0 1.3225 0.39675
1.5 1.520875 0.4562625
2.0 1.74900625
Fill in the rest of the table in the same manner, calculating a slope, then using it to get the next value for y…
I kept all the digits, but you can
probably round off a little bit
Here is our answer to part b)
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Here is the graph of our results from parts a) and b).
The new calculation should be more accurate because we used more steps that were closer together. In the next step we will find the exact answer.
2, 1.69
2, 1.749
00.20.40.60.8
1
1.21.41.61.8
2
0 0.5 1 1.5 2
y(step size 1) y(step size 0.5)
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
1)0(y
y3.0y
We want the value for y(2).
First we will separate, then integrate to find the general solution.
dt3.0y3.0y
dydtdy
We can actually solve this problem, so let’s do it using separation of variables.
(You should be able to find the general solution to this one in your head in <5 seconds, btw).
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
1)0(y
y3.0y
We want the value for y(2).
First we will separate, then integrate to find the general solution.
dt3.0y3.0y
dydtdy
t3.0CeyCt3.0yln
We can actually solve this problem, so let’s do it using separation of variables.
(You should be able to find the general solution to this one in your head in <5 seconds, btw).
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
1)0(y
y3.0y
We want the value for y(2).
First we will separate, then integrate to find the general solution.
dt3.0y3.0y
dydtdy
t3.0CeyCt3.0yln
Next put in the given initial value to find C:
We can actually solve this problem, so let’s do it using separation of variables.
(You should be able to find the general solution to this one in your head in <5 seconds, btw).
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
1)0(y
y3.0y
We want the value for y(2).
First we will separate, then integrate to find the general solution.
dt3.0y3.0y
dydtdy
t3.0CeyCt3.0yln
Next put in the given initial value to find C:
1CCe1Ce)0(y 0)0(3.0
We can actually solve this problem, so let’s do it using separation of variables.
(You should be able to find the general solution to this one in your head in <5 seconds, btw).
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
1)0(y
y3.0y
We want the value for y(2).
First we will separate, then integrate to find the general solution.
dt3.0y3.0y
dydtdy
t3.0CeyCt3.0yln
Next put in the given initial value to find C:
1CCe1Ce)0(y 0)0(3.0
So our solution is t3.0e)t(y
We can actually solve this problem, so let’s do it using separation of variables.
(You should be able to find the general solution to this one in your head in <5 seconds, btw).
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
1)0(y
y3.0y
We can actually solve this problem, so let’s do it using separation of variables.
(You should be able to find the general solution to this one in your head in <5 seconds, btw).
We want the value for y(2).
First we will separate, then integrate to find the general solution.
dt3.0y3.0y
dydtdy
t3.0CeyCt3.0yln
Next put in the given initial value to find C:
1CCe1Ce)0(y 0)0(3.0
So our solution is t3.0e)t(y
Last step – plug in t=2
82212.1e)2(y 6.0
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB
Here is the graph comparing our results.
Notice that the approximation with the smaller step size is closer to the exact value (but it took more work to get there).
We can calculate the % error in our estimates as a check on their accuracy.
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
0 1 2 3
y(step size 1)
y(step size 0.5)
y=e (̂0.3t)
y(2) % error
step size =1
1.690 7.2%
step size =0.5
1.749 4.0%
exact 1.822 0.0%
Prepared by Vince Zaccone
For Campus Learning Assistance Services at UCSB