Documente Academic
Documente Profesional
Documente Cultură
ECUACIONES NO LINEALES
MTODOS ITERATIVOS: MTODO GRFICO Y MTODO DE BISECCIN
RACES DE ECUACIONES NO LINEALES
Las soluciones de una ecuacin f(x)=0, se llaman ceros o races de f(x). En esta sesin
estudiaremos el mtodo grfico y el mtodo de Biseccin para obtener las races reales de
ecuaciones no lineales.
El problema general es que dada una funcin real f : IR
IR , encontrar los valores de x para
los cuales f(x)=0. Es decir solucionar ecuaciones trascendentales como por ejemplo:
3
1) f ( x) e x 2 x 1 0
2) g ( x)
x 2 1 tan( x) 0 3) ( x) x2 ln( x) sen( x) = 0
Definicin.- (Cero de una funcin)
Supongamos que f(x) es una funcin continua. Cualquier nmero r tal que f(r)=0 se llama raz
de la ecuacin f(x)=0; tambin se dice que r es un cero de la funcin f(x).
MTODO GRFICO
Este mtodo nos permite estimar los valores de las races.
PRIMERA FORMA
Consiste en trazar las grfica de la funcin asociada f donde puedan reconocerse si existen
valores r IR tal que f (r ) 0
Ejemplo: Hallar los ceros de la funcin real: f ( x) x 2 2 x e x senx 2
Resolucin
Del grfico se observa que hay tres cortes del eje X con la funcin f. Esto significa que la
ecuacin f(x)=0 tiene tres races.
Si tomamos la funcin f(x)=0, es decir f ( x) x 2 2 x e x senx 2 0 y la graficamos,
obtendremos las tres aproximaciones.
i) Si f(x)=0, entonces x 2 2 x e x senx 2 0
%Ploteo de f con MATLAB
x=-3:0.05:4;
y=x.^2-2*x+exp(x).*sin(x)-2;
plot(x,y)
xlabel('EJE X')
ylabel('EJE Y')
title('f(x)=x.^2-2*x+exp(x).*sin(x)-2')
grid on
gtext('raiz 1')
gtext('raiz 2')
gtext('raiz 3')
Las races se localizan en los intervalos: I 1 [ 1 ; 0] ; I 2 [1 ; 2] ; I 1
Races aproximadas de la ecuacin f(x)=0 son:
Para el intervalo I 1 [ 1 ; 0] la aproximacin es Raiz1=-0.8224
Para el intervalo I 2 [1 ; 2] la aproximacin es Raiz2=1.1707
Para el intervalo I 1 [3 ; 4] la aproximacin es Raiz3=3.218
[3 ; 4]
MTODOS NUMRICOS
SEGUNDA FORMA
Consiste en la transformar la funcin asociada f en la forma f1 ( x) f 2 ( x) , luego f1 y f2 se
grafican en el mismo sistema de coordenadas donde las races de f son las intersecciones de
las grficas.
Ejemplo: Estimar los valores de las races de f ( x) x 2 2 x e x senx 2 0
Resolucin
i) Descomponemos la funcin en dos funciones f1 y f2 haciendo x 2 2 x e x senx 2 0 ,
entonces
x.sen( x) 2 2 x x 2 , donde por ejemplo obtenemos f1 e x .sen( x) ; f 2 2 2 x x 2 .
ii) Graficamos las funciones f1 y f2 observando del grfico la interseccin de f 1 y f2 la cual nos
dar
las soluciones aproximadas de las tres races.
%grfica con MATLAB
x=-2:0.05:4;
f1=exp(x).*sin(x);
f2=2+2*x-x.^2;
plot(x,f1,'b',x,f2,'r')
xlabel('EJE X')
ylabel('EJE Y')
title('MTODO GRFICO')
grid on
gtext('raiz 1')
gtext('raiz 2')
gtext('raiz 3')
gtext('f1=exp(x).*sin(x)')
gtext('f2=2+2*x-x.^2')
PROPOSICIN (Existencia)
Sea f : IR
IR , una funcin continua en [a ; b], si f (a). f (b)
una raz en [a ; b]. Es decir r [ a , b ] tal que f (r ) 0
MTODOS NUMRICOS
LOCALIZACIN
Problema. Determinar la solucin a la ecuacin
(1)
f ( x) 0 ; x
a; b
Consideremos la hiptesis H 1 :
La funcin f es continua en [a0 ; b0 ]
y
f (a0 ) f (b0 ) 0
La hiptesis H 1 verificada, el mtodo considera como aproximacin de la solucin el punto
a0 b0
medio del intervalo de localizacin c
, luego se toma la siguiente decisin:
2
1.- Si f (a0 ) f (c) 0 , el nuevo intervalo de localizacin es [a0 ; c] en caso contrario ser el
intervalo [c ; b0 ] , efectuando este razonamiento en forma reiterada se obtiene la sucesin {xi }
que converge a x* solucin de la ecuacin (1) de la forma:
ITERACIONES
x* [ai ; bi ] ; i 0 ; 1; 2;
ai bi
xi
( punto medio )
2
ai 1 ai
f (ai ). f ( xi ) 0 ; se tiene
bi 1 xi
f (ai ). f ( xi )
0 ; se tiene
ai
xi
bi
bi
30
f(c)
20
x*
f(a)
raz
10
a
1 3 5 7 9
c
86 4
2 b
-10
-20
f(b)
b0
a0
MTODOS NUMRICOS
ALGORITMO DE LA BISECCIN
Input a , b , M , ,
u
f (a)
v
f (b)
c b a
Output a, b, u, v
If signo (u) = signo (v) then stop
for k=1,2,3, M do
e e/2
c a e
w
f (c)
output k, c , w , e
if e
or w
then stop
if signo(w) signo(u) then
b c
v
w
else
a
c
u
w
end if
end
%PROGRAMA BISECCIN
function Biseccion
fprintf ('\n');
nombre_f=input(' Ingrese la funcin asociada f(x)=','s');
a=input(' ingrese el lmite inferior : ');
b=input(' ingrese el lmite superior : ');
fprintf ('\n');
fprintf (' it
a
b
aprox error \n');
i=1; e=1; r=0;
while e>=3E-6 & i<=15
va=r;
r=(a+b)/2;
x=a ; fa=eval(nombre_f);
x=b ; fb=eval(nombre_f);
x=r ; fr=eval(nombre_f);
fprintf ('%3.0f %10.6f %10.6f %10.6f',i,a,b,r);
if fa*fr<=0
b=r; e=abs((r-va)/r);
fprintf('%10.6f\n',e);
else
a=r; e=abs((r-va)/r);
fprintf('%10.6f\n',e);
end
i=i+1;
end
fprintf('\n');
fprintf('La raz es :%10.9f\n',r);
MTODOS NUMRICOS
MTODOS NUMRICOS
a
3.000000
3.000000
3.000000
3.125000
3.187500
3.187500
3.203125
3.210938
3.214844
3.216797
3.217773
3.218262
3.218506
3.218506
b
4.000000
3.500000
3.250000
3.250000
3.250000
3.218750
3.218750
3.218750
3.218750
3.218750
3.218750
3.218750
3.218750
3.218628
aprox
error
3.500000 1.000000
3.250000 0.076923
3.125000 0.040000
3.187500 0.019608
3.218750 0.009709
3.203125 0.004878
3.210938 0.002433
3.214844 0.001215
3.216797 0.000607
3.217773 0.000303
3.218262 0.000152
3.218506 0.000076
3.218628 0.000038
3.218567 0.000019
II. Utilice el programa Biseccin para hallar los ceros de las siguientes funciones:
x
1) f ( x)
3) f ( x)
sen3 x
x3 5
e
2) f ( x)
x3 5
senx
sen(tan( x 2
4) f ( x)
ex
cos x
3))
Lnx
2 x 3 log( senx)
senx cos x x 3 2 x 6
5) f ( x)
6) f ( x) cos(tan( .x))
TAREA DOMICILIARIA
Utilice el mtodo grfico y el mtodo de Biseccin para hallar los ceros de las siguientes
funciones:
1) f ( x) 10 2 x log x 1 x 2
2) g ( x) sen( x) x 1
3) f ( x)
5) f ( x)
4)
Ln( x) 2 x 4
e
senx cos x
senx
log x
cos x
7) f ( x) e
ln x x3
9) f ( x)
x 1 x sen( x)
11) h( x) log( x) 0.2 x 2 1
13) f ( x)
( x 2)2
ln( x)
6)
( x)
( x)
e
e
x3
x
2x 1
x 2
8) ( x) x 2 4 xsen( x) (2senx)2
10) g ( x) x 2 4 x cos( x) (2 cos x)2
12) r ( x) 2 x e x 2 cos x 6
1
1
14) f ( x)
2
( x 0.3) 0.01 ( x 0.9) 2
0.04
MTODOS NUMRICOS
x*
[ai ; bi ] ; i 0 ; 1; 2;
f (bi )(bi ai )
bi
xi
f (bi ) f (ai )
xi
Si f (ai ). f ( xi )
Si f (ai ). f ( xi )
Caso contrario x
0 ; se tiene ai
0 ; se tiene ai
*
f (ai )(bi ai )
f (bi ) f (ai )
ai
ai ; bi
xi ; bi
1
1
1
1
xi
bi
xi (solucin)
Grficamente el mtodo Rgula Falsi significa tomar rectas secantes en forma sucesiva.
[ x0 ; f ( x0 )
]
x*
a0
[ b0 ; f (b0 ) ]
x1x5
L
x4x3 x2
b0
x0
[ a0 ; f (a0 )
ALGORITMO
DEL MTODO RGULA FALSI
]
If f(a)*f(b) <=0 then
Repeat
Calcular c
If f(a)*f(c)<=0 then
b=c
else
a=c
until f (c)
Error
retorno raz es c
else
cambiar lmites
end Rgula Falsi
E-1) Calcular los ceros de la funcin f ( x)
i) Ploteando la curva
x=0.5:0.001:1.5;
y=sqrt(x.^2+1)-tan(x);
plot(x,y,'k')
grid on
zoom on
xlabel('EJE DE ABSCISAS')
ylabel('EJE DE ORDENADAS')
MTODOS NUMRICOS
1.- f ( x)
5.- f ( x)
x2
8.- ( x)
x x 2 3x
senx
2.- g ( x)
1
x
x .e
x2
3.-
( x)
ex
sen( x) ; x>0
6.- g ( x)
13
2
40
9.- h( x)
sen( x)
3
10
x.e
2x
ex
4.7.-
( x)
( Lnx) 2
x
log(1 x) x 2
( x)
10.- f ( x)
x3
cos x
1
x
log x
II.- TAREA
Utilice el mtodo de Rgula Falsi para hallar los ceros de las siguientes funciones:
MTODOS NUMRICOS
3.-
( x)
0.1x3 5x2 x 4 e x
senx cos x e x ln x
5.-
( x)
1.- f ( x)
6.-
( x)
log( x) 0.2 x 2 1
( x) cos( x).cosh( x) 1 ; donde cosh(x)=coseno hiperblico
Lnx
7. ( x)
x2
2.- g ( x)
4.-
MTODOS NUMRICOS
xi
xi
(B)
xi
xi
( xi 1 xi ) f ( xi 1 )
f ( xi 1 ) f ( xi )
( xi 1 xi ) f ( xi )
f ( xi 1 ) f ( xi )
,i
,i
0;1;2;3;4
0;1;2;3;4
f ( xi )
, i 0;1;2;3;4
f ( xi 1 ) f ( xi )
xi 1 xi
xi f ( xi 1 ) xi 1 f ( xi )
xi 2
, i 0;1;2;3;4 LA MAS RECOMENDADA A USAR
(D)
f ( xi 1 ) f ( xi )
ALGORITMO DEL MTODO DE LA SECANTE
Secante
repeat
calcular x
x1 x2 ;
(C)
xi
x2
xi
until x1 x2 Error
retorno raz es x
end secante
PLOTEO DE LA CURVA f ( x) 0.1x3 5x 2 x 4 e
x=-5:0.05:5;
f=0.1*x.^3-5*x.^2-x+4+exp(-x);
plot(x,f)
grid on
xlabel('ABSCISAS')
ylabel('ORDENADAS')
title('METODO DE LA SECANTE')
gtext('f=0.1*x.^3-5*x.^2-x+4+exp(-x)')
gtext('1RAIZ')
gtext('2RAIZ')
10 DR. SORIA QUIJAITE JUAN JESS
en x [ 5;5]
MTODOS NUMRICOS
%PROGRAMA SECANTE
-----------------------------------------------------------------------------------------------------------------function secante2007
fprintf ('\n');
nombre_f=input(' Ingrese la funcin asociada f(x)=','s');
x0=input(' ingrese el 1er punto inicio x0= ');
x1=input(' ingrese el 2do punto inicio x1= ');
fprintf ('\n');
fprintf (' it
x0
x1
aprox error \n')
i=1; e=1; r=0;
while e>=3E-6 & i<=18
va=r;
x=x0 ; fx0=eval(nombre_f);
x=x1 ; fx1=eval(nombre_f);
%r=x1-(x1-x0)*fx1/(fx1-fx0);
r=(x0.*fx1-x1.*fx0)./(fx1-fx0);
x=r; fr=eval(nombre_f);
fprintf ('%3.0f %10.6f %10.6f %10.6f',i,x0,x1,r);
if fx0*fr<=0
x1=r; e=abs((r-va)/r);
fprintf('%10.6f\n',e);
else
x0=r; e=abs((r-va)/r);
fprintf('%10.6f\n',e);
end
i=i+1;
end
fprintf('La raz es :%10.9f\n',r);
-----------------------------------------------------------------------------------------------------------------COMPILACIN DEL PROGRAMA
>> secante2007
Ingrese la funcin asociada f(x)=0.1*x.^3-5*x.^2-x+4+exp(-x)
ingrese el 1er punto inicio x0= 0
ingrese el 2do punto inicio x1= 1
it
x0
x1
aprox
error
1 0.000000 1.000000 0.765448 1.000000
2 0.765448 1.000000 0.846891 0.096166
3 0.846891 1.000000 0.852334 0.006386
4 0.852334 1.000000 0.852684 0.000410
5 0.852684 1.000000 0.852706 0.000026
6 0.852706 1.000000 0.852708 0.000002
La raz es :0.852707668
I.-PRCTICA DIRIGIDA DE LABORATORIO CON MATLAB
Encuentre los ceros de las funciones utilizando el mtodo de la Secante para las siguientes funciones:
1.- f ( x) Sen( x3 x2 x 2) Cos( x)
2.- g ( x) e Sen( x 5) Cos(Sen( x))
e x x2
3.- f ( x) e x x 2
4.- g ( x) cos( x).cosh(x) 1
5.- ( x) x3 5x2 8x 4 e x
6.- ( x)
11
x. tan( x) 2
7.- h( x)
x2
cos( x)
8.- h( x)
sen( x 3)
2x
sen(2 x) x2
MTODOS NUMRICOS
TAREA
I. Utilice el mtodo de la Secante para hallar los ceros de las siguientes funciones:
1.- f ( x) x. tan( x) 1
2.- g ( x) senh( x) sen( x) 3.- ( x) x3 5x 2 8x 4 e
4.- ( x) x2 3x e x 2
5.- ( x)
Tan(Senx) Sen(Tanx) 2 x2 4
12
x2
MTODOS NUMRICOS