Integracao Numerica Simpson Boole
-
Upload
paula-fernandes -
Category
Documents
-
view
323 -
download
63
Transcript of Integracao Numerica Simpson Boole
Integração (Quadratura) Numérica
Fórmulas de Newton-Cotes: utilizadas tipicamente quando os pontos estão igualmente espaçados.
Aproximação por Retângulos;
A Regra dos Trapézios;
Os Métodos de Simpson (1/3; 3/8);
O Método de Boole (polinômio do 4o grau);
O Método de Romberg.
∫ =b
aIdxxf )(
A Quadratura Gaussiana
A Quadratura de Gauss-Legendre unidimensional;
A Quadratura de Gauss-Legendre bi e tri-dimensional;
A Quadratura de Gauss-Chebyshev;
A Quadratura de Gauss-Laguerre;
A Quadratura de Gauss-Hermite.
1
( ) ( )nb
i iai
f x dx A f x I=
≅ =∑∫
Abscissas nodais
pesos
Integração (Quadratura) Numérica
NEWTON-COTES Ordem 0: RETÂNGULOS
( )( 0,5)i
b ax a i
n
−∆ = = + − ∆
a b∆xi
f(xi)
( )( )1 1
( ) . ( ) 0,5b n n
ii ia
f x dx f x f a i= =
= ∆ = ∆ + − ∆∑ ∑∫
x
f(x)
a = limite inferiorb = limite superiorn = número de retângulos
Soma = 0Delta = (b - a)/ndo i = 1, n
x = a + (i - 0,5)*DeltaSoma = Soma + f(x)
end doprint “Integral = ”; Soma*Delta
Function f(x)f = a + b * x + c * sen(x) + ....return
End Function
NEWTON-COTES Ordem 1: TRAPÉZIOS
( )( 1)i
b ax a i
n
−∆ = = + − ∆
a b∆xi
f(xi)
( )1 11
1 1 2
( ) ( )( )( ) ( )
2 2 2 2
b n n nii n
i ii i ia
f xf x f xf xf x dx A f x+ +
= = =
= = ∆ + = ∆ + +
∑ ∑ ∑∫
xi+1
f(xi+1)
i
1 1( ) ( )
2i
i
f x f xA ++ = ∆
x
f(x)
a = limite inferiorb = limite superiorn = número de trapézios
Delta = (b - a)/nSoma = f(a) * 0,5do i = 1, n-1
x = a + i * DeltaSoma = Soma + f(x)
end doSoma = Soma + f(b) * 0,5print “Integral = ”; Soma * Delta
Function f(x)f = a + b * x + c *sen(x) + ....return
End Function
No caso dos dados não serem igualmente espaçados:
n = número de pontosx(n) = vetor de coordenadas xy(n) = vetor de coordenadas y
Soma = 0.0do i = 1, n-1
Delta = x(i+1) - x(i)Soma = Soma + (y(i) + y(i+1))/2 * Delta
end doprint “Integral = ”; Soma
NEWTON-COTES Ordem 2: REGRA 1/3 DE SIMPSON
( )( 1) 2 1
2 i
b ax a i n m
m
−∆ = = + − ∆ = +
a b
∆
xi
f(xi)
1 2
11 2,4,6 3,5,7
( ) ( ) 4 ( ) 2 ( ) ( )3
b m n n
j i i nj i ia
f x dx A f x f x f x f x− −
= = =
∆= = + + +
∑ ∑ ∑∫
xi+1
f(xi+1)f(xi+2)
j
xi+2
( )( )( )( )
( )( )( )( )
( )( )( )( )
1 2 2 11 2
1 2 1 1 2 2 2
( ) ( ) ( ) ( )i i i i i ij i i i
i i i i i i i i i i i i
x x x x x x x x x x x xf x f x f x f x
x x x x x x x x x x x x+ + + +
+ ++ + + + + + +
− − − − − −= + + − − − − − −
( )1 1 2( ) 4 ( ) ( )3j i iA f x f x f x+ +∆= + +
m= número de parábolasn = número de pontos
a = limite inferiorb = limite superiorm = número de parábolas
n = 2*m+1Delta = (b - a)/2/mS1 = 0 : S2 = 0S = f(a) + f(b)do i = 2, n-1, 2
x = a +(i - 1) * DeltaS1 = S1 + f(x)
end dodo i = 3, n-2, 2
x = a + (i - 1) * DeltaS2 = S2 + f(x)
end doprint “Integral = ”; (S + 4 * S1 + 2 * S2)/3 * Delta
Function f(x)f = a + b * x + c *sem(x) + ....return
End Function
NEWTON-COTES Ordem 3: REGRA 3/8 DE SIMPSON
( )( 1) 3 1
3 i
b ax a i n m
m
−∆ = = + − ∆ = +
a b∆
xi
f(xi)
2 1 3
11 2,5,8 3,6,9 4,7,10
3( ) ( ) 3 ( ) 3 ( ) 2 ( ) ( )
8
b m n n n
j i i i nj i i ia
f x dx A f x f x f x f x f x− − −
= = = =
∆= = + + + +
∑ ∑ ∑ ∑∫
xi+1
f(xi+1) f(xi+2)
j
xi+2
( )( )( )( )( )( )
( )( )( )( )( )( )
( )( )( )( )( )( )
( )( )( )( )( )( )
1 2 3 2 31
1 2 3 1 1 2 1 3
1 3 1 22 3
2 2 1 2 3 3 3 1 3 2
( ) ( )
( )
( ) ( )
i i i i i ii i
i i i i i i i i i i i i
j
i i i i i ii i
i i i i i i i i i i i i
x x x x x x x x x x x xf x f x
x x x x x x x x x x x xf x
x x x x x x x x x x x xf x f x
x x x x x x x x x x x x
+ + + + ++
+ + + + + + + +
+ + + ++ +
+ + + + + + + + + +
− − − − − −+ + − − − − − −
=− − − − − −
+− − − − − −
( )1 1 2 3
3( ) 3 ( ) 3 ( ) ( )
8j i i iA f x f x f x f x+ + +∆= + + +
m= número de cúbicasn = número de pontosxi+3
f(xi+3)
a = limite inferiorb = limite superiorm = número de cúbicas
n = 3*m+1Delta = (b-a)/3/mS1 = 0 : S2 = 0 S = f(a) + f(b)do i = 2, n-2, 3
x = a +(i - 1) * DeltaS1 = S1 + f(x) + f(x + Delta)
end dodo i = 4, n-3, 3
x = a + (i - 1) * DeltaS2 = S2 + f(x)
end doprint “Integral = ”; 3/8 * (S + 3*S1 + 2*S2) * Delta
Function f(x)f = a + b * x + c * sem(x) + ....return
End Function
NEWTON-COTES Ordem 4: REGRA DE BOOLE
( )( 1) 4 1
4 i
b ax a i n m
m
−∆ = = + − ∆ = +
1
3 2 1 4
12,6,10 3,7,11 4,8,12 5,9,13
( )
47 ( ) 32 ( ) 12 ( ) 32 ( ) 14 ( ) 7 ( )
90
b m
jja
n n n n
i i i i ni i i i
f x dx A
f x f x f x f x f x f x
=
− − − −
= = = =
= =
∆ + + + + +
∑∫
∑ ∑ ∑ ∑
( )1 1 2 3 4
47 ( ) 32 ( ) 12 ( ) 32 ( ) 7 ( )
90j i i i iA f x f x f x f x f x+ + + +∆= + + + +
m= número de pol. 4o graun = número de pontos
INTEGRAÇÃO DE ROMBERG
Este método combina a regra do trapézio:
com a extrapolação de Richardson:
∑−
=−−−
−++=22
1111 2
)12(
22
1k
ikkkk h
iaf
hII k = 2, 3, ...
12
2 12
−−=
p
p ggG
Recordando, a regra do trapézio para um único trapézio é:
f(x)
x
hbfaf
I2
)()(1
+=
a b
f(a)
f(b)
para dois trapézios:
f(x)
x
22
)2/()(
22
)2/()(2
hhafbfhhafafI
+++++=
a b
f(a)
f(b)
2)2/(
2
)()(
2
1 hhafh
bfaf +++=
)2/(22
11 haf
hI ++=
h = b – a
para quatro:
∑−
=−−−
−++=22
1111 2
)12(
22
1k
ikkkk h
iaf
hII
42
)4/3()(
42
)4/3()4/2(
42
)4/2()4/(
42
)4/()(4
hhafbfhhafhafhhafhafhhafafI
+++++++++++++=
[ ]4
)4/3()4/(2
12
hhafhafI ++++=
f(x)
xa b
f(a)
f(b)4
)4/3(4
)4/()2/(22
1
2
)()(
2
1
2
1 hhaf
hhafhaf
hh
bfaf +++++++=
Para 2k-1 trapézios:
k = 2, 3, ...
Assim, a i-ésima aproximação da integral pela Regra do Trapézio:
I i = Ri,1 onde a largura dos trapézios é: h = (b - a)/2k-1
Portanto, a primeira aproximação: R1,1 = I1 (um trapézio);
a segunda aproximação: R2,1 = I2 (dois trapézios);
Se a ordem do erro cometido for h2, então uma primeira aplicação da extrapolação de Richardson fica:
12
2 12
−−=
p
p ggG 1,11,22
1,11,22
2,2 3
1
3
4
12
2RR
RRR −=
−−
=
a terceira aproximação: R3,1 = I3 (quatro trapézios);
e uma nova extrapolação de Richardson:
1,21,32,3 3
1
3
4RRR −=
As duas extrapolações feitas possuem um erro da ordem h4 que, por sua vez, pode ser eliminado com uma nova extrapolação:
2,22,342,22,3
4
3,3 15
1
15
16
12
2RR
RRR −=
−−
=
Esquematicamente, os resultados podem ser arranjados assim:
R1,1
R2,1
R3,1
R4,1
R2,2
R3,2
R4,2
R3,3
R4,3 R4,4
... ... ... ... ...
onde:
14
41
1,11,1
, −−
= −−−−
−
j
jijij
ji
RRR
i > 1 j = 2, ... , i
Exemplo: utilizar a integração de Romberg para avaliar:
Solução:
Aplicações da Regra do Trapézio:
∫π
0)( dxxsen
R1,1 = I1 = [f(a) + f(b)] h/2 = [f(0) + f(π)] (π - 0)/2 = 0
R2,1 = I2 = 1/2 I1 + f(a+h/2)] h/2 = (1/2)(0) + f(0+ π /2) π /2 = π /2
R3,1 = I3 = 1/2 I2 + [f(a+h/4) + f(a+3h/4)] h/4 =
= (1/2)(π /2) + [f(π /4) + f(3π /4)] π /4 = (1+ 2 )π /4
Exemplo: utilizar a integração de Romberg para avaliar:
Solução:
Aplicações da Extrapolação de Richardson:
∫π
0)( dxxsen
R2,2 = 4/3 R2,1 – 1/3 R1,1 = 4/3 π /2 – (1/3)(0) = 2π /3 = 2,0944 (erro = 4,72 %)
R3,2 = 4/3 R3,1 – 1/3 R2,1 = 4/3 (1+ 2 )π /4 – (1/3)(π /2) = (1+2 2)π /6
R3,3 = 16/15 R3,2 – 1/15 R2,2 = 16/15 (1+ 2 2 )π /6 – (1/15)(2π /3) = (6+16 2)π /45
= 1,9986 (erro = 0,07 %)
Obs.: Uma próxima iteração conduziria à solução exata!
QUADRATURA GAUSSIANA
f(x)
xa b
f(a)
f(b)
Regra do Trapézio
f(x)
xa b
f(a)
f(b)
Quadratura Gaussiana
Abscissas a serem encontradas
A Quadratura Gaussiana resulta exata se f (x) é um polinômio de grau 2n-1 ou menor:
Uma maneira de se determinar os pesos Ai e as abscissas xi seria substituir polinômios P0(x) = 1; P1(x) = x ; ... ; P2n+1(x) = x2n-1 na expressão acima e resolver o sistema de equações resultante.
1
( ) ( ) ( )nb
m i m iai
w x P x dx A P x=
=∑∫ m ≤ 2n-1
Quadratura de Gauss – Legendre:
Esta classe de quadratura determina o seguinte:
que, com dois pesos Ai e duas abscissas ξi consegue integrar exatamente polinômios de até grau 3.
1
11
( ) ( )n
i ii
f d A fξ ξ ξ+
−=
=∑∫
Ainda, para executá-la, precisa-se fazer o seguinte mapeamento:
f(x) f(ξ)
x = (b+a)/2 + (b-a)/2 ξ
dx = (b-a)/2 dξ
ou seja:
∫b
adxxf )( ∫ ∑
+
−=
−≅−1
10
)(22
)(n
iii fA
abd
abf ξξξ
Exercício 1: Determinar os pesos e abscissas para n = 2.
A1 f(ξ1) + A2 f(ξ2) = A1 + A2 = 2
A1 f(ξ1) + A2 f(ξ2) = A1 ξ1 + A2 ξ2 = 0
A1 f(ξ1) + A2 f(ξ2) = A1 ξ12 + A2 ξ2
2 = 2/3
A1 f(ξ1) + A2 f(ξ2) = A1 ξ13 + A2 ξ2
3 = 0
∫+
−=
1
121 ξd
∫+
−=
1
10ξxd
∫+
−=
1
1
2 3/2ξdx
∫+
−=
1
1
3 0ξdx
Solução:
Solução:
Resolvendo-se o sistema de 4 equações e 4 incógnitas, obtém-se:
A0 = 1 ξ0 = -1 / 3 = -0,5773503...
A1 = 1 ξ1 = +1/ 3 = +0,5773503...
Exercício 2: Com os pesos e abscissas recém determinadas, calcular a integral de f (x) = 0,2 + 25x - 200 x2 + 675 x3 - 900 x4 + 400 x5
entre os extremos 0 e 0,8 (o valor exato seria 1,640533).
Solução:
x = (b+a)/2 + (b-a)/2 ξ = (0,8+0)/2 + (0,8-0)/2 ξ = 0,4 + 0,4 ξ dx = (b-a)/2 dξ = (0,8 - 0)/2 dξ = 0,4 dξ
∫ =+−+−+8,0
0
5432 )400900675200252,0( dxxxxxx
∫+
−=+++−+++−++=
1
1
5432 4,0])4,04,0(400)4,04,0(900)4,04,0(675)4,04,0(200)4,04,0(252,0[ ξξξξξξ d2
1
0,4 ( ) 0,4[(1) ( 1/ 3) (1) (1/ 3)] 0,4[1,291851 3,264593] 1,822578i ii
A f f fξ=
= = − + = + =∑(erro = -11 %)
n ξi Ai
1 0,000 000 000 2,000 000 0
2 +0,577 350 269 1,000 000 0
-0,577 350 269 1,000 000 0
3 0,000 000 000 0,888 888 9
+0,774 596 669 0,555 555 6
-0,774 596 669 0,555 555 6
4 +0,339 981 044 0,652 145 2
-0,339 981 044 0,652 145 2
+0,861 136 312 0,347 854 8
-0,861 136 312 0,347 854 8
Pesos e abscissas para outros esquemas de integração.
Exercício 3: Com os pesos e abscissas para n = 3, calcular novamente a integral de f (x) = 0,2 + 25x - 200 x2 + 675 x3 - 900 x4 + 400 x5
entre os extremos 0 e 0,8 (o valor exato seria 1,640533).
Solução:
x = (b+a)/2 + (b-a)/2 ξ = (0,8+0)/2 + (0,8-0)/2 ξ = 0,4 + 0,4 ξ dx = (b-a)/2 dξ = (0,8 - 0)/2 dξ = 0,4 dξ
∫ =+−+−+8,0
0
5432 )400900675200252,0( dxxxxxx
∫+
−=+++−+++−++=
1
1
5432 4,0])4,04,0(400)4,04,0(900)4,04,0(675)4,04,0(200)4,04,0(252,0[ ξξξξξξ d2
1
0,4 ( ) 0,4[(0,555556) ( 0,7745967) (0,8888889) (0) (0,5555556) (0,7745967)] 1,640533i ii
A f f f fξ=
= = − + + =∑(erro = 0 %)
Quadratura Gaussiana em 2 dimensões
Considere a integral: ( )6 9 2 2
2 34 2 6 2 4 3
4 2 6 3
2 3
I x y xy x y dydx
x y
dx d dy d
ξ ηξ η
= + + + − +
= + = += =
∫ ∫
( ) ( ) ( ) ( ) ( ) ( )( )1 1 2 2
1 14 4 2 2 6 3 6 4 2 6 3 2 4 2 4 6 3 3 .6I d dξ η ξ η ξ η ξ η
+ +
− −= − + + + + + + + − + +∫ ∫
Chamando de:
( ) ( ) ( ) ( ) ( ) ( )( )2 2( , ) 6 4 4 2 2 6 3 6 4 2 6 3 2 4 2 4 6 3 3f ξ η ξ η ξ η ξ η= − + + + + + + + − + +
1 1
1 1( , )I f d dξ η ξ η
+ +
− −= ∫ ∫
A integração pode ser feita de forma numérica utilizando-se, por exemplo, 3 pontos de Gauss em cada dimensão, resultando em:
1 1 1 1 2 1 2 1 3 1 3 1
1 2 1 2 2 2 2 2 3 2 3 2
1 3 1 3 2 3 2 3 3 3 3 3
( , ) ( , ) ( , )
( , ) ( , ) ( , )
( , ) ( , ) ( , )
I A A f A A f A A f
A A f A A f A A f
A A f A A f A A f
ξ η ξ η ξ η
ξ η ξ η ξ η
ξ η ξ η ξ η
ξ η ξ η ξ ηξ η ξ η ξ ηξ η ξ η ξ η
= + +
+ + +
+ + +
0,555.0,555. ( 0,775; 0,775) 0,889.0,555. (0;0,775) 0,555.0,555. ( 0,775; 0,775)
0,555.0,889. ( 0,775;0) 0,889.0,889. (0;0) 0,555.0,889. (0,775;0)
0,555.0,555. ( 0,775; 0,775) 0,889.0,555. (0; 0,7
I f f f
f f f
f f
= − − + − + + −+ − + + ++ − + + + 75) 0,555.0,555. ( 0,775; 0,775)f+ + +
1 1 1
1 1 2 2 3 31 1 1( , ) ( , ) ( , )I A f d A f d A f dη η ηξ η ξ ξ η ξ ξ η ξ
+ + +
− − −= + +∫ ∫ ∫
Para o exemplo anterior:1
1 1
1
n
n
n n
yy
x x
yy
x x
∂∂ ∂ ∂
= ∂∂ ∂ ∂
J
L
M O M
L
O determinante da Matriz Jacobiana (ou determinante Jacobiano det J) dá importantes informações sobre o comportamento da transformação
Y = y1...yn:
•A transformação Y pode ser invertida nas proximidades de um ponto p se o determinante neste ponto é não nulo.
•O valor absoluto do determinante em p dá o fator pelo qual a transformação Y expande ou contrai o volume nas proximidades de p.
Considerando a Matriz Jacobiana:
2 0det 6
0 3
x y
x y
ξ ξ
η η
∂ ∂ ∂ ∂ = = = ∂ ∂ ∂ ∂
J J
4 2 6 3x yξ η= + = +
( ) ( ) ( ) ( ) ( ) ( )( )1 1 2 2
1 14 4 2 2 6 3 6 4 2 6 3 2 4 2 4 6 3 3 . 6I d dξ η ξ η ξ η ξ η
+ +
− −= − + + + + + + + − + +∫ ∫
Considerando a Transformação:
3 1det 5
2 1
x y
x y
ξ ξ
η η
∂ ∂ ∂ ∂ = = = ∂ ∂ − ∂ ∂
J J
3 2x yξ η ξ η= − = +
1 1 1 1 1 1
1 1 1 1 1 1det 5 5 5.4 20
AI dxdy J d d d d d dξ η ξ η ξ η
+ + + + + +
− − − − − −= = = = = =∫ ∫ ∫ ∫ ∫ ∫ ∫
1 1 1 2
1 1 5 0
1 1 5 0
1 1 1 2
x y
x y
x y
x y
ξ ηξ ηξ ηξ η
= − = − = − = −= + = − = + == − = + = − == + = + = + =
A=20 x
y
Em Elementos Finitos:
( ) ( )( ) ( )( ) ( )( )( ) ( )( ) ( )( ) ( ) ( )( ) ( ) ( ) ( )( ) ( )( )( ) ( )( ) ( )( ) ( )( )
11 4
212 2
13 4
214 2
15 4
216 2
17 4
218 2
, 1 1 1
, 1 1
, 1 1 1
, 1 1
, 1 1 1
, 1 1
, 1 1 1
, 1 1
N
N
N
N
N
N
N
N
ξ η ξ η ξ η
ξ η ξ η
ξ η ξ η ξ η
ξ η ξ η
ξ η ξ η ξ η
ξ η ξ η
ξ η ξ η ξ η
ξ η ξ η
= − − − + +
= − −
= + − − −
= + −
= + + + −
= − +
= − + − + −
= − −
( )
( )
8
1
8
1
( , ) , .
( , ) , .
,
k k
k k
k k
x N x
y N y
x y coordenadas dos nós
ξ η ξ η
ξ η ξ η
=
=
=
∑
∑
Similar a Polinômios de Lagrange:( ) ( )( )
1
1
, 1 1; 1 1
, 0
N em nó
N em todos demais nós
ξ η ξ ηξ η
= = − = −
=
Quando a geometria e as demais grandezas são aproximadas pelas mesmas funções de interpolação a partir de valores nodais � Elementos Isoparamétricos.
81
1
1
det
k kk k
k k kk k
N Nx y y yx y
x x
x y N N x xx y
y y
ξ ηξ ξ ξ ξ η ξ
ξ ηη η η ξη η
−
=
∂ ∂∂ ∂ ∂ ∂ ∂ ∂ − ∂ ∂ ∂ ∂ ∂ ∂∂ ∂ = = = =∂ ∂∂ ∂ ∂ ∂ ∂ ∂ − ∂ ∂∂ ∂ ∂ ∂∂ ∂
∑J JJ
. . . .f f f f f f
x x x y y y
ξ η ξ ηξ η ξ η
∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂= + = +∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂ ∂
As derivadas cartesianas são obtidas pela regra da cadeia:
E um elemento de área pode ser calculado como:
. det .dx dy d dξ η= J
Assim, a integração de uma função qualquer no domínio do elemento é dada por:
( ) ( )
( ) ( )
81 1
1 11
8
1 1 1
( , ) , ( , ) . det , .
( , ) . . , ( , ) .det ,
k k kAk
n n
i j k j i k k j iAi j k
f x y dA N f x y d d
f x y dA A A N f x y
ξ η ξ η ξ η
ξ η ξ η
− −=
= = =
=
=
∑∫ ∫ ∫
∑ ∑ ∑∫
J
J
Outras Quadraturas Gaussianas:
Quadratura de Gauss-Chebyshev:
Quadratura de Gauss-Laguerre:
Quadratura de Gauss-Hermite:
∑∫=
+
− +≅
−
n
iif
ndx
x
xf
0
1
1 2)(
11
)( ξπ
∑∫=
∞ − ≅n
iii
x xfAdxxfe0
0)()(
∑∫=
∞+
∞−
− ≅n
iii
x xfAdxxfe0
)()(2
22
)12(cos
++=
n
ii
πξ