Escolar Documentos
Profissional Documentos
Cultura Documentos
y(x)
y ( x)
y ( x i +1 )
yi
y i +1
y i +1 / 2
xi
x i +1 / 2
x i +1 / 2 = x i +
x i +1
h
2
Com os valores x i +1 / 2 e
h
2
intrvalo:
y i' +1 / 2 = f ( x i +1 / 2 , y i +1 / 2 )
h
2
y j +1 / 2 = y j + f ( x j , y j )
h
2
y j +1 = y j + f ( x j +1 / 2 , y j +1 / 2 ) h = y j + y 'j +1 / 2 h
x j +1 = x j + h
res = y j y ( x j )
j
0
1
2
3
4
5
6
7
8
9
10
xj
0
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
1,0
Exato
Euler
Erro
Euler Mod.
Erro
y( x j )
yj
y j y( x j )
yj
y j y( x j )
2,0000000
2,0048370
2,0187310
2,0408180
2,0703200
2,1065310
2,1488120
2,1965850
2,2493290
2,3065700
2,3678790
2,0000000
2,0000000
2,0100000
2,0290000
2,0561000
2,0904900
2,1314410
2,1782969
2,2304672
2,2874205
2,3486784
0,000000
-0,004837
-0,008731
-0,011818
-0,014220
-0,016041
-0,-17371
-0,018288
-0,018862
-0,019149
-0,019201
2,0000000
2,0050000
2,0190250
2,0412176
2,0708019
2,1070757
2,1494035
2,1972102
2,2499752
2,3072276
2,3685409
0,0000000
0,0001629
0,0002940
0,0003996
0,0004819
0,0005447
0,0005915
0,0006252
0,0006425
0,0006576
0,0006619
y ' i +1 = f ( x i +1 , y i0+1 )
f ( x i +1 , y i0+1 )
Tangente no Incio do Intervalo
f ( xi , y i )
y i0+1
[ f ( x i +1 , y i0+1 ) + f ( x i , y i )] / 2
yi
y(x)
x i +1
xi
[ f (x , y ) + f (x
Mdia =
i
Inclinao
i +1 ,
y i0+1 )
2
O valor da funo no fim do intervalo dado por:
y 1i +1 = y i +
[ f (x , y ) + f (x
i
i +1 ,
y i0+1 )
] h
Observe que o clculo do valor da funo no fim do intervalo pode ser repetido
at que se alcance uma determinada convergncia, ou seja:
f ( x i , y i ) + f ( x i +1 , y i1+1 )
y i2+1 = y i +
h
2
f ( x i , y i ) + f ( x i +1 , y i3+1 )
3
y i +1 = y i +
h
2
y ik+1
[ f (x , y ) + f (x
+
i
= yi
i +1 ,
y ik+11 )
] h
Corretor:
y 1i +1
= yi
[ f (x , y ) + f (x
+
i
i +1 ,
y i0+1 )
] h
Exemplo 8.5: Repita o exemplo 8.3, utilizando o Mtodo de Heun, com uma iterao de
correo.
y ' = x y + 2 para y (0) = 2
malha [0,1], h=0,1. Os resultados parciais so apresentados a seguir de acordo com a
sequncia:
y i0+1 = y i + f ( x i , y i ) h
x i +1 = x i + h
y 1i +1
= yi
[ f (x , y ) + f (x
+
i
i +1 ,
y i0+1 )
] h
j = 1 y0 = 2 x = 0.10000000000000
y1 = 2.00500000000000 erro = 1.629999999996912e-004
j = 2 y0 = 2.01450000000000 x = 0.20000000000000
j
0
xj
Exato
Euler
Erro
Heun
Erro
y( x j )
yj
y j y( x j )
yj
y j y( x j )
2,0000000
2,0000000
0,000000
2,0000000
0,0000000
1
2
3
4
5
6
7
8
9
10
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
1,0
2,0048370
2,0187310
2,0408180
2,0703200
2,1065310
2,1488120
2,1965850
2,2493290
2,3065700
2,3678790
2,0000000
2,0100000
2,0290000
2,0561000
2,0904900
2,1314410
2,1782969
2,2304672
2,2874205
2,3486784
-0,004837
-0,008731
-0,011818
-0,014220
-0,016041
-0,-17371
-0,018288
-0,018862
-0,019149
-0,019201
2,0050000
2,0190250
2,0412176
2,0708019
2,1070757
2,1494033
2,1972102
2,2499752
2,3072276
2,3685409
0,0001629
0,0002940
0,0003996
0,0004819
0,0005476
0,0005915
0,0006252
0,0006462
0,0006576
0,0006619
Exemplo 8.6: Repita o exemplo 8.3, utilizando o Mtodo de Heun, com trs iterao de
correo.
y ' = x y + 2 para y (0) = 2
malha [0,1], h=0,1. Os resultados so apresentados na tabela a seguir:
j
0
1
2
3
4
5
6
7
8
9
10
xj
0
0,1
0,2
0,3
0,4
0,5
0,6
0,7
0,8
0,9
1,0
Exato
Heun
( 1 Corr.)
Erro
Heun
(3 Corr.)
Erro
y( x j )
yj
y j y( x j )
yj
y j y( x j )
2,0000000
2,0048370
2,0187310
2,0408180
2,0703200
2,1065310
2,1488120
2,1965850
2,2493290
2,3065700
2,3678790
2,0000000
2,0050000
2,0190250
2,0412176
2,0708019
2,1070757
2,1494033
2,1972102
2,2499752
2,3072276
2,3685409
0,0000000
0,0001629
0,0002940
0,0003996
0,0004819
0,0005476
0,0005915
0,0006252
0,0006462
0,0006576
0,0006619
2,0000000
2,0047625
2,0185951
2,0406342
2,0700980
2,1062796
2,1485390
2,1962975
2,2490314
2,3062667
2,3675749
0,0000000
-0,0000745
-0,0001358
-0,0001837
-0,0002219
-0,0002513
-0,0002729
-0,0002874
-0,0002975
-0,0003032
-0,0003040
k1 = f ( x i , y i )
k 2 = f ( x i + p1 h, y i + q11 k1 h)
k 3 = f ( x i + p 2 h, y i + q 21 k1 h + q 22 k 2 h)
(1)
(2)
(3)
k1 = f ( x i , y i )
k 2 = f ( x i + p1 h, y i + q11 k1 h)
h2
2!
(4)
f
f dy
+
x y dx
(5)
(6)
f
f
+ q11 k1 h
+ ( h 2 )
x
y
(7)
Reagrupando os termos:
y i +1 = y i +[ a1 f ( x i , y i ) + a 2 f ( x i , y i )]h +[ a 2 p1
a1 + a 2 = 1
a 2 p1 = 1
2
a 2 q11 = 1
2
f
f
+ a 2 q11 h 2 f ( x i , y i )
+ (h 3 )
x
y
f
f
+ a 2 q11 f ( x i , y i )
]h 2 + ( h 3 )
x
y
(8)
(9)
Observe que tem-se trs equaes e quatro incgnitas, portanto tem-se infinitas solues.
Portanto existem infinitos formulaes para o Mtodo de Runge-Kutta de Segunda Ordem.
importante realar que o Mtodo de Heun com uma iterao de correo e o Mtodo de
Euler Modificado podem ser classificados como Mtodos de Runge-Kutta de Segunda
Ordem.
Mtodo de Heun
Assumindo :
a1 = a 2 = 1
2
p1 = q11 = 1
1
1
y i +1 = y i + ( k1 + k 2 ) h
2
2
k1 = f ( x i , y i )
k 2 = f ( x i + h, y i + k 1 h )
a1 = 0
a2 = 1
p1 = q11 = 1
y i +1 = y i + k 2 h
k1 = f ( x i , y i )
h
h
k 2 = f ( x i + , y i + k1 )
2
2
a1 = 1
3
a2 = 2
3
p1 = q11 = 3
1
2
y i +1 = y i + ( k1 + k 2 ) h
3
3
k1 = f ( x i , y i )
k 2 = f ( xi +
3
3
h, y i + hk1 )
4
4
1
1
y1 = y 0 + ( k1 + k 2 ) h
2
2
k1 = f ( x 0 , y 0 ) = 2 0 3 + 12 0 2 20 0 + 8,5 = 8,5
k 2 = f ( x 0 + h, y 0 + k1 h) = f (0,5, 5,25) = 2 0,5 3 +12 0,5 2 20 0,5 + 8,5 = 1,25
1
1
8,5 + 1,25
y1 = y 0 + ( k 1 + k 2 ) h = 1 +
0,5 = 3,4375
2
2
2
k1 = f ( x i , y i )
h
h
k 2 = f ( x i + , y i + k1 )
2
2
y1 = y 0 + k 2 h
k1 = f ( x 0 , y 0 ) = 2 0 3 +12 0 2 20 0 + 8,5 = 8,5
h
h
0,5
0,5
k 2 = f ( x 0 + , y 0 + k1 ) = f ( 0 +
,1 +
8,5) = f (0,25, 3,125) =
2
2
2
2
= 2 0,25 3 + 12 0,25 2 20 0,25 + 8,5 = 4,21875
10
Mtodo de Ralston:
1
2
y i +1 = y i + ( k1 + k 2 ) h
3
3
k1 = f ( x i , y i )
3
3
h, y i + hk1 )
4
4
1
2
y1 = y 0 + ( k 1 + k 2 ) h
3
3
k1 = f ( x 0 , y 0 ) = 2 0 3 + 12 0 2 20 0 + 8,5 = 8,5
3
3
3
3
k 2 = f ( x i + h, y i + hk1 ) = f (0 + 0,5, 1 + 0,5 8,5) = f (0,375, 4,1875) =
4
4
4
4
= 2 0,375 3 +12 0,375 2 20 0,375 + 8,5 = 2,582031
1
2
1
2
y1 = y 0 + ( k1 + k 2 ) h = 1 + ( 8,5 + 2,582031) 0,5 = 3,27734375
3
3
3
3
k 2 = f ( xi +
Ralston
1,00000
3,27734
3,10156
2,34765
2,14062
2,85546
4,11718
4,80078
3,03125
Erro (%)
0
1,8
3,4
5,8
7,0
5,0
2,9
1,7
1,0
1
y i +1 = y i + [ ( k1 + 2k 2 + 2k 3 + k 4 )] h
6
k1 = f ( x i , y i )
1
1
k 2 = f ( x i + h, y i + hk1 )
2
2
1
1
k 3 = f ( x i + h, y i + hk 2 )
2
2
k 4 = f ( x i + h, y i + hk 3 )
12