Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Carlos Garcı́a-Gutiérrez
carlos.garciagutierrez@upm.es
¿Cuál es el error?
Lo hacemos con un polinomio de aproximación.
(x − x0 )(x − x1 ) 00
f (x ) = P1 (x ) + f (ξ(x ))
2!
(x − x0 − h) x − x0 (x − x0 )(x − x1 ) 00
f (x0 ) + f (x0 + h) + f (ξ(x ))
−h h 2!
Para algún ξ(x ) ∈ (x0 , x1 )
f (x0 + h) − f (x0 ) h 00
f 0 (x0 ) = − f (ξ)
h 2
Usamos
f (x0 + h) − f (x0 )
h
0
para aproximar el valor de f (x0 ) para valores pequeños de h con un error
acotado por
M|h|
2
00
donde M es una cota para |f (x )| con x ∈ [x0 , x0 + h]
Usar las diferencias hacia adelante para determinar log(1.8) con tres
valores diferentes de h
Aproximamos con
f (1.8 + h) − f (1.8)
h
log(1.9) − log(1.8)
≈ 0.5406722
0.1
El valor real es
d
log(x ) = 0.555̂
dx x =1.8
n
f 0 (x ) = f (xk )L0k (x )
X
k=0
(x − x0 ) · · · (x − xn ) (n+1)
+ Dx f (ξ(x ))
(n + 1)!
(x − x0 ) · · · (x − xn ) h (n+1) i
+ Dx f (ξ(x ))
(n + 1)!
n n
f n+1 (ξ(xj )) Y
f 0 (xj ) = f (xk )L0k (x ) +
X
(xj − xk )
k=0
(n + 1)! k=0
k6=j
(x − x1 )(x − x2 ) 2x − x1 − x2
L0 (x ) = L00 (x ) =
(x0 − x1 )(x0 − x2 ) (x0 − x1 )(x0 − x2 )
De forma similar
2x − x0 − x2 2x − x0 − x1
L01 (x ) = L02 (x ) =
(x1 − x0 )(x1 − x2 ) (x2 − x0 )(x2 − x1 )
2x − x1 − x2
f 0 (xj ) = f (x0 )
(x0 − x1 )(x0 − x2 )
2x − x0 − x2
+ f (x1 )
(x1 − x0 )(x1 − x2 )
2x − x0 − x1
+ f (x2 )
(x2 − x0 )(x2 − x1 )
2
1 Y
+ f (3) (ξj ) (xj − xk )
6 k=0
k6=j
Para j = 0, 1, 2 y ξk depende de xj
x1 = x0 + h x2 = x0 + 2h
1 3 1 h2
0
f (x0 ) = − f (x0 ) + 2f (x 1) − f (x2 ) + f (3) (ξ0 )
h 2 2 3
1 1 1 h2
f 0 (x1 ) = − f (x0 ) + f (x2 ) − f (3) (ξ1 )
h 2 2 6
1 1 3 h2
0
f (x2 ) = f (x0 ) − 2f (x1 ) + f (x2 ) + f (3) (ξ2 )
h 2 2 3
1 3 1 h2 (3)
f 0 (x0 ) = − f (x0 ) + 2f (x0 + h) − f (x0 + 2h) + f (ξ0 )
h 2 2 3
1 1 1 h2 (3)
0
f (x0 + h) = − f (x0 ) + f (x0 + 2h) − f (ξ1 )
h 2 2 6
1 1 3 h2 (3)
f 0 (x0 + 2h) = f (x0 ) − 2f (x0 + h) + f (x0 + 2h) + f (ξ2 )
h 2 2 3
Pero podemos centrar las tres en x0 moviendo el punto:
1 h2 (3)
f 0 (x0 ) = [−3f (x0 ) + 4f (x0 + h) − f (x0 + 2h)] + f (ξ0 )
2h 3
1 h2 (3)
f 0 (x0 ) = [−f (x0 − h) + f (x0 + h)] − f (ξ1 )
2h 6
1 h2 (3)
f 0 (x0 ) = [f (x0 − 2h) − 4f (x0 − h) + 3f (x0 )] + f (ξ2 )
2h 3
Pero la última es igual a la primera, ası́ que sólo nos quedan dos fórmulas
1 h2
f 0 (x0 ) = [−3f (x0 ) + 4f (x0 + h) − f (x0 + 2h)] + f (3) (ξ0 )
2h 3
con ξ0 ∈ (x0 , x0 + 2h)
Fórmula de tres puntos centrada
1 h2
f 0 (x0 ) = [−f (x0 − h) + f (x0 + h)] − f (3) (ξ1 )
2h 6
con ξ1 ∈ (x0 − h, x0 + h)
1 h4 (5)
f 0 (x0 ) = [f (x0 − 2h) − 8f (x0 − h) + 8f (x0 + h) − f (x0 + 2h)] + f (ξ)
12h 30
con ξ ∈ (x0 − 2h, x0 + 2h)
1 h4
f 0 (x0 ) = [−25f (x0 ) + 48f (x0 + h) − 36f (x0 + 2h) + 16f (x0 + 3h) − 3f (x0 + 4h)]+ f (5) (ξ)
12h 5
h2 h3 h4
f (x0 + h) = f (x0 ) + f 0 (x0 )h + f 00 (x0 ) + f 000 (x0 ) + f (4) (ξ1 )
2 3! 4!
h2 h3 h4
f (x0 − h) = f (x0 ) − f 0 (x0 )h + f 00 (x0 ) − f 000 (x0 ) + f (4) (ξ−1 )
2 3! 4!
con x0 − h < ξ−1 < x0 < ξ1 < x0 + h.
y se cancelan términos
1 h (4) i
f (x0 + h) + f (x0 − h) = 2f (x0 ) + f 00 (x0 )h2 + f (ξ(1)) + f (4) (ξ−1 ) h4
24
1 h2 h (4) i
f 00 (x0 ) = 2
[f (x0 − h) − 2f (x0 ) + f (x0 + h)] − f (ξ1 ) + f (4) (ξ−1 )
h 24
¿Qué hacemos con la parte final?
1 h2 (4)
f 00 (x0 ) = [f (x0 − h) − 2f (x0 ) + f (x0 + h)] − f (ξ)
h2 24
con x0 − h < ξ < x0 + h
Valor real
f 00 (x ) = (x + 2)e x f 00 (2.0) = 29.556224
Error de redondeo
1 h2
f 0 (x0 ) = [f (x0 + h) − f (x0 − h)] − f (3) (ξ1 )
2h 6
f (x0 + h) → e(x0 + h)
f (x0 − h) → e(x0 − h)
f 0 (0.900) = 0.62161
Usamos
f (0.900 + h) − f (0.900) − h
f 0 (0.900) ≈
2h
El error
ε h2
e(h) = + M
h 6
Su mı́nimo está en s
3 3ε
h=
M
Z b
2
e −x dx
a
Cuadratura numérica
Z b n
X
f (x ) dx → (xi+1 − xi )f (ξi )
a i=0
n n
f (n+1) (ξ(x ))
Z b Z bX Z bY
f (x ) dx = f (xi )Li (x ) + (x − xi ) dx
a a i=0 a i=0 (n + 1)!
n Z bYn
X 1
= ai f (xi ) + (x − xi )f (n+1) (ξ(x )) dx
i=0
(n + 1)! a i=0
con un error
n
Z bY
1
E (f ) = (x − xi )f (n+1) (ξ(x )) dx
(n + 1)! a i=0
polinomio interpolador
(x − x1 ) (x − x0 )
P1 (x ) = f (x0 ) + f (x1 )
(x0 − x1 ) (x1 − x0 )
Entonces
Z b Z x1
(x − x1 ) (x − x0 )
f (x ) dx = f (x0 ) + f (x1 ) dx
a x0 (x0 − x1 ) (x1 − x0 )
1 x1 00
Z
+ f (ξ(x ))(x − x0 )(x − x1 ) dx
2 x0
" #x1
(x − x1 )2 (x − x0 )2 h3 00
Z b
f (x ) dx = f (x0 ) + f (x1 ) − f (ξ)
a 2(x0 − x1 ) 2(x1 − x0 ) x0
12
(x1 − x0 ) h3
= [f (x0 ) + f (x1 )] − f 00 (ξ)
2 12
h3
Z b
h
f (x ) dx = [f (x0 ) + f (x1 )] − f 00 (ξ)
a 2 12
Vale para funciones con valores positivos
Z b Z x2
(x − x1 )(x − x2 ) (x − x0 )(x − x2 )
f (x ) dx = f (x0 ) + f (x1 )
a (x0 − x1 )(x0 − x2 )
x0 (x1 − x0 )(x1 − x2 )
(x − x0 )(x − x1 )
+ f (x2 ) dx
(x2 − x0 )(x2 − x1 )
Z x2
(x − x0 )(x − x1 )(x − x2 ) (3)
+ f (ξ(x )) dx
x0 6
x2 x4 (x + 1)−1
√
1 + x2 sin(x ) ex
La forma es Z b n
X
f (x ) dx ≈ ai f (xi )
a i=0
donde Z xn n
Z xn Y
(x − xj )
ai = Li (x ) dx = dx
x0 x0 j=0 (xi − xj )
j6=i
Theorem
Sea ni=0 ai f (xi ) la fórmula cerrada de (n + 1) puntos de Newton Cotes
P
h3
Z x1
h
f (x ) dx = [f (x0 ) + f (x1 )] − f 00 (ξ)
x0 2 12
con ξ ∈ (x0 , x1 )
h5
Z x2
h
f (x ) dx = [f (x0 ) + 4f (x1 ) + f (x2 )] − f (4) (ξ)
x0 3 90
con ξ ∈ (x0 , x2 )
3h5 (4)
Z x3
3h
f (x ) dx = [f (x0 ) + 3f (x1 ) + 3f (x2 ) + f (x3 )] − f (ξ)
x0 8 80
con ξ ∈ (x0 , x3 )
n=4
Z x4
2h 8h7 (6)
f (x ) dx = [7f (x0 ) + 32f (x1 ) + 12f (x2 ) + 32f (x3 ) + 7f (x4 )] − f (ξ)
x0
45 945
con ξ ∈ (x0 , x4 )
Los nodos usados en las fórmulas están todos dentro del intervalo (a, b)
Z b Z xn+1 n
X
f (x ) dx = f (x ) dx ≈ ai f (xi )
a x1 i=0
donde Z b
ai = Li (x ) dx
a
Theorem
Sea ni=0 ai f (xi ) la fórmula abierta de (n + 1) puntos de Newton-Cotes,
P
h3 00
Z x2
f (x ) dx = 2hf (x0 ) + f (ξ)
x−1 3
n=1
3h3 00
Z x2
3h
f (x ) dx = [f (x0 ) + f (x1 )] + f (ξ)
x−1 2 4
con x−1 < ξ < x2 .
n=2
14h5 (4)
Z x3
4h
f (x ) dx = [2f (x0 ) − f (x1 ) + 2f (x2 )] + f (ξ)
x−1 3 45
n=3
95h5 (4)
Z x4
5h
f (x ) dx = [11f (x0 ) + f (x1 ) + f (x2 ) + 11f (x3 )] + f (ξ)
x−1 24 144
R4 x
Aproximar, usando la regla de Simpson 0 e dx usando
una integral
dos integrales
cuatro integrales
Z 4
e x dx = e 4 − e 0 = 53.59815
0
Z 4
e x dx
0
Usando [0, 4] y h = 2
Z 4
2
e x dx ≈ (e 0 + 4e 2 + e 4 ) = 56.76958
0 3
Error: −3.17143 (muy grande)
Error: −0.26570
Error: −0.01807
Z b n/2 Z x
X 2j
f (x ) dx = f (x ) dx
a j=1 x2j−2
n/2 ( )
X h h5
= [f (x2j−2 ) + 4f (x2j−1 ) + f (x2j )] − f (4) (ξj )
j=1
3 90
entonces
n/2
n X n
min f (4) (x ) ≤ f (4) (ξj ) ≤ max f (4) (x )
2 x ∈[a,b] j=1
2 x ∈[a,b]
n/2
h5 X (4) h5 (4)
E (f ) = − f (ξj ) = − nf (µ)
90 j=1 180
Usando h = (b − a)/n
(b − a) 4 (4)
E (f ) = − h f (µ)
180
Theorem
Sea f ∈ C 4 [a, b], n par, h = (b − a)/n y xj = a + jh, para cada
j = 0, 1, . . . , n. Existe un µ ∈ (a, b) tal que la Regla de Simpson
Compuesta para n subintervalos puede ser escrita, con su término de error
como
" (n/2)−1 n/2
#
Z b
h X X b − a 4 (4)
f (x ) dx = f (a) + 2 f (x2j ) + 4 f (x2j−1 ) + f (b) − h f (µ)
a
3 180
j=1 j=1
Theorem
Sea f ∈ C 2 [a, b], h = (b − a)/n y xj = a + jh para cada j = 0, 1, . . . , n.
Entonces existe un µ ∈ (a, b) para el cual la Regla del Trapecio
Compuesta para n subintervalos se escribe, con su término de error
Z b n−1
h X b − a 2 00
f (x ) dx = f (a) + 2 f (xj ) + f (b) − h f (µ)
a 2 j=1
12
Theorem
Sea f ∈ C 2 [a, b], n par y h = (b − a)/(n + 2), y xj = a + (j + 1)h para
cada j = −1, 0, 1, . . . , n + 1. Entonces existe un µ ∈ (a, b) para el cual la
Regla del Punto Medio Compuesto para n + 2 subintervalos se escribe,
con término de error, como
Z b n/2
X b − a 2 00
f (x ) dx = 2h f (x2j ) + h f (µ)
a j=0
6
πh2 πh2
| sin µ| ≤ < 0.00002
12 12
Al ser h = π/n, esto implica que n = π/h y necesitamos
!1/2
π3 π3
< 0.00002 → n > ≈ 359.44
12n‘2 12(0.00002)
Para n = 18
Z π 8 9
π X jπ (2j − 1)π
X
sin x dx ≈ 2 sin +4 sin = 2.0000104
0 54 j=1
9 j=1
18
− cos(π) − (− cos(0)) = 2
Z π 17
π X jπ
sin x dx ≈ 2 sin + sin 0 + sin π = 1.9949205
0 36 j=1
18
f (xi ) = f˜(xi ) + ei , i = 0, 1, . . . , n
e(h) ≤ (b − a)ε
(
y 00 + 6y 0 + 25 = 0
y (x ) = e −3x sin 4x
y (0) = 0, y 0 (0) = 4
Estas funciones son comunes en ingenierı́a (RLC y sistemas mecánicos)
Vemos que son necesarios dos métodos diferentes para [0, 2] y [2, 4]
h5 (4)
Z b
f (x ) dx = S(a, b) − f (ξ) ξ ∈ (a, b)
a 90
con
h
S(a, b) = [f (a) + 4f (a + h) + f (b)]
3
!
h5
Z b
a+b a+b 1
f (x ) dx = S a, +S ,b − ˜
f (4) (ξ)
a 2 2 16 90
Asumimos que ξ ≈ ξ˜
De modo más preciso
˜
f (4) (ξ) ≈ f (4) (ξ)
El éxito de esta técnica depende de esta asunción: si esto es ası́, entonces
podemos igualar las dos integrales anteriores
!
a+b a+b 1 h5 h5
S a, S ,b − f (4) (ξ) ≈ S(a, b) − f (4) (ξ)
2 2 16 90 90
Entonces
h5 (4) 15 a+b a+b
f (ξ) ≈ S(a, b) − S a, −S ,b
90 16 2 2
Z !
b a+b a+b 1 h5
f (x ) dx − S a, −S ,b ≈ f (4) (ξ)
a 2 2 16 90
1 a+b a+b
≈ S(a, b) − S a, − S , b
15 2 2
Rb
Esto implica que S(a, (a + b)/2) + S((a + b)/2, b) aproxima a f (x )dx 15
veces mejor que el valor S(a, b).
Si
S(a, b) − S a, a + b − S a + b , b < 15ε
2 2
esperamos
Z
b
a+b
a+b
f (x ) dx − S a, −S ,b < ε
a 2 2
con
R = {(x , y )|a ≤ x ≤ b, c ≤ y ≤ d}