Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Drexel University, College of Engineering 2017-2018 Academic Year

Drexel University
Office of the Dean of the College of Engineering
ENGR 232 – Dynamic Engineering Systems

Homework 1

The following problems are similar to those from the main course textbook: Differential Equations and Linear Algebra
(Farlow and Hall). The material on this homework will appear on Quiz #1.

Problem 1: Classification of Differential Equations


Fill in the following table, specifying the dependent variable, the independent variable(s), the order of the
differential equation and whether it is linear or nonlinear and explain why. If the system is nonlinear, place a box
around the term(s) making it nonlinear. All equations are in terms of a function of an independent variable.

SYSTEM ORDER? Dependent Independent LINEAR or NONLINEAR? Autonomous?


Variable Variable Circle any nonlinear
terms.
Yes or No

1. 𝑥 2 𝑦′′ + 3𝑥𝑦′ + 2𝑦 = 𝑒 −𝑥

2. 𝑦 ′ = 𝑦 − 𝑥

𝑑2 𝜃
3. 𝑑𝑡 2
+ sin 𝜃 = 0 (Pendulum)

3
𝑑 𝑥 𝑑𝑥
4. 𝑥 3 ∙ 3 − 𝑥 ∙ 𝑑𝑡 = 𝑥2
𝑑𝑡

𝑑2 𝑖 𝑑𝑖 𝑖
5. 𝐿 𝑑𝑡 2 + 𝑅 𝑑𝑡 + 𝑘 = 𝐸 sin(𝑘𝑡)

𝑑4 𝑦 𝑑2 𝑦
6. 𝑑𝑡 4
+ 4 ∙ 𝑑𝑡 2 = 5𝑦

7. 𝜃 ′′ + sin 𝜃 = sin 𝜔𝑡

8. 𝑡 ′′ − 2𝑥𝑡 ′ + 𝑥 2 = 0
Here, t is a function of x!

𝑑𝑦 2 𝑑𝑦
9. ( 𝑑𝑡 ) + 2 𝑑𝑡 + 1 = cos2 (𝑡)

𝑑𝑦 2
10. (𝑑𝑥 ) = +1

1
Drexel University, College of Engineering 2017-2018 Academic Year

𝑑𝑦 2
11. (𝑑𝑥 ) = −1
Does this DE have any solutions?

𝑑𝑦
12. 𝑑𝑡
= 4𝑦 − 𝑦 2
Logistic!

𝑑𝑧
13. 𝑑𝑡
= 1 − 4𝑧
Here, z = 1/y from the previous problem.

𝑑3 𝑥
14. 𝑑𝑡 3
=0
Jerk-free motion

𝑑𝑦
15. 𝑥 𝑑𝑥 + 𝑦 = 0
Family of involutions

Reminder: A differential equation is linear if and only if it can be rearranged into the form:

𝑑𝑛 𝑦 𝑑𝑛−1 𝑦 𝑑𝑦
𝑎𝑛 (𝑡) 𝑛
+ 𝑎𝑛−1 (𝑡) 𝑛
+ ⋯ + 𝑎1 (𝑡) + 𝑎0 (𝑡)𝑦(𝑡) = 𝑓(𝑡)
𝑑𝑡 𝑑𝑡 𝑑𝑡

If the forcing function 𝑓(𝑡) = 0, the equation is said to be homogeneous.

Problem 2: Euler's Method: Important for the first quiz!!


Solve the following IVP numerically using Euler's method with a step-size of ℎ = 0.5
𝑑𝑦
= 𝑓(𝑡, 𝑦) = 𝑡 − 𝑦
𝑑𝑡

2a. Initial condition: 𝑦(0) = 1


The exact solution at 2.5
Increment time in steps of ℎ = 0.5 until you reach 𝑡 = 2.5. starting at 𝑦(0) = 1 is
Show your result in tabular form using the format below: 𝑦(2.5) = 1.6642
Are you close??

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = 𝑡 − 𝑦
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
Initial condition 𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 1 –1
1 0.5 0.5 0
2 1 0.5 0.5
3 1.5 0.75 0.75
4 2 1.125 0.875
5 2.5 1.5625 0.9375
Fill in the table!
2
Drexel University, College of Engineering 2017-2018 Academic Year

Here's a graph to help you see how well the approximation has worked. I've taken it out to t = 5 instead.

dy/dt = t - y
5
Exact
4.5 Euler with h=0.5

3.5

2.5
y

1.5

0.5

0
0 1 2 3 4 5
t

Now explore the Excel file named Euler_Problem2 to see how easily Euler's method can be implemented in a
spreadsheet. Try different step sizes. Try adding more rows.
𝑑𝑦
Now let's solve the same DE 𝑑𝑡
= 𝑓(𝑡, 𝑦) = 𝑡 – 𝑦 using a different initial condition.

2b. New Initial condition: 𝑦(0) = −1

Increment time in steps of ℎ = 0.5 until you reach 𝑡 = 2.5.


Show your result in tabular form using the format below:

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = 𝑡 − 𝑦
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
New Initial condition 𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 –1 +1
1 0.5 -0.5 1
2 1 0 1
3 1.5 0.5 1
4 2 1 1
5 2.5 1.5 1
Fill in the table!

3
Drexel University, College of Engineering 2017-2018 Academic Year

Here's a graph (for both parts a and b) to help you see how well the approximation has worked. I've taken it out
to t = 5 instead. In case b, the numerical solution perfectly follows the exact solution which is the line 𝑦 = 𝑡 − 1.

dy/dt = t - y
4

2
y

Exact for y(0)=+1


0 Euler with h=0.5
Exact for y(0)=-1
Euler with h=0.5
Initial Points
-1
0 1 2 3 4 5
t

The exact solution for this DE is: 𝑦(𝑡) = (𝑡 − 1) + 𝑘 ∙ 𝑒 −𝑡 where 𝑘 = 1 + 𝑦(0)

4
Drexel University, College of Engineering 2017-2018 Academic Year

Problem 3: Euler's Method:

Solve the given IVP numerically using Euler's Method using a step-size of ℎ = 0.1

𝑑𝑦
= 𝑓(𝑡, 𝑦) = 1 − 2𝑡 − 2𝑦
𝑑𝑡

3a. Initial condition: 𝑦(0) = 1


Increment time in steps of ℎ = 0.1 until you reach 𝑡 = 1.0
Show your result in tabular form using the format below:

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = 1 − 2𝑡 − 2𝑦
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
Initial condition
𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 1 -1
1 0.1 0.9 -1.000
2 0.2 0.800 -1.000
3 0.3 0.700 -1.000
4 0.4 0.600 -1.000
5 0.5 0.500 -1.000
6 0.6 0.400 -1.000
7 0.7 0.300 -1.000
8 0.8 0.200 -1.000
9 0.9 0.100 -1.000
10 1 0.000 -1.000
Fill in the table!

Hint: The exact solutions for this DE are: 𝑦(𝑡) = (1 − 𝑡) + 𝑘 ∙ 𝑒 −2𝑡 where 𝑘 = 𝑦(0) − 1

a. Here's a graph to help you see how well the approximation has worked. I've taken it all the way to 2.

dy/dt = 1 - 2t - 2y
1
Exact
Euler with h=0.1

0.5

0
y

-0.5

-1
0 0.5 1 1.5 2 5
t
Drexel University, College of Engineering 2017-2018 Academic Year

3b. New Initial condition: 𝑦(0) = −1


Increment time in steps of ℎ = 0.1 until you reach 𝑡 = 1. Show your result in tabular form using the format
below:

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = 1 − 2𝑡 − 2𝑦
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
New Initial condition 𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 -1 3
1 0.1 -0.7 2.200
2 0.2 -0.480 1.560
3 0.3 -0.324 1.048
4 0.4 -0.219 0.638
5 0.5 -0.155 0.311
6 0.6 -0.124 0.049
7 0.7 -0.119 -0.161
8 0.8 -0.136 -0.329
9 0.9 -0.168 -0.463
10 1.0 -0.215 -0.571
Fill in the table!

Now explore the Excel file named Euler_Problem3 to see how easily Euler's method can be implemented in a
spreadsheet. Try different step sizes. Try different initial conditions. Try adding more rows.

dy/dt = 1 - 2t - 2y
1
Exact for y(0)=+1
0.8 Euler with h=0.1
Exact for y(0)=-1
Euler with h=0.1
0.6 Initial Points

0.4

0.2

0
y

-0.2

-0.4

-0.6

-0.8

-1
0 0.5 1 1.5 2
t

6
Drexel University, College of Engineering 2017-2018 Academic Year

Problem 4: Euler's Method See the Excel file Euler_Problem4


Euler's method can give weird answers if the step-size is too large. Consider the DE: 𝑦 ′ = −𝜋 sin(𝜋𝑡)
The exact solutions are cosines: 𝑦 = cos 𝜋𝑡 + 𝑐
To enter π in Excel, type PI()
4a. Initial condition: 𝑦(0) = 1
Increment time in steps of ℎ = 1 until you reach 𝑡 = 6
Show your result in tabular form using the format below:

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = −𝜋 sin(𝜋𝑡)
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
Initial condition
𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 1 0.000
1 2 1.000 0.000
2 3 1.000 0.000
3 4 1.000 0.000
4 5 1.000 0.000
5 6 1.000 0.000
6 7 1.000 0.000
Fill in the table!

4b. New Initial condition: 𝑦(0) = −1 and step-size to ℎ = 1

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = −𝜋 sin(𝜋𝑡)
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
New Initial condition
𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 -1 0.000
1 1 -1.000 0.000
2 2 -1.000 0.000
3 3 -1.000 0.000
4 4 -1.000 0.000
5 5 -1.000 0.000
6 6 -1.000 0.000
Fill in the table!

7
Drexel University, College of Engineering 2017-2018 Academic Year

The following graphs show we have not done too well at all! Both solutions are cosines, but we just found
straight lines! Exact for y(0)=+1
Euler with h=1
Exact for y(0)=-1
Euler with h=1
Initial Points
dy/dt = -pi * sin(pi*t)
1

-1
y

-2

-3
0 2 4 6 8 10
t

4c. Using the Excel file Euler_Problem4,


repeat your calculations for part a using a smaller step size of h = 0.5

n 𝑡𝑛+1 = 𝑡𝑛 + ℎ Euler's Method 𝑑𝑦


= 𝑓(𝑡, 𝑦) = −𝜋 sin(𝜋𝑡)
∆𝑡 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑡
Initial condition
𝑓𝑛 = 𝑓(𝑡𝑛 , 𝑦𝑛 )
0 0 1 0.000
1 0.5 1.000 -3.142
2 1 -0.571 0.000
3 1.5 -0.571 3.142
4 2 1.000 0.000
5 2.5 1.000 -3.142
6 3 -0.571 0.000
7 3.5 -0.571 3.142
8 4 1.000 0.000
9 4.5 1.000 -3.142
10 5 -0.571 0.000
11 5.5 -0.571 3.142
12 6 1.000 0.000
Exact for y(0)=+1
Fill in the table! Euler with h=0.5
Exact for y(0)=-1
Euler with h=0.5
Initial Points
Here's the plot with the smaller step-size of h=0.5 dy/dt = -pi * sin(pi*t)
1

-1
y

-2

-3
0 2 4 6 8 10
t
8
Drexel University, College of Engineering 2017-2018 Academic Year

Problem 5: Euler slips on an infinite slope See the Excel file Euler_Problem5
Euler's method can also give weird answers if the slope field assumes large values, that is the solution curve is
changing fast! Consider the DE:
𝑦 ′ = − 𝑥⁄𝑦
The exact solutions are semicircles with infinite slope where they approach the x-axis. 𝑦 = ±√𝑅 2 − 𝑥 2
These infinite slopes are definitely going to cause problems! Let's see what that looks like.
Initial condition: 𝑦(0) = 1
Increment time in steps of ℎ = 0.1 until you reach 𝑥 = 2. The Excel file will help.
Note the exact solutions stops just before 𝑥 = 1, the last half of your points will be numerical noise.
Show your result in tabular form using the format below. Do a few by hand then finish off using the Excel file.
You'll have to adjust the equation in that file, which instead is for the DE: 𝑦 ′ = 𝑥 − 𝑦
If you click on cell D5, you will see a different equation: Change that to – 𝑥/𝑦
Then be sure to copy your new D5 and paste it to all cells beneath it.
Also adjust the step size down to 0.1
n 𝑥𝑛+1 = 𝑥𝑛 + ℎ Euler's Method 𝑑𝑦
= −𝑥/𝑦
∆𝑥 = ℎ 𝑦𝑛+1 = 𝑦𝑛 + ℎ𝑓𝑛 𝑑𝑥
𝑓𝑛 = 𝑓(𝑥𝑛 , 𝑦𝑛 )
Initial condition
0 0 1 0.000
1 0.1 1.000 -0.100
2 0.2 0.990 -0.202
3 0.3 0.970 -0.309
4 0.4 0.939 -0.426
5 0.5 0.896 -0.558
6 0.6 0.840 -0.714
7 0.7 0.769 -0.910
8 0.8 0.678 -1.180
Singularity at x=1 9 0.9 0.560 -1.607
condition 10 1.0 0.399 -2.504
Infinite Slope
11 1.1 0.149 -7.382
condition
12 1.2 -0.589 2.037
13 1.3 -0.386 3.372
14 1.4 -0.048 28.988
15 1.5 2.850 -0.526
Noise
16 1.6 2.798 -0.572
17 1.7 2.741 -0.620
18 1.8 2.679 -0.672
19 1.9 2.611 -0.728
20 2.0 2.539 -0.788
Fill in the table!
All the points after you crash through the singularity at 𝑥 = 1 are noise, and have nothing to do with the
solution curve which started at the point at (0,1).

9
Drexel University, College of Engineering 2017-2018 Academic Year

dy/dx = -x/y
3
Here's a graph to help understand where and why Euler has slipped Exact
2.5 Euler with h=0.1
up. The blue quarter circle is the exact solution in the forward
2
direction from the starting point (0,1). That solution is 𝑦 = √1 − 𝑥 2
1.5
which has an infinite slope as y approached the x-axis. The solution
1
stops just before 𝑦 = 0 at 𝑥 = 1.
0.5

y
The yellow dots (with red outlines) are the approximate solutions 0

from Euler's method. All that chaos on the RHS is due to numerical -0.5

error which becomes very large for jumps near the x-axis where -1

the slope is infinite. All the points in the red zone 𝑥 > 1 are just -1.5 Noise!
noise and do not correspond to the solution curve through the -2
0 1 2 3 4
starting point (0,1). They should be rejected. x

10
Drexel University, College of Engineering 2017-2018 Academic Year

Problem 6: Direction Fields

𝟏
Given the direction field for 𝒙′ = − 𝒙(𝒙 + 𝟒)(𝒙 − 𝟐) showing x vs. t.
𝟒

𝑡=0
a) How many equilibrium solutions are there for this differential equation? Draw them, then list in the box:

2, 0, -4

b) Estimate the time for the initial condition 𝑥(0) = – 1 to reach –3.

Draw the curve on the direction field and show the time, fill in the values below

t = 0.5

c) Draw the solution curve for 𝑥(0) = 1 on the direction field.

d) Draw at least 10 solution curves and select starting values to cover all solution curve shapes.

11

You might also like