ExRes EDO
ExRes EDO
ExRes EDO
4. Um corpo com massa inicial de 200Kg está em movimento sob a ação de uma
força constante de 2000N . Sabendo-se que esse corpo está perdendo 1Kg de
sua massa por segundo e considerando que a resistência do ar é o dobro de sua
velocidade e que o corpo está em repouso no instante t = 0, então a EDO que
descreve a variação de sua velocidade é dada por
2000 − 2v(t)
v 0 (t) = ∀t > 0
200 − t
v(0) = 0
Exercício 1:
dy
= −2y = f ( x , y )
y ′( x ) + 2y ( x ) = 0 ⇒ y ′( x ) = −2y ( x ) ⇒ dx
y ( 0 ) = y = 1
0
y n +1 = y n + hf ( x n , y n ) , n ≥0
Então:
(1)
x 0 = 0 , y 0 = 1 , f(x 0 , y 0 ) = −2y 0 = −2(1) = −2
⇒ y1 = y0 + hf(x 0 , y 0 ) ⇒ y1 = 1 + 0.2( −2) = 1 − 0.4 = 0.6
(2)
x 1 = 0.2 , y1 = 0.6 , f(x 1 , y1 ) = −2y1 = −2(0.6) = −1.2
⇒ y 2 = y1 + hf(x 1 , y1 ) ⇒ y 2 = 0.6 + 0.2( −1.2) = 0.6 - 0.24 = 0.36
(3)
x 2 = 0.4 , y 2 = 0.36, f(x 2 , y 2 ) = −2y 2 = −2(0.36) = −0.72
⇒ y 3 = y 2 + hf(x 2 , y 2 ) ⇒ y 3 = 0.36 + 0.2(-0.72) = 0.36 - 0.144 = 0.216
(4)
x 3 = 0.6 , y 3 = 0.216 , f(x 3 , y 3 ) = −2y 3 = −2(0.216) = −0.432
⇒ y 4 = y 3 + hf(x 3 , y 3 ) ⇒ y 4 = 0.216 + 0.2(-0.432) = 0.1296
(5)
x 4 = 0.8 , y 4 = 0.1296 , f(x 4 , y 4 ) = −2y 4 = −2(0.1296) = −0.2592
⇒ y 5 = y 4 + hf(x 4 , y 4 ) ⇒ y 5 = 0.1296 + 0.2(-0.259 2) = 0.07776
k1 = f ( x n , y n )
u n +1 = y n + hk1 (Preditor)
k 2 = f ( x n +1 , u n +1 )
h
y n +1 = y n + ( k1 + k 2 )
2
Assim, temos:
(1)
x 0 = 0 , y0 = 1
⇒ k1 = f(x 0 , y 0 ) = −2y 0 = −2
u1 = y 0 + hk1 = 1 + 0.2( −2) = 0.6 (Preditor)
k 2 = f(x 1 , u1 ) = −2u1 = −1.2
h
y1 = y 0 + (k1 + k 2 ) = 1 + 0.1( −2 − 1.2) = 1 − 0.32 = 0.68 (Corretor)
2
(2)
x 1 = 0.2 , y1 = 0.68
⇒ k1 = f(x 1 , y1 ) = −2y1 = −1.36
u 2 = y1 + hk1 = 0.68 + 0.2( −1.36) = 0.408 (Preditor)
k 2 = f(x 2 , u 2 ) = −2u 2 = −0.816
h
y 2 = y1 + (k1 + k 2 ) = 0.68 + 0.1(-1.36 - 0.816) = 0.4624 (Corretor)
2
(3)
x 2 = 0.4 , y 2 = 0.4624
⇒ k1 = f(x 2 , y 2 ) = −2y 2 = −0.9248
u 3 = y 2 + hk1 = 0.4624 + 0.2( −0.9248) = 0.27744 (Preditor)
k 2 = f(x 3 , u 3 ) = −2u 3 = −0.55488
h
y3 = y2 + (k1 + k 2 ) = 0.4624 + 0.1( −0.9248 - 0.55488) = 0.314432 (Corretor)
2
(4)
x 3 = 0.6 , y 3 = 0.314432
⇒ k1 = f(x 3 , y 3 ) = −2y 3 = -0.628864
u 4 = y 3 + hk1 = 0.314432 + 0.2(-0.628864) = 0.1886592 (Preditor)
k 2 = f(x 4 , u 4 ) = −2u 4 = −2(0.188659 2) = -0.3773184
h
y4 = y3 + (k1 + k 2 ) = 0.314432 + 0.1( −0.628864 - 0.3773184) = 0.21381376 (Corretor)
2
(5)
x 4 = 0.8 , y 4 = 0.21381376
⇒ k1 = f(x 4 , y 4 ) = −2y 4 = −0.42762752
u 5 = y 4 + hk1 = 0.21381376 + 0.2( −0.42762752 ) = 0.12828825 6 (Preditor)
k 2 = f(x 5 , u 5 ) = −2u 5 = −0.25657651 2
h
y5 = y4 + (k1 + k 2 ) = 0.21381376 + 0.1(-0.684204032) = 0.14539335 6 (Corretor)
2
(6)
x 5 = 1.0 , y 5 = 0.14539335 6 (Euler Aperfeiçoado)
(c) Método de Runge-Kutta (ou Runge-Kutta de 4a Ordem):
Suponha que queremos calcular as aproximações y1, y2, ... , yn para os valores
verdadeiros y(x1), y(x2), ... , y(xn) e agora queremos calcular yn+1 ≈ y(xn+1).
Então,
x n +1 x n +h
y ( x n +1 ) − y ( x n ) = ∫
xn
y ′( x ) dx = ∫ y ′( x )dx
xn
h h h h h
y(x n +1 ) − y(x n ) ≈ y ′(x n ) + 4y ′ x n + + y ′(x n +1 ) = y ′(x n ) + 2y ′ x n + + 2y ′ x n + + y ′(x n +1 )
6 2 6 2 2
h
Repare que separamos em soma de termos o termo 4y ′ x n + porque serão inclinações diferentes para
2
o método.
k1 = f(x n , y n )
h h
k 2 = f x n + , y n + k1
2 2
h h
k3 = f x n + , y n + k 2
2 2
k 4 = f(x n +1 , y n + hk 3 )
h
y n +1 = y n + (k1 + 2 k 2 + 2 k 3 + k 4 )
6
(1)
x 0 = 0 , y0 = 1
⇒ k1 = f(x 0 , y 0 ) = −2y 0 = −2
h h
k 2 = f x 0 + , y 0 + k1 = f(0.1, 0.8) = -2(0.8) = -1.6
2 2
h h
k 3 = f x 0 + , y 0 + k 2 = f(0.1, 0.84) = -2(0.84) = -1.68
2 2
k 4 = f(x 1 , y 0 + hk 3 ) = f(0.2, 0.664) = -2(0.664) = -1.328
h 0.2
y 1 = y0 + (k1 + 2k 2 + 2k 3 + k 4 ) = 1 + ( −2 − 3.2 − 3.36 − 1.328) = 0.6704
6 6
(2)
x 1 = 0.2 , y1 = 0.6704
⇒ k1 = f(x 1 , y1 ) = −2y1 = −2(0.6704) = -1.3408
h h
k 2 = f x1 + , y1 + k1 = −2y1 − 0.2k1 = −1.07264
2 2
h h
k 3 = f x 1 + , y1 + k 2 = -2y1 − 0.2k 2 = −1.126272
2 2
k 4 = f(x 2 , y1 + hk 3 ) = f(0.4, 0.4451456) = -2(0.4451456) = -0.8902912
h
y 2 = y1 + (k1 + 2k 2 + 2k 3 + k 4 ) = 0.44943616
6
(3)
x 2 = 0.4 , y 2 = 0.44943616
⇒ k1 = f(x 2 , y 2 ) = −2y 2 = −2(0.449436 16) = -0.8988723 2
h h
k 2 = f x 2 + , y 2 + k1 = −0.71909785 6
2 2
h h
k 3 = f x 2 + , y 2 + k 2 = −0.75505274 8
2 2
k 4 = f(x 3 , y 2 + hk 3 ) = -0.59685122
h
y 3 = y2 + (k1 + 2k 2 + 2k 3 + k 4 ) = 0.30130200 1
6
(4)
x 3 = 0.6 , y 3 = 0.30130200 1
⇒ k1 = f(x 3 , y 3 ) = −2y 3 = −2(0.301302 001) = -0.602604002
h h
k 2 = f x 3 + , y 3 + k1 = −0.48208320 1
2 2
h h
k 3 = f x 3 + , y 3 + k 2 = −0.69902064 2
2 2
k 4 = f(x 4 , y 3 + hk 3 ) = -0.322995745
h
y 4 = y3 + (k1 + 2k 2 + 2k 3 + k 4 ) = 0.19170841 9
6
(5)
x 4 = 0.8 , y 4 = 0.19170841 9
⇒ k1 = f(x 4 , y 4 ) = −2y 4 = −2(0.191708 419) = -0.383416839
h h
k 2 = f x 4 + , y 4 + k1 = −0.30673347 1
2 2
h h
k 3 = f x 4 + , y 4 + k 2 = −0.32207014 4
2 2
k 4 = f(x 5 , y 4 + hk 3 ) = -0.254588781
h
y 5 = y4 + (k1 + 2k 2 + 2k 3 + k 4 ) = 0.12852132 4
6
h
u n +1 = y n + (55f n − 59f n −1 + 37f n −2 − 9f n −3 ) , usando a notação f n = f(x n , y n )
24
h
y n +1 = y n + ( 9 f n* +1 + 19 f n − 5 f n −1 + f n −2 ) , onde f n* +1 = f ( x n +1 , u n +1 )
24
h 0.2
u4 = y 3 + (55f 3 − 59f 2 + 37f 1 − 9f 0 ) = 0.30130200 1 + (-11.71935323) = 0.20364072 4
24 24
Assim, temos:
0.2 0.2
y4 = y3 + (9f 4* + 19f 3 − 5f 2 + f 1 ) = 0.301302001 + ( −11.9614474 7) = 0.201623272
24 24
(2)
Preditor:
h 0.2
u5 = y4 + (55f 4* − 59f 3 + 37f 2 − 9f1 ) = 0.201623272 + (-8.037919362) = 0.13464061
24 24
Corretor:
0.2
y5 = y4 + (9f 5* + 19f 4* − 5f 3 + f 2 ) , onde f 5* = f(x 5 , u 5 ) = −2u 5 = −0.269281221
24
0.2
y 5 = 0.201623272 + ( −8.04773081 1) = 0.134558848
24
Exercício 2:
2 2 dy 2
xy ′(x) − x 2 y(x) − 2 = 0 ⇒
{ y ′(x) − xy(x) − = 0 ⇒ y ′(x) = xy(x) + ⇒ = xy + = f(x, y)
÷x x x dx x
dy 2
= f(x, y) = xy +
dx x
y 0 = 3, x 0 = 1, h = 0.1
até x5 = 1.5.
Exercício 3:
y ′ = f(x, y, z) = z , y 0 = 0
1
z ′ = g(x, y, z) = -y , z 0 = π
y n +1 = y n + hf ( x n , y n , z n ) = y n + hz n
z n +1 = z n + hg ( x n , y n , z n ) = z n − hy n
Assim, temos:
(1)
1
y 0 = 0, z 0 = , x0 = 0
π
1
⇒ y1 = y 0 + 0.2z 0 = 0 + 0.2 = 0.06366197 7
π
1
z 1 = z 0 - 0.2y 0 = = 0.31830988 6
π
(2)
(3)
(4)
(5)
y(1.0) ≈ 0.29294695 2
(Euler)
y ′(1,0) ≈ 0.19353240 9
y ′ = f(x, y, z) = z , y 0 = 0
1
z ′ = g(x, y, z) = -y , z 0 = π
Preditores:
u n +1 = y n + hf ( x n , y n , z n ) = y n + hz n
v n +1 = z n + hg ( x n , y n , z n ) = z n − hy n
Corretores:
h h
y n +1 = y n + 2 [ f(x n , y n , z n ) + f(x n +1 , u n +1 , v n +1 ) ] = y n + 2 [z n + v n +1 ]
z h h
= z n + [g(x n , y n , z n ) + g(x n +1 , u n +1 ,v n +1 ) ] = z n − [y n + u n +1 ]
n +1 2 2
(1)
1
y0 = 0 , z 0 = , h = 0.2
π
u 1 = y0 + hz 0 = 0.06366197 7
v 1 = z 0 − hy 0 = 0.31830988 6
h
y1 = y 0 + [z 0 + v1 ] = 0.06366197 7
2
h
z 1 = z 0 − [y 0 + u1 ] = 0.31194368 8
2
dv 2000 − 2v
= = f(v, t)
dt 200 − t
v 0 = 0 , t 0 = 0 , h = 0.5
Exercício 5:
dy
= 0.2y − 0.000002y 2
dt
y 0 = 1000, t 0 = 0
Exercício 6:
h
x n +1 = x n + (F1 + 2F2 + 2F3 + F4 )
6
h
y n +1 = y n + (G1 + 2G 2 + 2G 3 + G 4 )
6
onde:
F1 = f ( t n , x n , y n )
h h h
F2 = f t n + , x n + F1 , y n + G 1
2 2 2
h h h
F3 = f t n + , x n + F2 , y n + G 2
2 2 2
F 4 = f (t n + h , x n + hF 3 , y n + hG 3 )
Analogamente fazemos isso para G1 , G 2 , G 3 , G 4 .
(1)
t 0 = 0 , x 0 = 1000, y 0 = 500
F1 = f(0,1000,5 00) = 3(1000) − 0.002(1000 )(500) = 3000 − 1000 = 2000
G1 = g(0,1000,500) = 0.0006(100 0)(500) − 0.5(500) = 300 − 250 = 150
F2 = f(0.25,150 0,537.5) = 3(1500) − 0.002(1500 )(537.5) = 4500 − 1612.5 = 2887.5
G 2 = g(0.25,150 0,537.5) = 0.0006(150 0)(537.5) − 0.5(537.5) = 483.75 − 268.75 = 215
F3 = f(0.25,172 1.875,553.75) = 3(1721.875 ) − 0.002(1721 .875)(553.75) = 5165.625 − 1906.9765 =
= 3258.6485
G 3 = g(0.25,172 1.875,553.75) = 0.0006(1721.875)(553 .75) − 0.5(553.75) = 512.09296 − 276.875 =
= 235.21796
F4 = f(0.5,2629 .3242,617.6398) = 3(2629.324 2) − 0.002(2629.3242)(617 .6398) = 7887.9726 − 3247.9505 =
= 4640.0221
G 4 = g(0.5,2629 .3242,617.6398) = 0.0006(2629.3242)(61 7.6398) − 0.5(617.63 98) = 974.38515 − 308.8199 =
= 665.56525
Então,
h 1
x1 = x 0 + (F1 + 2F2 + 2F3 + F4 ) = 1000 + (2000 + 5775 + 6517.297 + 4640.0221) = 4155.3865
6 6
h 1
y1 = y 0 + (G1 + 2G 2 +2G 3 + G 4 ) = 500 + (150 + 430 + 470.43592 + 665.56525) = 786.00018
6 6
Façam até t8 = 4.