DE Write1
DE Write1
工程數學--微分方程
Differential Equations (DE)
授課者:丁建均
教學網頁:http://djj.ee.ntu.edu.tw/DE.htm
(請上課前來這個網站將講義印好)
歡迎大家來修課!
2
課程資訊
教學網頁:http://djj.ee.ntu.edu.tw/DE.htm
個人網頁:http://disp.ee.ntu.edu.tw/
共同教學網頁: http://cc.ee.ntu.edu.tw/~tomme/DE/DE.html
大助教: 洪聲仰
大助教聯絡方式: shengyang@ntu.edu.tw
4
注意事項:
(1) 本課程採行雙軌制,同學們可以來現場上課,或是可觀看
NTUCool 的影片
(2)請上課前,來這個網頁,將上課資料印好。
http://djj.ee.ntu.edu.tw/DE.htm
(3) 請各位同學踴躍出席 。
(4) 作業不可以抄襲。作業若寫錯但有用心寫仍可以有
40%~90% 的分數,但抄襲或借人抄襲不給分。
(5) 每次作業有11題
上課日期 5
Week Number Date (Wednesday) Remark
1. 9/4
2. 9/11
3. 9/18
4. 9/25: HW1
5. 10/2
6. 10/9
7. 10/16: HW2
8. 10/23: Midterms 範圍: (Sections 2-2 ~ 4-5)
9. 10/30
10. 11/6
11. 11/13
12. 11/20: HW3
13. 11/27
14. 12/4
15. 12/11: HW4
16. 12/18: Finals 範圍: (Sections 4-6 ~ 12-4)
課程大綱 6
Introduction (Chap. 1)
解法 (Chap. 2)
First Order DE 應用 (Chap. 3)
矩陣解 (Chap. 8,範圍外)
解法 (Chap. 4)
Higher Order DE 應用 (Chap. 5,範圍外)
非線性 (Sections 4-10, 5-3, 工數特論)
多項式解法 (Chap. 6)
解法 (Sections 12-1, 12-4)
Partial DE
直角座標 (Chapter 12,工數特論)
圓座標 (Chapter 13,工數特論)
(2)
dy ( x) x: independent variable 自變數
1
dx y(x): dependent variable 應變數
x d 3 f ( x)
0 sin(t ) f ( x t )dt dx3 cos x
9
• notations of differentiation
df d2 f d3 f d4 f
dx , dx 2 , dx 3 , dx 4 , ………. Leibniz notation
f , f , f , f ( 4) , ………. prime notation
f ,
f ,
f ,
f , ………. dot notation
fx , f xx , f xxx , f xxxx , ………. subscript notation
10
(3) Ordinary Differential Equation (ODE):
differentiation with respect to one independent variable
d 3u d 2u du dx dy dz
3
2 cos(6 x )u 0 2 xy z
dx dx dx dt dt dt
dx 2 dx
12
(6) Linear Differentiation Equation:
dny d n1 y dy
an x n an1 x n1 a1 x a0 x y g x
dx dx dx
dy d n1 y d n y
(i) For y, only the terms y, dx , , n1 , n appear.
dx dx
(ii) All of the coefficient terms am(x) m = 1, 2, …, n are independent of y.
Property of linear differentiation equations:
d n y1 d n1 y1 dy1
If an x n an1 x n1 a1 x a0 x y1 g1 x
dx dx dx
d n y2 d n1 y2 dy
an x n an1 x n1 a1 x 2 a0 x y2 g 2 x
dx dx dx
and y3 = by1 + cy2, then
d n y3 d n1 y3 dy
an x n an1 x n1 a1 x 3 a0 x y3 bg1 x cg 2 x
dx dx dx
(if y(x) is treated as the input and g(x) is the output)
13
(7) Non-Linear Differentiation Equation
d 2 y dy
( y 3) 2 2 y x
dx dx
d 2 y dy
y 2
e x
dx 2 dx
d 2 y dy
e y
e x
dx 2 dx
[Example 1.1.2] Linear and Nonlinear ODEs
(a) The equations
d3y dy
( y x ) dx 4 xd y 0, y " 2 y y 0, x 3
x 3
5 y ex
dx dx
dy 2
Example: x ,
dx
y c x2 / 2
or (explicit solution)
y c x2 / 2
16
The initial value (未必在 x = 0) is helpful for obtain the unique solution.
dy
1 and y(0) = 2 y = x+2
dx
dy
1 and y(2) =3.5 y = x+1.5
dx
17
For the kth order differential equation, the initial conditions can be 0th ~
(k–1)th derivatives at some points.
18
1.3 Differential Equations as Mathematical
Model
Physical meaning of differentiation:
the variation at certain time or certain place
dx t dv t d 2 x t
[Example 1]: v t , a t
dt dt dt 2
F v ma dx(t ) d 2 x(t )
F m
dt dt 2
dA t A: population
kA t
dt 人口增加量和人口呈正比
20
[Example 3]: 開水溫度隨著時間會變冷的模型
dT T: 熱開水溫度,
k (T Tm )
dt
Tm: 環境溫度
t: 時間
21
大一微積分所學的:
例如: 1 dt ln t c
f t dt 的解
t
dA t
f t A t f t dt c
dt
dA t 1
Example: A t ln t c
dt t
dA t 1 1
2 At 2 dt c ?
dt t 4 t 4
Problems
(1) 若等號兩邊都出現 dependent variable (如 pages 19, 20 的例子)
該如何解?
22
Review
• dependent variable and independent variable
• DE
• PDE and ODE
• Order of DE
• linear DE and nonlinear DE
• explicit solution and implicit solution
• initial value; boundary value
• IVP
23
dy
slopes and the field directions: f x, y
dx
y-axis
the slope is f(x0, y0)
(x0, y0)
x-axis
24
Example 1 dy/dx = 0.2xy
if y(0) = 2
if y(0) = -1
From: Fig. 2-1-3(a) in “Differential Equations-with Boundary-Value
Problem”, 9th ed., Dennis G. Zill and Michael R. Cullen.
25
Example 2 dy/dx = sin(y), y(0) = –3/2
Disadvantage:
It can only be used for the case of the 1st order DE.
It requires a lot of time
27
Section 2-6 A Numerical Method
sampling(取樣)
• independent variable x x0, x1, x2, …………
dy ( x)
• Find the solution of f x, y
dx
Since dy x f x, y approximation y xn1 y xn
f xn , y ( xn )
dx xn1 xn
y xn1 y xn f xn , y ( xn ) xn1 xn
前一點的值 取樣間格
dy x 28
f x, y y xn1 y xn f xn , y ( xn ) xn1 xn
dx
If 𝑦 𝑥 is known
y x1 y x0 f x0 , y ( x0 ) x1 x0
y x2 y x1 f x1 , y ( x1 ) x2 x1
y x3 y x2 f x2 , y ( x2 ) x3 x2
:
:
:
:
dy x 29
f x, y y xn1 y xn f xn , y ( xn ) xn1 xn
dx
Example:
0 0
-0.5 -0.5
-1 -1
-1.5 -1.5
0 5 10 0 5 10
(c) (d)
1 1
0.5 0.5
0 0
-0.5 -0.5
-1 -1
-1.5 -1.5
0 5 10 0 5 10
31
Advantages
-- It can solve some 1st order DEs that cannot be solved by mathematics.
-- can be used for solving a complicated DE (not constrained for the 1st
order case)
-- suitable for computer simulation
Disadvantages
-- numerical error (數值方法的課程對此有詳細探討)
附錄一 Table of Integration 32
1/x ln|x| + c
cos(x) sin(x) + c
sin(x) –cos(x) + c
tan(x) –ln|cos(x)| + c
cot(x) ln|sin(x)| + c
ax ax/ln(a) + c
1 1 1 x
x2 a2 tan c
a a
1/ a x2 2 sin 1 ( x / a ) c
1 / a x 2 2 cos 1 ( x / a ) c
e ax 1
x eax x c
a a
e ax 2 2 x 2
x2 eax x 2 c
a a a
33
graphic method
direct integral
numerical method
separable variable
analytic methods
method for linear equation
method for exact equation
homogeneous equation method
Bernoulli’s equation method
series solution method for Ax + By + c
matrix solution
Laplace transform
transform methods Fourier series
Fourier transform
35
Direct Integral
dy(x)/dx = f(x)
y x f ( x) dx
F ( x) c where dF ( x) f ( x)
dx
36
Something about Calculating the Integral
x
(1) Integration 的定義: x f (t ) dt
0
x
例:x cos(t ) dt sin x c
0
d g x f x
then dx
x
1 g ax c
x0 f ( at ) dt
a 1
f(x, y) = g(x)h(y)
dy
cos( x)e x 2 y
dx
dy
x y
dx
2-2-2 解法 39
dy
If g ( x ) h( y ) , then
dx
dy
Step 1 h( y ) g ( x)dx 分離變數
P( y ) c1 G ( x) c2 dP( y ) dG ( x)
where p( y ) g ( x)
dy dx
P( y ) G ( x) c
Extra Step: (a) Initial conditions
(b) Check the singular solution (i.e., the constant solution)
40
Extra Step (b) Check the singular solution (常數解):
0 g ( x ) h( r )
h( r ) 0
solution for r
y c(1 x) c ec1
42
Example 練習小技巧
遮住解答和筆記,自行重新算一次
(任何和解題有關的提示皆遮住)
Step 2 y 2
/ 2 x 2
/2c
Extra Step (a)
4.5 8 c, c 12.5
x 2 y 2 25 (implicit solution)
y 25 x 2 invalid
y 25 x 2 valid
(explicit solution)
[Example 3] (with singular solution, text page 49) 44
dy
y2 4 Extra Step (b)
dx
check the singular solution
dy dy
Step 1 dx y2 4
y 4
2
dx
set y = r ,
1 dy 1 dy
dx
4 y2 4 y2 0 = r2 – 4
Step 2
r = 2,
1 1
ln y 2 ln y 2 x c1
4 4 y = 2
y2
ln 4 x 4c1
y2
y2 1 ce 4 x
e 4 x 4 c1 ce 4 x y2 or y = 2
y2 1 ce 4 x
c e 4c1
[Example 4] (text page 50) 45
dy
e2 y y cos x dx
e y sin 2 x y 0 0
Extra Step (b)
Step 1 e y
ye y dy sin 2 x dx 2sin xdx
cos x
set y = r
y
no solution for r
Step 2 e ( y 1)e
y
2cos x c
Note: d (ay b)e y ye y
Extra Step (a) dy
from y 0 0 ( ay a b)e y ye y
a b 1
2 2 c
Step 2
y 1 x4
Solution: 16 or y 0
47
補充:其實, 這一題還有更多的解
dy
xy1/2 , y(0) = 0
dx
證明可參考
J. Ratzkin, Existence and Uniqueness of Solutions to First Order
Ordinary Differential Equations, 2007.
The Existence and Uniqueness Theorem for First-Order Differential
Equations, www.math.uiuc.edu/~tyson/existence.pdf
49
2-2-5 Solutions Defined by Integral
(1) d x
g t dt g x
dx x0
(2) If
dy/dx = g(x) and y(x0) = y0
then
x
y x y0 g t dt
x0
dy
e x2
y 3 5
dx
x
Solution y x 5 3 e dt
t 2
y x 5 erfc 3 erfc x
2
51
用 t 取代 x 以做區別
(1) 複習並背熟幾個重要公式的積分
(2) 別忘了加 c
並且熟悉什麼情況下 c 可以合併和簡化
(3) 若時間允許,可以算一算 singular solution
(4) 多練習,加快運算速度
附錄三 微分方程查詢 53
http://integrals.wolfram.com/index.jsp
輸入數學式,就可以查到積分的結果
範例:
(a) 先到integrals.wolfram.com/index.jsp 這個網站
(b) 在右方的空格中輸入數學式,例如
數學式
(c) 接著按 “Compute Online with Mathematica” 54
就可以算出積分的結果
結果
(d) 有時,對於一些較複雜的數學式,下方還有連結,點進去就可55
以看到相關的解說
連結
其他有用的網站 56
http://mathworld.wolfram.com/
對微分方程的定理和名詞作介紹的百科網站
http://www.sosmath.com/tables/tables.html
眾多數學式的 mathematical table (不限於微分方程)
http://www.seminaire-sherbrooke.qc.ca/math/Pierre/Tables.pdf
眾多數學式的 mathematical table,包括 convolution, Fourier
transform, Laplace transform, Z transform
2
1 dx
integrate(1/(x**2), (x, 1,2)) # Find 1 x2
58
2-3 Linear Equations
“friendly” form of DEs
2-3-1 方法的適用條件
g(x) = 0: homogeneous
g(x) 0: nonhomogeneous
59
dy
Standard form: P x y f x
dx
dy dy a0 x g x
a1 x a0 x y g x y
dx dx a1 x a1 x
子問題 1 子問題 2
dyc dy p ( x)
P x yc 0 P x y p ( x) f x
dx dx
Find the general solution yc(x) Find any solution yp(x)
(homogeneous solution) (particular solution)
Solution of the DE
y x yc x y p ( x )
61
yc + yp is a solution of the linear first order DE, since
d ( yc y p )
P x ( yc y p )
dx
dyc dy p
P x yc P x yp
dx dx
0 f x f x
All solutions of the linear first order DE should have the form yc + yp .
Its proof is as follows. If y is a solution of the DE, then
dy dy
P x y p P x yp f x f x 0
dx dx
d ( y yp )
P x( y yp ) 0
dx
dyc
Thus, y − yp should be the solution of P x yc 0
dx
y should have the form of y = yc + yp
62
Solving the homogeneous solution yc(x) (子問題一)
dyc
P x yc 0
dx
separable variable
dyc
P x dx
yc
ln yc P x dx c1
yc ce
P ( x ) dx
y1 e
P ( x ) dx
Set , then yc cy1
63
Solving the particular solution yp(x) (子問題二)
dy p ( x)
P x y p ( x) f x
dx
du ( x) dy ( x)
y1 ( x) u ( x) 1 P x y1 ( x) f x
dx dx
equal to zero
du ( x)
y1 ( x) f x
dx
ignore ‘+c’
du ( x) f x f x f x
u ( x) dx y p ( x) y1 ( x) dx
dx y1 ( x) y1 ( x) y1 ( x)
64
yp x e P ( x ) dx f ( x)]dx
P ( x ) dx
yc ce
P ( x ) dx
[ e
y x c e e P ( x ) dx f ( x)]dx
P ( x ) dx P ( x ) dx
[ e
e P ( x ) dx : integrating factor
e P ( x ) dx
y x c [e P ( x ) dx
f ( x)]dx
d P ( x ) dx P ( x ) dx
e y e f x
dx
2-3-3 解法 65
(Step 3a) The standard form of the linear 1st order DE can be rewritten as:
d P ( x ) dx P ( x ) dx
e y e f x
dx
remember it
(Step 3b) Integrate both sides of the above equation
e y e f x dx c,
P ( x ) dx P ( x ) dx
ye
P ( x ) dx P ( x ) dx
f x dx ce
P ( x ) dx
e
or remember it, skip Step 3a
(Extra Step) (a) Initial value
(c) Check the Singular Point
66
dy dy
a1 x a0 x y g x P x y f x
dx dx
Exercise 33
dy
( x 1) y ln x
dx
68
2-3-4 例子
[Example 2] (text page 57)
dy
3y 6
dx
e
P ( x ) dx
Step 2 e 4ln x x
4
d 4
Step 3 x y xe x
dx
Step 4 x 4 y ( x 1)e x c
y ( x 5 x 4 )e x cx 4
x 的範圍: (0, )
[Example 4] (text page 58) 70
dy
x 2
9 dx xy 0
Extra Step (c)
check the singular point
dy x
2 y0
dx x 9
x
P x 2
x 9
x 1
dx ln x 2 9
e x 2 9
e 2
| x2 9 |
d
dx
| x2 9 | y 0
| x2 9 | y c
c defined for x (–, –3), (–3, 3), or (3, )
y
| x2 9 | not includes the points of x = –3, 3
[Example 6] (text, page 59) 71
dy 1, 0 x 1
y f x y 0 0 f x
dx 0, x 1
e P ( x ) dx
ex
d x check the singular point
(e y ) e x f x
dx
0x1 x>1
d x d x
(e y ) e x (e y ) 0
dx dx
e x y e x c1 e x y c2
y 1 c1e x y c2e x
要求 y(x) 在 x = 1 的地方
from initial condition 為 continuous
y 1 e x y (e 1)e x
72
2-3-5 名詞和定義
(1) transient term, stable term
x
Example 5 (text page 59) 的解為 y x 1 5e
5e x : transient term 當 x 很大時會消失
x 1: stable term
10
2
y
0
x1
-2
0 2 4 6 8 10
x-axis
73
(2) piecewise continuous
A function g(x) is piecewise continuous in the region of [x1, x2] if
g(x) exists for any x [x1, x2].
(6) dy P x y f x
dx
dy 1
Example: (not linear, not separable)
dx x y 2
dx
x y2 (linear)
dy
x y 2 2 y 2 ce y (implicit solution)
76
2-3-7 本節要注意的地方
(3) 記熟公式
d P ( x ) dx P ( x ) dx
e y e f x
dx
或
ye
P ( x ) dx P ( x ) dx
f x dx ce
P ( x ) dx
e
(4) 計算時, e P ( x ) dx 的常數項可以忽略
77
太多公式和算法,怎麼辦?
翻譯 A(0) = P0
The other initial condition: At t = 1 h, the number of bacteria is
measured to be 3P0/2.
翻譯 A(1) = 3P0/2
關鍵句: If the rate of growth is proportional to the number of
bacteria A(t) presented at time t,
dA
翻譯 kA k is a constant
dt
Question: determine the time necessary for the number of bacteria to
triple
翻譯 find t such that A(t) = 3P0
這裡將課本的 P(t) 改成 A(t)
dA
kA
81
A(0) = P0, A(1) = 3P0/2 可以用 什麼方法解?
dt
Extra Step (b)
dA check singular solution
Step 1 kdt
A
Step 2 ln A kt c1
A e kt c1
A ce kt c ec1
Extra (1) P0 c 1 c = P0
Step (a)
(2) 3P0 / 2 ce k k = ln(3/2) = 0.4055
A P0 e0.4055t
針對這一題的問題
3P0 P0e0.4055t t ln(3) / 0.4055 2.71h
82
question: Suppose that the room temperature is 21 C. How long will it take
for the cake to cool off to 22 C? (註:這裡將課本的問題做一些修改)
另外,根據題意,了解這是一個物體溫度和周圍環境的溫度交互作用的
問題,所以 T(t) 所對應的 DE 可以寫成
dT k T 21 k is a constant
dt
84
dT k T 21 Constraints: T(0) = 149 T(3) = 85
dt
課本用 separable variable 的方法解
如何用 linear 的方法來解?
85
[Example 5] (an example for mixture, text page 88)
Concentration:
0.25 kg/L
1000 L (liters)
10 L/min 10 L/min
dA
(input rate of salt) (output rate of salt)
dt
10
10 0.25 A
1000
86
87
LR series circuit
RC series circuit
q
Ri E t q: 電荷
C
q dq
R E t
C dt
89
q dq d 2q
R L 2 E t
C dt dt
90
[Example 7] (text page 90) LR series circuit
E(t): 12 volt, inductance: 1/2 henry,
resistance: 10 ohms, initial current: 0
1 di di
e
P ( t ) dt
10i 12 20i 24 P (t ) 20 e 20t c1
2 dt dt
這裡 + c1 可省略
6 6 d 20t
i (t ) ce 20t e i e 20t c
20 t
e i 24e 20t
5 5 dt
i (0) 0
6
0 c
5
6 6
i (t ) e 20t
5 5
91
Circuit problem for t is small and t
dP separable
dt variable
P (a bP )
1/ a b / a
dP dt
P a bP
b dP ( a bP )
d
1 1
ln P ln a bP t c 註: dP dP ln a bP c0
a a a bP a bP
P
ln at ac
a bP (with initial condition P(0) = P0)
P ac1 aP0
c1e at P t P t
a bP bc1 e at bP0 (a bP0 )e at
c1 e ac logistic function
[Example 1] (text page 99) There are 1000 students. 95
dx t
kx 1000 x Constraints: x(0) = 1, x(4) = 50
dt
find x(6)
可以用separable variable 的方法
(The solution is on the next page)
dx t 97
kx 1000 x (c2 e1000 kt 1) x c21000e1000 kt
dt
1000 (c c21 )
dx t x
kdt 1 ce 1000 kt
x 1000 x
x 0 1
1000
1 dx dx 1
kdt 1 c
1000 x 1000 x
c 999
dx dx
1000kdt
x x 1000 x
1000 x 4 50
1 999e 1000 kt
ln x ln x 1000 1000kt c1
1000
50
1 999e 4000 k
x
e1000 kt c1
x 1000 1000k 0.9906
x 1000
c2 e1000 kt (c e c1 ) x x 6 276
x 1000 2
1 999e 0.9906t
98
Logistic equation 的變形
dP
(1) P(a bP ) h 人口有遷移的情形
dt
飽合人口
人口增加量,和 ln
P
呈正比
99
3-2-2 化學反應的速度
A+B C