Está en la página 1de 13

Mag.

Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 1


II. SOLUCIN NUMRICA DE ECUACIONES

Existen muchos mtodos numricos para resolver ecuaciones f(x) = 0, de los
cuales veremos algunos de ellos. Actualmente hay calculadoras cientficas que
muy fcilmente realizan este trabajo.

TEOREMA (del valor intermedio). Si f es continua en [a, b] y k es un
nmero entre f(a) y f(b) - ce<a, b> / f(c) = k

COROLARIO. Si f es continua en [a, b] y f(a) y f(b) tienen signos diferentes
- ce<a, b> / f(c) = 0.

2.1. MTODO DE LA BISECCIN
Sea la ecuacin f (x) = 0 . Considrese las condiciones de que:
1) f sea continua en [a,b] y f(a) . f(b) < 0 (o que f(a) y f(b) tienen signos
diferentes)
2) Existe una nica raz x
r
e [a,b] de f(x) = 0
Por el corolario del teorema del valor intermedio, existe un x
r
e [a,b] tal
que
r
f (x ) 0 = .
Ahora, generamos una sucesin {x
i
} que converja a x
r
de la siguiente
manera:
Sean a
o
= a , b
o
= b y
0
0 0
a + b
x =
2

si f(a
o
). f(x
o
) < 0 hacemos

1 0
1 0
a a
b x
=
=

sino hacemos:
1 0
1 0
a x
b b
=
=

y calculamos

1 1

1
+
a b
=
x
2



2 1
1 1
2 1
2 1
2 1
a a
Si f (a ) f (x ) 0
b x
a x
sino
b b
=
<
=
=
=


Luego, calculamos
2 2
2
a b
x
2
+
=
As continuamos sucesivamente hasta generar la sucesin
{ }
i
x donde
a

b
x
r
x
0
x
1
x
2
Y
b
1
=

X
Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 2
i i
i
a b
x
2
+
= tal que
i
f (x ) ~ 0

Computacionalmente, esto es equivalente a tomar uno de los siguientes controles:
i)
i
tolerancia f (x ) <
ii)
i i
tolerancia x x

<
1

iii)
i i
i
x x
tolerancia
| x |

<
1

ALGORITMO
ENTRADA: a, b, n, tol
para i=1,., n hacer

a b
x
2
+
=
si
| x a |
tol
| x |

< entonces
SALIDA: La solucin aproximada es: x
Parar
fin_si
si f(a)*f(x) < 0 entonces
b = x
sino
a = x
fin_si
fin_para

NOTA. En el seudocdigo, tol y n representan la tolerancia de precisin y el
nmero de iteraciones como mximo respectivamente.

ALGORITMO DE LA BISECCIN MEJORADO
ENTRADA: a, b, n, tol
para i=1,., n hacer
b a
x a
2

= +
| x a |
er
| x |

=
si er tol < entonces
Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 3
SALIDA: La solucin aproximada es: x
Parar
fin_si
si f(a)*f(x) < 0 entonces
b = x
sino
a = x
fin_si
fin_para

OBSERVACIN. La frmula del mtodo de la posicin falsa es
f (b)(b a)
x b
f (b) f (a)

o
a f (b) bf (a)
x
f (b) f (a)



Ejemplo. Resolver numricamente
x
e 2 0 = en [ , ] 0 2 con
i
f (x ) 0.01 tol < = y
n 20 = . Los resultados son
i a
i
x
i
b
i
f(x
i
) |x
i
x
i-1
| / |x
i
|
0 0 1 2 0.7182 -
1 0 0.5 1 -0.3512 1
2 0.5 0.75 1 0.1170 0.33333
3 0.5 0.625 0.75 -0.1317 0.20000
4 0.625 0.6875 0.75 -0.0112 0.09090
5 0.6875 0.7187 0.75 0.0518 0.04348
6 0.6875 0.7031 0.7187 0.0200 0.02223
7 0.6875 0.6953 0.7031 0.0043 0.01123

La grafica de la funcin
x
f (x) e = 2 en MATLAB es

Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 4
La grfica de la funcin
x
f (x) e = 2 en el software MATHEMATICA es

0.5 1 1.5 2
-1
1
2
3
4
5

ANLISIS DEL ORDEN DE CONVERGENCIA
Sea la sucesin {x
i
} que aproxima a la raz x
r
de f(x) = 0, en el intervalo
[a, b]. A continuacin, determinamos su orden de convergencia
a s x
r
s b
a
i
s x
i
s b
i
y a
i
s x
r
s b
i

i i
i
a b
x , i 0,1, 2,
2
+
= =

Considere que f(a
i
) . f(x
i
) < 0 a
i+1
= a
i
y b
i+1
= x
i

Luego
0 0 0 0
1 1 0 0 0
a b b a
b a x a a
2 2
+
= = =
0 0 1 1 1 1
2 2 1 1 1
2
b a a b b a
b a x a a
2 2 2
+
= = = =
Inductivamente:
0 0
i i
i
b a
b a
2

=
Ahora
0 0 i i
r i i i i
i i 1
| b a | a b 1
| x x | b | b a |
2 2 2
+
+
s = =
0 0
r i
i 1
| b a |
| x x |
2
+

s

Luego obtenemos
Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 5
0 0
r i 1
i 2
| b a |
| x x |
2
+
+

s

0 0
i 2
0 0
i 1
b a
r i 1
2
b a
i i
r i
2
x x
lim lim
x x
+
+

i
1 1
lim
2 2

= =

Luego, el mtodo de la biseccin converge linealmente.

2.2. MTODO DE LAS APROXIMACIONES SUCESIVAS
(O PUNTO FIJO)
DEFINICION. "p" se le llama punto fijo de g: g(p) =p
Ejemplo. g(x) = x
3

g(0) = 0
g(1) = 1
g(-1) = -1
Luego, la funcin g tiene 3 puntos fijos.

De la ecuacin f(x) = 0 se obtiene x = g(x)

Elegimos una aproximacin inicial x
o
de la raz x
r

Generamos la sucesin:
x
1
= g(x
o
)
x
2
= g(x
1
)

x
i
= g(x
i-1
)

Si x
i
x
r
y g es continua x
r
= lim x
i
= lim g(x
i-1
) = g(lim x
i-1
) = g(x
r
)
x
r
= g(x
r
)

TEOREMA Si
1) g : [a,b] c es continua sobre [a, b]
2) R
g
c [a,b], R
g
es el rango de g
3) |g'(x)| s k < 1 , xe <a, b>
4) x
o
e [a,b] - un nico punto fijo x
r
e [a, b] de g tal que la sucesin
{x
i
= g(x
i-1
)} converge a x
r
.

COROLARIO
n
n r 1 0
k
x x x x
1 k
s



Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 6
PRUEBA DEL TEOREMA

a) Existencia: Si g(a) = a g(b) = b , la existencia es obvia.
Supongamos que g(a) = a y g(b) = b , tomemos g(a) > a y g(b) < b.
Definamos h(x) = g(x) - x
h es continua en [a, b] y h(a) = g(a) - a > 0 , h(b) = g(b) b < 0. Entonces
h(a). h(b) < 0
Luego, por el teorema del valor intermedio, - x
r
e <a, b> h(x
r
) = 0
g(x
r
) = x
r
. Por lo tanto, x
r
es un punto fijo de g.

b) Unicidad: Supongamos que p = q son puntos fijos de g en <a, b>
por el teorema del valor medio, - e <a, b> tal que
|p - q| = |g(p) - g(q)| = |g'()| |p - q| s k|p - q| <|p - q|
| p - q| < |p - q|
Esto es absurdo. Por consiguiente, el punto fijo es nico

c) Convergencia: Segn la hiptesis 3) y el teorema del valor medio,
con a, b e
|x
i
- x
r
| = |g(x
i - 1
) - g(x
r
) |= |g'()| |x
i-1
- x
r
| s k|x
i-1
- x
r
|
|x
i
- x
r
| s k|x
i-1
- x
r
|
Al aplicar inductivamente esta desigualdad, nos da
|x
i
- x
r
| s k|x
i-1
- x
r
| s k
2
|x
i-2
- x
r
| s ... s k
i
|x
o
- x
r
|
|x
i
- x
r
| s k
i
|x
o
- x
r
|

Como k < 1,
( )
i
i r 0 r
i i
lim x x lim k x x 0

s =
i r
i
lim x x

=

PRUEBA DEL COROLARIO
Para m > i > 1
|x
m
- x
i
| = |x
m
- x
m-1
+ x
m-1
- ... + x
i+1
- x
i
|
s|x
m
- x
m-1
| + |x
m-1
- x
m-2
| + ...+ |x
i+1
- x
i
|
s k
m-1
|x
1
- x
o
| + k
m-2
|x
1
- x
o
| + ...+ k
i
|x
1
- x
o
|
= k
i
(1+k+k
2
+...+ k
m-1-i
) |x
1
- x
o
|
Luego
i j i
r i m i 1 0 1 0
m
j 0
1
x x lim x x k x x k k x x
1 k

=
= s =



ORDEN DE CONVERGENCIA DEL METODO DE APROXIMACIONES
SUCESIVAS
f(x) = 0 x = g(x)

Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 7
1) Para g'(x
r
) = 0
Aplicamos el teorema del valor medio
e
n+1
= |x
n+1
- x
r
| = |g(x
n
) - g(x
r
)|= |g'(
n
) || x
n
- x
r
| = |g'(
n
)| e
n

n
est entre x
n
y x
r
como x
n
x
r

n
x
r

Luego
n 1
n r
n n
n
e
lim lim g ( ) g (x ) 0
e
+

' ' = = =
Por lo tanto, la convergencia es lineal o de orden 1

2) Para g'(x
r
) = 0
Aplicando el polinomio de Taylor
g ( ) 2
r r r r
2
g(x) g(x ) g (x )(x x ) (x x )
''
' = + +
Como g(x
r
) = x
r
, g'(x
r
) = 0
g ( ) 2
r r
2
g(x) x (x x )
''
= +
n
g ( )
2
n 1 n r n r
2
x g(x ) x (x x )
''
+
= = +
n
g ( )
2
n 1 r n r
2
x x (x x )
''
+
=
r
n 1 n
n n
n
g (x )
e g ( )
lim lim 0
e 2 2
+

''
''
= = =
Luego, el orden de convergencia es 2 o converge cuadrticamente.

2.3. MTODO DE NEWTON-RAPHSON
Sea la ecuacin f(x) = 0. Considrese que la funcin f es diferenciable alrededor
de la raz x
r
de f(x) = 0.
Generamos la sucesin {x
i
} con los puntos de interseccin al eje x de la recta
tangente a la grfica de la funcin f.

De la figura, la ecuacin de la recta tangente, L
T
, a f es
i 1 i 1 i 1
y f (x ) f (x ) (x x )

' =
Como (x
i
,0) e L
T

i 1 i 1 i i 1
0 f (x ) f (x )(x x )

' =
(x
i -1
,f(x
i -1
))
x
i -1
x
i
x
i +1
x
r
Y
X
f
L
T
Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 8

i 1
i i 1
i 1
f (x )
x x
f (x )

=
'
(*)

ALGORITMO DE NEWTON
ENTRADA: x
o
, n, tol
Para k = 1, 2, ... , n hacer

0
0
0
f (x )
x x
df (x )
=
Si
0
| x x |
tol
| x |

< entonces
SALIDA: La solucin aproximada es: x
0

parar
x
o
= x
fin

OBSERVACIN. Para generar la sucesin {x
i
} con la frmula (*) se necesita un
punto inicial x
o
.

Ahora analizaremos su orden de convergencia.
Si
f (x)
g(x) x
f (x)
=
'

entonces la frmula (*) es equivalente a x
i
= g(x
i-1
).

Si x
r
es la raz de la ecuacin f(x) = 0, entonces f(x
r
) = 0
Adems:
2
2 2
[ f (x) - f(x) f "(x) f(x) f "(x) ]
g (x) = 1 - =
[f (x) [f (x) ] ]
'
'
' '

r r
r
r
f (x ) f "(x )
g (x ) = = 0
[f (x )]
'
'


Tambin se obtiene el resultado
r
r r r
r
f ( )
x
g( ) = - = x
x x
f ( )
x
'
g(x
r
) = x
r


Luego, al aplicar el teorema de Taylor a la funcin g alrededor de x
r
se tiene
g(x) = g(x
r
) + g'(x
r
) (x-x
r
) +
2
r
g " ( (x))
(x - )
x
2


g(x) = x
r
+ 0 +
2
r
g " ( (x))
(x - )
x
2


Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 9
De la relacin anterior se tiene
x
i+1
= g(x
i
) = x
r
+
2 i
i r
g " ( )
( - x )
x
2


i 1 r
i
2
i r
x x
g ( )
2
x x
+
''
=


Como los
i
estn entre los x
i
y x
r
, entonces
i r
i
lim x

=
Por lo tanto,
i 1 r
r
2
i
i r
x x
g (x )
lim 0
2
x x
+

''
= =


Por consiguiente este mtodo converge cuadrticamente.

Ejemplo. Resolver x - 0.2 sin x - 0.5 = 0 con x
o
= 1 y
i
< 0.0001
x
i
= x
i-1
- (x
i-1
- 0.2 sin x
i-1
- 0.5) / (1 - 0.2 cos x
i-1
)

i x
i
f(x
i
) e
i
= |x
i
- x
i-1
|
i
= e
i
/ |x
i
|
0 1.00000000 0.33170580 - -
1 0.62810730 0.01058443 0.37189270 0.59208467
2 0.61547930 0.00000932 0.01262799 0.02051734
3 0.61546817 0.0000000004 0.11134x10
-4
0.18091x10
-4


La grafica de la funcin f (x) x . sinx . = 0 2 0 5 con el software
MATHEMATICA es

0.5 1 1.5 2
-0.5
-0.25
0.25
0.5
0.75
1
1.25


2.4. MTODO DE LA SECANTE
En el mtodo de Newton Raphson, al reemplazar
i-1
i-1 i-2
i-1 i-2
f(x ) - f (x )
f ( )
x
x - x
' ~
Se obtiene que
i-1 i-2 i-1
i i 1
i-1 i-2
(x - x ) f(x )
x x
f(x ) - f(x )

=
Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 10

Para generar la sucesin {x
i
} se necesitan dos puntos iniciales x
o
y x
1


ALGORITMO DE LA SECANTE
ENTRADA x0, x1, n, tol
Para k = 2,3, ... , n hacer

f (x1)(x1 x0)
x x1
f (x1) f (x0)


Si
x1 x0
tol
x1

< entonces
SALIDA: La solucin aproximada es: x
parar
fin_si
x0 = x1
x1 = x
fin_para

Ahora analizaremos su orden de convergencia.
Sea x
r
la raz de f(x) = 0 f(x
r
) = 0
Sea e
i
= x
r
- x
i
,
Entonces
e
i+1
= x
r
- x
i+1
= x
r
-
i i-1 i i i -1 i -1 i
i r
i i-1 i i-1
( - ) f( ) f( ) - f( )
x x x x x x x
- = -
x x
f( ) - f( ) f( ) - f( )
x x x x
| |
|
\ .


i r i-1 i-1 r i
i i-1
f( ) ( - ) - f( ) ( - )
x x x x x x
=
f( ) - f( )
x x


i i-1
r i-1 r i
r i r i-1
i i-1
f ( ) f ( )
x x
( - ) ( - ) -
x x x x
- -
x x x x
=
f ( ) - f( )
x x
| |
|
\ .


i-1 i
i r i-1 r
i r i-1 r
i i-1
f ( ) - f( ) f ( ) - f( )
x x x x
- +
e e
- -
x x x x
=
f( ) - f( )
x x
(
(



i r i-1 r
i r i-1 r
i i-1
i i-1
i i-1
i i-1
f ( ) - f( ) f( ) - f( )
x x x x
-
- -
x x x x

e e
-
x x
=
f( ) - f( )
x x
-
x x
(
(
(
(
(


Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 11
i
i 1 i i 1
i
f" ( )
e e e
f' ( )
+
| |
~
|
\ .

Como c
i
= |e
i
| c
i+1
~ c
i
c
i-1

i
i
f "( )

f '( )

q

Sea
i
i
f" ( )
c
f ' ( )

=
q
c
i+1
~ c c
i
c
i-1
(1)

Consideremos que el orden de convergencia de este mtodo es r
i 1 i
i 1
r r
i i
i
i r
x x
lim lim A 0
x x
+
+

c
= = =
c


i 1
r
i
A, para i grande
+
c
=
c

c
i+1
~ A c
i
r
(2)
c
i
~ A c
i-1
r


1
r
1
r
i 1 i
1
A

c ~ c (3)

Al reemplazar (3 ) en (1 ), se tiene
1
r
1
r
1
i 1 i
c
A
+
+
c ~ c (4)

Luego de (2) y (4) se obtiene que
1
r
c
A
A
~ y
1
1 r
r
+ = r r =
2
1 0
1 5
r 1.6
2
+
= ~

Por lo tanto, el mtodo de la secante tiene un orden de convergencia r ~ 1.6

Ejemplo Resolver x - 0.2 sin x - 0.5 = 0

Solucin

x
i
= x
i-1
-
i-1 i-2 i-1 i-1
i-1 i-2 i-1 i-2
( - ) ( - 0.2 sin - 0.5 )
x x x x

( - ) - 0.2 (sin - sin )
x x x x


Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 12
i x
i
i i i 1
e x x

= i i 1
i
x x
i
x

o =
0
1
2
3
4
5
0
1
0.6011741149
0.6150404357
0.6154685889
0.6154681695
-
1
0.3988258851
0.0138663208
0.000428153
0.42x10
-6

-
1
0.6634116061
0.0225453808
0.6957x10
-3

0.68x10
-6


2.5. MTODO DE STEFFENSEN
Es un mtodo de punto fijo o aproximaciones sucesivas, cuyo orden de
convergencia es 2. Su frmula es:
2
k 1
k k 1
k 1 k 1 k 1
[f (x )]
x x
f[x f (x )] f (x )


=
+

Se necesita un punto inicial: x
0
.

2.6. MTODO DE LAGUERRE
Se aplica a ecuaciones polinmicas

n n 1
n n 1 1 0
f (x) a x a x a x a 0

= + + + + =

El orden de convergencia de este mtodo es 3. Su algoritmo para generar la
sucesin {x
i
} es el siguiente
i i 1
1
x x
C

= +
donde:
2
A (n 1)(nB A )
C
n

=
2 i 1
i 1
f (x )
B A
f (x )

''
=
i 1
i 1
f (x )
A
f (x )

'
=
El signo de C se escoge de manera que su valor absoluto sea lo ms grande.

ALGORITMO DE LAGUERRE
Resuelve la ecuacin polinmica:
n n 1
n n 1 1 0
a z a z a z a 0

+ + + + =
ENTRADA: n, (a
i
; i = 0, 1, ..., n), x
o
, M, tol
Para k = 1, 2, ..., M hacer
Mag. Jube Portalatino Zevallos Mtodos Numricos con C++ y MATLAB 13
p = a(n)
q = 0
r = 0
Para j = n-1, n-2, ..., 0 hacer
r = x
o
r + q
q = x
o
q + p
p = x
o
p + a(j)
fin
A = - q / p
B = A
2
- 2 r / p

2
C [A (n 1)(nB A )]/ n =
Se elije el mayor valor C
x
1
= x
o
+ 1 / C
SALIDA: k , x1
Si |x
1
- x
o
|/ | x1|< tol entonces parar
x
o
= x
1

fin

En este algoritmo p = f(x
o
) , q = f'(x
o
) y
0
r f "(x ) =

También podría gustarte