Está en la página 1de 8

Capı́tulo 8: Integración Numérica FAIN - UNCOMA

Capı́tulo 8: Integración Numérica

1. Polinomios de Newton Gregory


Si los puntos estan igualmente espaciados en la variable independiente y ordenados en forma ascendente

x1 = x0 + h
x2 = x0 + 2h h: tamao del paso
..
.
xn = x0 + nh

la primera diferencia dividida

f (x1 ) − f (x0 ) f (x1 ) − f (x0 ) ∆f (x0 )


= =
x1 − x0 h h
la segunda diferencia dividida
f (x2 )−f (x1 ) f (x1 )−f (x0 ) f (x2 )−f (x1 )
x2 −x1 − x1 −x0 h − f (x1 )−f
h
(x0 )
f (x2 ) − 2f (x1 ) + f (x0 ) ∆2 f (x0 )
= = =
x2 − x0 2h 2h2 2!h2
la tercera diferencia dividida
f (x3 )−f (x2 ) f (x2 )−f (x1 ) f (x2 )−f (x1 ) f (x1 )−f (x0 )
x3 −x2 − x2 −x1 x2 −x1 − x1 −x0
x3 −x1 }=2h − x2 −x0 f (x3 ) − 3f (x2 ) + 3f (x1 ) − f (x0 ) ∆3 f (x0 )
= 3
=
x3 − x0 } =3h 6h 3!h3
luego

∆n f (x0 )
= f [x0 , x1 , . . . , xn ]
n!hn
entonces el polinonio de Newton puede escribirse

∆f (x0 ) ∆2 f (x0 ) ∆n f (x0 )


fn (x) = f (x0 ) + (x − x0 ) + 2
(x − x0 )(x − x0 − h) + · · · + (x − x0 )[x − x0 − (n − 1)h]
1!h 2!h | {z } n!hn
−x1

x−x0
si llamamos α = h

(x − x0 ) = αh
x1
z }| {
(x − x0 ) − h = αh − h = h(α − 1)
x2
z }| {
(x − x0 ) − 2h = αh − h = h(α − 2)
xn
z }| {
(x − x0 ) − (n − 1)h = h(α − (n − 1)) = h(α − n + 1)

1 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

∆f (x0 ) ∆2 f (x0 ) ∆n f (x0 )


fn (x) = f (x0 ) + α6h+ 2
α 6 h(α − 1) 6 h + · · · + α 6 h(α − 1) 6 h · · · 6 h(α − (n − 1)) + Rn
1! 6 h 2! 6 h n! 6 hn
∆f (x0 ) ∆2 f (x0 ) ∆n f (x0 )
fn (x) = f (x0 ) + α+ α(α − 1) + · · · + α(α − 1) · · · (α − (n − 1)) + Rn
1! 2! n!
f (n+1) (ξ) (n+1)
Rn = h α(α − 1)(α − 1) · · · (α − n)
(n + 1)!

2. Integración numérica
Newton-Cotes: Reemplazar la función a integrar por una función de polinomios facil de integrar (polinomios
de Newton)
Gauss-Legendre: Utiliza polinomios de Legendre, en un dominio ”maestro”

Se requiere calcular la integral definida de la función f (x)


Z b Z b
I= f (x)dx ' fn (x)dx
a a

donde fn (x) es un polinomio de Newton o Lagrange de orden n

3. Orden 1 (interpolación lineal). Regla de los Trapecios

f (b) − f (a)
f1 (x)
= f (a) + (x − a)
b−a
Z b Z b
f (b) − f (a)
I' f1 (x)dx = f (a) + (x − a)dx
a a b−a
 b
f (b) − f (a) x2


= f (a) x + − ax
b−a 2
 2  a
f (b) − f (a) a2
 
f (b) − f (a) b
= f (a) b + − ab − f (a) a + − a2
b−a 2 b−a 2
 

 b2
f (b) − f (a)  a2 
= f (a) (b − a) +  − ab + 

b−a |2 {z 2}
1 2
2 (b−a)
 
f (b) − f (a) 1
= f (a) (b − a) + (b − a)62
6 b− 6 a 2
 
f (b) f (a)
= f (a) (b − a) f (a) + −
2 2
(b − a)
I = [f (b) + f (a)]
2
Error en regla trapezoidal
Tomando el polinomio de Newton Gregory de orden 2

2 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

00 00
f (ξ) 0 f (ξ) 2
f2 (x) = f (a) + ∆f (a)α + α(α − 1)h2 f (x) = f (a) + f (a)h + h
2! | {z 2! }
R2
x − x0
−→ dx = hdα
h
h=b−a
a<x<b
0<α<1

Figura 1: Trapecios

Z 1 Z 1 00
f (ξ)
I = h f (a) + ∆f (a)αdα + h α(α − 1)h2 dα
0 0 2!
 1
h3 α 3 α2 00
  
1
= h f (a) + (f (b) − f (a)) + − f (ξ)
2 2 3 2 0
f (b) + f (a) h3 1 1
 
= + −
2 2 3 2
f (b) + f (a) h3
 
1 00
= + − f (ξ)
2 2 6
 3
f (b) + f (a) h 00
= + − f (ξ)
2 12

Luego

h = b−a
00 (b − a)3
E(h) = −f (ξ)
12

3.1. Trapecios aplicación múltiple


Para mejorar la exactitud se divide el intervalo de integración en un cierto número de de segmentos donde
se aplicará la regla.

3 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

Figura 2: Trapecios Multiple

Z b Z x1 Z x2 Z xn
I = f (x)dx = f (x)dx + f (x)dx + · · · + f (x)dx
a x0 x1 xn−1
f (x1 ) + f (x0 ) f (x2 ) + f (x1 ) f (xn ) + f (xn−1 )
= (x1 − x0 ) + (x2 − x1 ) + · · · + (xn − xn−1 )
2 | {z } 2 | {z } 2 | {z }
h h h
h
= [f (x0 ) + 2[f (x1 ) + f (x2 ) + · · · + f (xn−1 )] + f (xn−1 )]
2

b−a
h =
N

donde N : número de intervalos

" n−1
#
h X
f (x0 ) + 2 f (xi ) + f (xn )
2 2
" n−1
#
(b − a) X
f (x0 ) + 2 f (xi ) + f (xn )
2N 2

donde n : número de puntos

N N 3 N
h3 (b − a)3 X 00

X 00 X 00 b−a 1
ET M (h) = f (ξ) = f (ξ) = 3
f (ξ)
1
12 1
N 12 | 12N{z } 1
Oh3
PN 00
(b − a)3 1 f (ξ)
=
12N 2 N
(b − a)3 00
= f (ξ)
12N 2
(b − a)h2 00
= f (ξ)
12

4 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

3.2. Algoritmo de Integración por Trapecios


SUBROUTINE IntTrap(a, b, n, f) % Ver esta instrucci\’on
Suma=f(0)
DO i=1,n-1
Suma = Suma + 2*f(i)
END DO
Suma = Suma + f(n)
IT= (b-a)/(2*n)*Suma
END SUBROUTINE

4. Reglas de Simpson
Para mejorar la exactitud, otra opción es utilizar un polinomio de mayor orden.

4.1. Simpson 1/3


Polinomio Cuadrático

Z b Z b
I= f (x)dx ' f2 (x)dx
a a

Figura 3: Simpson 1/3

Del polinomio de Newton se tiene:

" f (x2 )−f (x1 ) f (x1 )−f (x0 )


#
f (x1 ) − f (x0 ) x2 −x1 − x1 −x0
f2 (x) = f (x0 ) + (x − x0 ) + (x − x0 )(x − x1 )
x1 − x0 x2 − x0

Si están igualmente espaciados

x1 = x0 + h α = (x−x
h
0)
x = x0 → α = 0
x2 = x0 + 2h hdα = dx x = x2 → α = 2

5 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

∆f (x0 ) ∆2 f (x0 ) f (iv) (ξ) f (4) (ξ)


f2 (x) = f (x0 ) + α+ α(α − 1) + (α − 2)(α − 1)αh3 + (α − 3)(α − 2)(α − 1)αh4
1! 2! 3! 4!
Z 2 
∆2 f (x0 )

∆f (x0 )
I = h f (x0 ) + α+ α(α − 1) dα +
0 1! 2!
Z 2  (3)
f (4) (ξ)

f (ξ)
h (α − 2)(α − 1)αh3 + (α − 3)(α − 2)(α − 1)αh4 dα
0 3! 4!
2 2
 3  2
α2

α ∆ f (x0 ) α
= h αf (x0 ) + ∆f (x0 ) + − +
2 2 3 2 0
 3 4 (4) 5
 2
f (ξ) 3 α 3 2 f (ξ) 4 α 3α4 11α3 2

h h ( −α +α )+ h ( − + − 3α )
3! 4 4! 5 2 3 0
1 (4) 5
I ' [f (x0 ) + 4f (x1 ) + f (x2 )] + f (ξ)h
|90 {z }
E≈O(h5 )
b−a
h =
2
(b − a) (4) (b − a) iv
E = 5
f (ξ) = f (ξ)
90 · 2 2880

4.2. Simpson 1/3 aplicación múltiple


Se debe contar con un número par de intervalos
Z b=xn Z x2 Z x4 Z xn
I = f (x)dx = f (x)dx + f (x)dx + · · · + f (x)dx
a=x0 x0 x2 xn−2
( )
h h i h i h i
' f (x0 ) + 4f (x1 ) + f (x2 ) + f (x2 ) + 4f (x3 ) + f (x4 ) + · · · + f (xn−2 ) + 4f (xn−1 ) + f (xn )
3
N N
X 1 (4) 1 5 X (4) 1 (b − a)5 (4)
E = f (ξ)h5 = h f (ξ) = f (ξ)
1
90 90 1
90 N 5
1 (b − a)5 (4)
= f (ξ)
90 N 4
N
1 X (4)
donde: f (4) (ξ) = f (ξ)
N 1

4.3. Algoritmo de Integración por Simpson 1/3


SUBROUTINE S13(a, b, n, f) % Ver esta instrucci\’on
h=(b-a)/n

Suma=f(0)
DO i=1,n-1,2
Suma = Suma + 4*f(i)
END DO

DO j=2,n-2,2
Suma = Suma + 2*f(j)
END DO

Suma = Suma + f(n)


IS13= Suma*h/3
END SUBROUTINE

6 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

4.4. Simpson 3/8


Polinomio Cúbico

Z b Z b
I= f (x)dx ' f3 (x)dx
a a

f (x3 )−f (x2 ) f (x2 )−f (x1 ) f (x2 )−f (x1 ) f (x1 )−f (x0 )
f (x2 )−f (x1 ) − −
f (x1 ) − f (x0 ) x2 −x1 − f (xx11)−f
−x0
(x0 ) x3 −x2
x3 −x1
x2 −x1
− x2 −x1
x2 −x0
x1 −x0

f3 (x) = f (x0 ) + + + +
x1 − x0 x2 − x0 x3 − x0
+ f (4) (ξ)(x − x0 )(x − x1 )(x − x2 )(x − x3 )

Figura 4: Simpson 3/8

Si están igualmente espaciados


(x−x0 )
x1 = x0 + h α= h x = x0 →α=0
x2 = x0 + 2h x = x1 →α=1
x3 = x0 + 3h hdα = dx x = x2 →α=2
x = x3 →α=3
Polinomio de Newton-Gregory

∆f (x0 ) ∆2 f (x0 ) ∆2 f (x0 ) h4


f3 (x) = f (x0 ) + α+ α(α − 1) + α(α − 1)(α − 2) + f (4) (ξ) α(α − 1)(α − 2)(α − 3)
1! 2! 3! 4!

3
∆2 f (x0 ) 2 ∆2 f (x0 ) 3
Z
I ≈ f (x0 ) + ∆x0 α + α −α+ α − 3α2 + 2αhdα +
0 2 6
3
h4
Z
f (4) (ξ) α4 − 6α3 + 11α2 − 6α hdα

0 4!
 2 3
∆2 f (x0 ) α3 α2 ∆2 f (x0 ) α4
   
α 3 2
≈ h f (x0 )α + ∆f (x0 ) + − + −α +α +
2 2 3 2 6 4 0
3
h4 α 5 3α4 11α3
 
f (4) (ξ) − + − 3α2
4! 5 2 3 0
3 5 (4) −3
≈ h[f (x0 ) + f (x1 ) + 3f (x2 ) + f (x3 )] + h f (ξ)
8 80
5

E≈O h

3
I' h[f (x0 ) + f (x1 ) + 3f (x2 ) + f (x3 )]
8

7 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar
Capı́tulo 8: Integración Numérica FAIN - UNCOMA

4.5. Simpson 3/8 aplicación múltiple

(
h h i h i
I ' f (x0 ) + 3f (x1 ) + 3f (x2 ) + f (x3 ) + f (x3 ) + 3f (x4 ) + 3f (x5 ) + f (x6 ) +
3
)
h i
· · · + f (xn−3 ) + f (xn−2 ) + 3f (xn−1 ) + f (xn )
(
h h i h i
I ' f (x0 ) + 3 f (x1 ) + f (x4 ) + f (x7 ) + · · · + 3 f (x2 ) + f (x5 ) + f (x8 ) + · · · +
3
)
h i
2 f (x3 ) + f (x6 ) + f (x9 ) + · · ·

" n−2 n−1 n−3


#
3 X X X
I ' h f (x0 ) + 3 f (xi ) + 3 f (xj ) + 2 f (xk )
8 i=1 j=2 k=3
c/3 c/3 c/3

−3 (4)
E= f (ξ)h5
80
!5
−3 X (4) b−a −3(b − a)5 X iv −3(b − a)5 iv
E= f (ξ) = f (ξ) = f (ξ)
80 n n5 80 n4 80

4.6. Algoritmo
SUBROUTINE S38(a, b, n, f) % Ver esta instrucci\’on
h=(b-a)/n

Suma=f(0)

DO i=1,n-2,3
Suma = Suma + 3*f(i)
END DO

DO j=2,n-1,3
Suma = Suma + 3*f(j)
END DO

DO k=3,n-2,3
Suma = Suma + 2*f(k)
END DO

Suma = Suma + f(n)


IS38= Suma*3/8*h

END SUBROUTINE

8 Métodos Computacionales en Ingenierı́a I - 2012


http://pedco.uncoma.edu.ar

También podría gustarte