47
Laboratori de Càlcul Numèric (LaCàN) Departament de Matemàtica Aplicada III Universitat Politècnica de Catalunya (Barcelona) http://www-lacan.upc.es Integración numérica

Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

Laboratori de Càlcul Numèric (LaCàN) Departament de Matemàtica Aplicada III

Universitat Politècnica de Catalunya (Barcelona) http://www-lacan.upc.es

Integración numérica

Page 2: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 3

Índice

§  Motivación y objetivos §  Cuadratura numérica

•  Planteamiento general •  Clasificación •  Orden de una cuadratura

§  Cuadraturas de Newton-Cotes §  Cuadraturas compuestas §  Cuadraturas de Gauss §  Convergencia §  Integrales dobles

Page 3: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 4

§  Objetivo: calcular/aproximar el valor de la integral

§  Limitaciones de la integración analítica: •  la expresión analítica de f(x) no es conocida: datos

experimentales o función evaluable sólo de forma discreta,

•  f(x) con expresión analítica pero con integral analítica complicada o desconocida.

Motivación

Page 4: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 5

Objetivos

§  Entender cómo se aproxima una integral mediante una cuadratura numérica

§  Entender qué es el orden de una cuadratura y ser capaz de calcularlo

§  Aprender a utilizar las cuadraturas de Gauss y las de Newton-Cotes, y saber cuando se pueden utilizar unas u otras

§  Ser capaz de utilizar cuadraturas compuestas

Page 5: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 6

Cuadratura numérica

pesos puntos

error

Page 6: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 7

Planteamiento general

1.  Aproximar f por un polinomio

2.  Integrar (con interpolación de Lagrange)

Page 7: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 9

Clasificación

§  Según los puntos de integración: •  Newton-Cotes: puntos arbitrarios (datos

experimentales…) •  generalmente puntos equiespaciados •  sólo hay que determinar los pesos y el

error •  Gauss: puntos “óptimos” (hábilmente elegidos)

•  f se puede evaluar donde se desee •  se eligen los puntos para que la

cuadratura sea “lo mejor posible” y, después, se calculan y

Page 8: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 10

§  Según los extremos:

•  cuadraturas cerradas

•  cuadraturas abiertas

Page 9: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 11

Orden de una cuadratura

§  Definición: se dice que una cuadratura es de orden q si integra exactamente polinomios de grado ≤ q

§  Si la cuadratura se obtiene integrando el polinomio interpolador (con n+1 puntos), entonces la cuadratura es de orden n, o superior.

§  Si el error es de la forma

entonces la cuadratura es de orden q

Page 10: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 12

Cuadraturas de Newton-Cotes

Page 11: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 13

Fórmulas cerradas de Newton-Cotes

§  Puntos arbitrarios §  Sólo hay que calcular

los pesos

y el error

§  Cuadraturas tabuladas para puntos equiespaciados.

Page 12: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 14

Cambio de variable

§  Los puntos de integración corresponden a α=0,1,…,n

§  Polinomios y resto de Lagrange

Page 13: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 15

Cuadraturas cerradas de Newton-Cotes con puntos equiespaciados

§  Pesos de integración

§  Error

Page 14: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 16

Fórmula del trapecio (n=1)

Page 15: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 17

teorema del valor medio integral

Fórmula del trapecio (n=1)

Page 16: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 18

Fórmula de Simpson (n=2)

Page 17: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 19

Fórmula de Simpson (n=2)

n=2 par à orden 3 (mayor de lo esperado)

Page 18: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 20

§  Si n es impar (orden n)

§  Si n es par (orden n+1)

Error de las cuadraturas cerradas de Newton-Cotes

Demostración en Ralston & Rabinowitz, “A first course in numerical analysis”, McGraw-Hill, 2ª edición, 1978

Page 19: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 23

Fórmulas cerradas de Newton-Cotes

(Trapecio)

(Simpson)

(2ª Simpson)

Page 20: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 24

Fórmulas abiertas de Newton-Cotes

§  La misma idea con x0= a+h y xn = b-h

Page 21: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 25

Page 22: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 26

Cuadraturas compuestas

Page 23: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 27

Idea

§  Se divide el intervalo [a,b] en m subintervalos

y se aplica una cuadratura numérica (de Newton-Cotes, de Gauss, …) con n+1 puntos en cada subintervalo.

I1 Im

Page 24: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 28

Ejemplo: fórmula compuesta del trapecio

§  En cada uno de los m subintervalos se utiliza la fórmula del trapecio (n=1).

I1 I2 I3 I4

m=4, n=1

Page 25: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 29

§  Es decir,

con

Page 26: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 30

§  Si los puntos son equiespaciados, con distancia , la fórmula se escribe como

donde el error es

o, equivalentemente,

m→∞ 0

(si f2) está acotada)

Page 27: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 31

§  En cada uno de los m subintervalos se utiliza la fórmula de Simpson (n=2).

Ejemplo: fórmula compuesta de Simpson

I1 I2

m=2, n=2

Page 28: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 32

§  Es decir,

§  Si los puntos son equiespaciados, con

Page 29: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 33

§  El error es

o, equivalentemente,

§  Como en cualquier fórmula compuesta, el error tiende a cero cuando se aumenta el número de puntos:

(si f4) está acotada)

Page 30: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 34

Cuadraturas de Gauss

Page 31: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 35

§  Newton-Cotes: Ø Predetermined (equally spaced) integration

points {x0,… xn} Ø n+1 d.o.f (wi) à order n (Special case: for even n à order n+1)

§  Gauss quadrature: we must ask

Ø Can we chose the integration points {x0,… xn} to have a higher order?

2n+2 d.o.f (wi, xi )à order 2n+1 ? Ø What order can be reached?

Cuadraturas de Gauss

Page 32: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 36

§  Points and weights of the quadrature can be calculated by imposing the Gauss quadrature to verify

for (nonlinear system with 2n+2 unknowns and 2n+2 equations)

§  Quadrature has order 2n+1

p(z)dz = wi p(zi )i=0

n

∑a

b

a , b

Page 33: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 37

Exercises: 1) Requiring exact integration for p0 (x) =1, p1 (x) =x, find the weights and Gauss points of this quadrature:

[n=0, order 1] 2) Requiring exact integration for

p0 (x) =1, p1 (x) =x, p2 (x) =x2, p3 (x) =x3 find the weights and Gauss points of the above quadrature in this case. [n=1, order 3]

Page 34: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 50

Gauss-Legendre

§  n=0 (orden 1)

§  n=1

(orden 3) §  n=2

(orden 5)

Page 35: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

Cuadratura de Gauss-Legendre

INTEGRACIÓN NUMÉRICA· 51

Page 36: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 52

Page 37: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 53

Ejemplo de aplicación: Gauss-Legendre

§  Con el cambio de variable de [-1,1] a [a,b]

se escribe la integral como

Page 38: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 54

§  Aplicando la cuadratura de Gauss-Legendre

o, utilizando la definición de f(z),

§  El error es

Page 39: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 55

Gauss-Hermite

§  n=0 (orden 1)

§  n=1

(orden 3) §  n=2

(orden 5)

Page 40: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 56

Gauss-Laguerre

§  n=0 (orden 1)

§  n=1

(orden 3) §  n=2 (orden 5)

Page 41: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 67

Convergencia

Page 42: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 68

Newton-Cotes

Compuesta Gauss-Legendre n=1 Compuesta Gauss-Legendre n=2

Compuesta Trapecio Compuesta Simpson

Gauss-Legendre

Ejemplo

Page 43: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 69

§  Newton-Cotes:

§  Gauss-Legendre:

§  Compuesta del trapecio: §  Compuesta de Simpson:

§  Compuesta de Gauss-Legendre:

Page 44: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 70

Newton-Cotes

Compuesta Gauss-Legendre n=1 Compuesta Gauss-Legendre n=2

Compuesta Trapecio Compuesta Simpson

Gauss-Legendre

Ejemplo

Page 45: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

INTEGRACIÓN NUMÉRICA· 71

Convergencia

§  NO tiene asegurada la convergencia: •  Fórmulas simples de Newton-Cotes para puntos

equiespaciados (aumentando n)

§  SI tiene convergencia asegurada: •  Cuadraturas simples de Gauss (aumentando n) •  Cuadraturas compuestas (aumentando m)

Page 46: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

Double integration

INTEGRACIÓN NUMÉRICA· 72

Consider the double integral The integration domain is represented y a set or points (grid) having coordinates (xi,j, yi,j) where 0 ≤ i ≤ n and 0 ≤ j ≤ m. Numerical double integration can be applied by analogy with analytical double integration, i.e. first integrate with respect to x, then integrate with respect to y. Exercise: Compute the double integral using the optimum number of Gauss points in order to obtain the exact result.

Page 47: Integración numérica · Integracion.pptx Author: Antonio Rodriguez Created Date: 6/18/2014 3:25:15 PM

Laboratori de Càlcul Numèric (LaCàN) Departament de Matemàtica Aplicada III

Universitat Politècnica de Catalunya (Barcelona) http://www-lacan.upc.es

FIN