Método de Newton o Newton-Rapshson
Es un método numérico para resolver un problema de búsquedas de raíces del
polinomio.
Sea f debe pertener a C2 [a,b] (continua y derivable 2 veces).
x̄ ∈[a,b], una aproximación de P t.q f´( x̄) diferente de cero y IP- x̄ I debe ser
pequeña.
(𝒙− 𝒙)𝟐
. f(x)= f(x̄) + (x- x̄)f´( x̄) + f´´( ε(x)) polinomio de Taylor con x< ε(x) < x̄
𝟐
P se aproxima x̄ - [f(x̄)/ f´( x̄)]
Pn = Pn-1 – [f(Pn-1)/f´(Pn-1)] , n≥1
Método de Newton
Entradas: p0 , tolerancia tol, Numero max de iteraciones N0,, la función
Salida: solución aproximada p o un mensaje que diga que no se pudo encontrar
la aproximación
Paso1: tome i=1
Paso2: mientras i menor o igual N0 haga paso 3 al 6
Paso 3: tome p=p0 – [f(p0) /f´(p0)]
Paso4: si Ip- p0 I < tol
Salida (p)
Paso 5: tomar i=i+1
Paso 6 tome p0=p
Paso7: salida ( no se pudo resolver con esas iteraciones, N0)
Ejercicio f(x)= cox - x p0=Pi/4= 0.785398
. f´(x)= - senx -1 , . f´(0.785398)= - sen(0.785398) -1 =
N0= 4 iteraciones , tol: 0,001
p=p0 – [f(p0) /f´(p0)]
P1= 0.785398 – [ cos (0.785398)-( 0.785398)/-sen(0.785398)-1]
P2=0.739536– [ cos (0.739536)-( 0.739536)/-sen(0.739536)-1]
P3=0.739082– [ cos (0.739082)-( 0.739082)/-sen(0.739082)-1]
P4=0.739085– [ cos (0.739085)-( 0.739085)/-sen(0.739085)-1]
n Pn Ip- p0 I
0 0.785398
1 0.739536 0.045862
2 0.739082 0.000454
3 0.739085 0.000003
4 0.739085 0
syms x
f=cos(x)-x
p1=pi/4
format long
for j=1:4
p=p1-
(eval(subs(f,x,p1)))/eval(subs(diff(f),x
,p1));
q(j,1)=p
j=j+1;
p1=p;
end
Diferencias divididas
Sea Pn : el n-esimo polinomio de Lagance
Pn(x)= a0 +a1(x-x0) + a2(x-x0)(x-x1)+ …+ an(x-x0)(x-x1)(x-x2)…(x-xn-1)
Pn(xo)= a0 =f(x0)
Pn(x1)= a0 +a1(x1-x0) despejamos a1= (Pn(x1) – a0 )/ x1 -x0
. a1= f(x1) - f(x0) / x1 -x0
. f[xi] =f(xi)
Primera diferencia dividida de f respecto a xi , xi+1
Se denota f [xi , xi+1 ] = f [xi+1 ] – f[xi] / xi+1 - xi
La segunda
Se denota f[xi , xi+1 , xi+2 ]= f [xi+1, xi+2 ] – f[xi, xi+1] / xi+2 - xi
K-esima diferencia dividida
Se denota f[xi , xi+1 , xi+2, …, xi+k-1, xi+k ]= f [xi+1, xi+2,…., , xi+k ] – f[xi, xi+1,…..xi+k-1] /
xi+k - xi
Ejercicio: Hallar los coeficientes del polinomio de Lagrange, utilizando el método
de las diferencias dividas P4(x)
i xi f(xi) f [xi , xi+1 ] f[xi , xi+1 , xi+2 ] f[xi , xi+1 ,xi+2, xi+3 ] f[xi , xi+1 ,xi+2, xi+3, xi+4 ]
0 1 0.7651
1 1.3 0,6200 -0.4836
2 1.6 0.4554 -0.5486 -0.1083
3 1.9 0.2818 -0.5786 -0.0500 0.0647
4 2.2 0.1103 -0.5716 0.0116 0.0684 0,0031
P4(X)= 0.7651- 0.4836(x-1) -0.1083(x-1)(x-1.3)+ 0.0647(x-1)(x-1.3)(x-1.6)+
0,0031(x-1)(x-1.3)(x-1.6)(x-1.9)
______________________________________________________________--
Integración numérica
Regla del trapecio
Regla del trapecio:
𝑏
∫ 𝑓(𝑋)𝑑𝑥 = ((𝑏 − 𝑎) ∗ (𝑓(𝑎) + 𝑓(𝑏)))/2
𝑎
Error: (b-a)3 *f´´ (ε) /12, a ≤ε≤b
Ejercicio: 15/4 = 3.75
2
∫1 𝑥 3 𝑑𝑥 = ((2 − 1) ∗ (1 + 8))/2=4.5, ε =1.5, error=0.75
Formula del trapecio compuesto
𝑏
∫ 𝑓(𝑥) 𝑑𝑥 =
𝑎
= ℎ 𝑏−𝑎
(f0 +2f1 +2f2 +…+2fm-1 +fm) - 12𝑛2 * f ´´(ε)
2
Ejercicio
2
Calcular ∫1 𝑥 3 𝑑𝑥 con el método del trapecio compuesto
. n=4.
. h=(b-a)/n= (2-1)/4=1/4=0.25
. f´´ (x)= 6x
a ≤ε≤b , ε=1.5
0.25/2 (13 + 2*(1.25)3 + 2(1.5)3 +2(1.75)3 +(2)3 ) - (2-1)/12(4)2 * 6(1.5) = 3.75
Nota: Cuando n es par el grado de precisión es n+1 aunque el polinomio de
interpolación es máximo de grado n.
En caso de que n sea impar el grado de precisión es n por tanto se puede tener
las siguientes formulas.
Formulas cerradas comunes de Newton- Cotes
. n=1, regla del trapecio
𝑥1
∫𝑥0 𝑓(𝑥) 𝑑𝑥 = h/2 [f(x0)+f(x1)] - h3/12 f’’ (ε), x0< ε<x1, h=x1-x0/1
. n=2, regla de Simpson
𝑥2
∫𝑥0 𝑓(𝑥) 𝑑𝑥 = h/3 [f(x0)+4f(x1)+f(x2) ] – h5/90 f(4) (ε), x0< ε<x2, h=x2-x0/2
. n=3, regla de 3/8 de simpson
𝑥3
∫𝑥0 𝑓(𝑥) 𝑑𝑥 = 3h/8 [f(x0)+3f(x1)+3f(x2)+f(x3) ] –3 h5/80 f(4) (ε), x0< ε<x3,
h=x3-x0/3
Formulas abiertas de Newton- Cotes
. n=0 , Regla del punto medio
𝑥1
∫𝑥−1 𝑓(𝑥) 𝑑𝑥 = 2h f(x0) + h3/3 f ’’ (ε) x-1< ε<x1 , h=x1 - x-1
. n=1
𝑥2
∫𝑥−1 𝑓(𝑥) 𝑑𝑥 = 3h/2 [f(x-1 )+f(x2)]+ 3/4h3 f ’’ (ε) x-1< ε<x2 h = x2 -x-1 /1
. n=2
𝑥3
∫𝑥−1 𝑓(𝑥) 𝑑𝑥 = 4h/3 [ 2f(x-1) -f(x1) + 2f(x2)] +14/45 h5 f ’’ (ε) x-1< ε<x3
h = x3 -x-1 /2
. n=3
𝑥4
∫𝑥−1 𝑓(𝑥) 𝑑𝑥 = 5h/24 [ 11f(x-1) +f(x1) + f(x2)+11f(x3)] +95/144 h5 f (4) (ε) x-1< ε<x4
h = x4 -x-1 /3
%regla del trapecio
function i=trapecio(x0,x1,fun)
x=sym('x');
h=x1-x0;
fun=str2sym(fun);
i=(h/2)*eval(subs(fun,x,x0)+subs(fun,x,x
1))-
h^3/12*eval(subs(diff(fun,2),x,(x0+x1)/2
));
end
Ejercicio: calcular la siguiente integral utilizando los métodos anteriores
1
∫ 𝑥 2 ∗ 𝑒 −𝑥 𝑑𝑥 =
0
Teorema: Sea f perteneciente a clase C4 [a,b], n par, h=(b-a)/n
Xj = a+jh para j=0,…n
Existe µ perteneciente al intervalo (a,b) tal que la regla compuesta de Simpson
para n subintervalos puede escribirse con su término error como
𝑛
𝑏 −1 𝑛/2
∫𝑎 𝑓(𝑥) 𝑑𝑥 = h/3 [ f(a)+ 2 ∑𝑗=1 𝑘 + 4 ∑𝑗=1 𝑤 + 𝑓(𝑏)] – ((b-a)/180 )h4 f(4) (µ)
2
. k= f(x2j) w= f(x2j-1)
2
Ejercicio: ∫1 𝑥. 𝐿𝑛 𝑥 𝑑𝑥 =
. n=4, h=1/4
𝑛
−1 𝑛/2
0.25/3 [ 2 ∑𝑗=1 𝑘 + 4 ∑𝑗=1 𝑤 + 2𝐼𝑛2]
2
. f(x2) , x2 =1+2(1/4)=1,5, f(1,5)=1.5 In 1.5= 0,6081
. f(x1), x1=1+1(1/4)=1,25, f(1,25)=1,25 In1,25=0,2789, f(x3), x3=1+3(1/4)=1.75,
. f(1.75)=1.75In1.75=0.9793
𝑛
−1 𝑛/2
0.25/3 [ 2 ∑𝑗=1 𝑘 + 4 ∑𝑗=1 𝑤 + 2𝐼𝑛2]
2
0.25/3 [2(0,6081) + 4(0,2789+0,9793) +2In2 ]=0.6362
((b-a)/180 )h4 f(4) (µ)= ((1/180 )(0,25)4 2(1,5)-3 =1.28*10-5
. f= x In x
. f´= In x+x(1/x)= Inx +1
. f´´ = 1/x= x-1
. f´´´= -1x-2
. f(4) =2x-3
0.6362- 1.28*10-5= 0.6361
Teorema
Sea f perteneciente a clase C2 [a,b], n par, h=(b-a)/n+2
Xj = a+(j+1)h para j=0,…n
Existe µ perteneciente al intervalo (a,b) tal que la regla compuesta del punto
medio para n+2 subintervalos puede escribirse con su término error como
𝑏 𝑛/2
∫𝑎 𝑓(𝑥) 𝑑𝑥 = 2h ∑𝑗=0 𝑤 + ((b-a)/6)h2 f´´( µ)
w= f(x2j)
2
Ejercicio: ∫1 𝑥. 𝐿𝑛 𝑥 𝑑𝑥 =
. n=4, h=1/6
2(1/6) [0.179+ 0,6081+1.105] +
0.6307+0.0030=0.6337
f(x0), x0 =1 +(1/6)=1.166, 1.166 In 1.166=0.179
, f(x2), x2= 1+3(1/6)=1.5 1.5 In 1.5=0,6081
, f(x4), x4= 1+(5/6)=1.83 1.83 In 1.83= 1.105
((b-a)/6)h2 f´´( µ)= (1/6)(1/6)2* (1.5)-1= 0.0030