Sei sulla pagina 1di 43

PRCTICA N2

SOLUCION NUMERICA DE ECUACIONES DE ECUACIONES ALGEBRAICAS

1. MTODO DE LA BISECCIN

Dada la ecuacin f(x)=0. Si la funcin f(x) es real Y continua en [a,b] y f(a)f(b)<0, entonces existe una raz entre a y b. PROCEDIMIENTO PASO 1: Escoger los valores iniciales a y b ([a;b])tal que f(a) f(b)<0

PASO 2: Hallar la primera raz aproximada mediante PASO 3:

Realizar las siguientes evaluaciones para determinar en que sub-intervalo cae la raz. 3.1. Si f(a)f(x)=0 entonces la raz es x, y se determina los clculos. 3.2. Si f(a)f(x)<0, entonces la raz se encuentra en [a;x] y el b x (x se asigna a b) 3.3. Si f(a)f(x)>0, entonces la raz se encuentra en [x;b]

PASO 4: Calcular nuevamente , si se verifica las evaluaciones 3.2. o 3.3.

PASO 5: El proceso se repetir mientras b - a<E, donde E es una tolerancia prefijada, por ejemplo: E = 1% (0.01) E = 0.1% E = 0.01%

2. MTODO DEL PUNTO FIJO

El numero real p es un punto fijo de g(x), si: g(p) = p Por ejemplo: Los puntos fijos de g(x)=x2-2 son x=-1 y x=2 pues g(-1)=-1 y g(2)=2. Geomtricamente los puntos fijos son la interseccin de la funcin g(x) con la recta y=x. Como g(x)= x x2-2=x x2-x-2=0 (x+1)(x-2)=0 x=-1 y x=2 Si la ecuacin f(x)=0 se arregla de la forma: x - g(x)= 0 x = g(x) Entonces, el mtodo iterativo se puede escribir como:

Xk+1 = g(xk),k=0,1,2 A g(x) se le denomina funcin de iteracin. PROCEDIMIENTO: PASO 1: De la ecuacin f(x)=0, determinar la funcin de iteracin g(x) PASO 2: Empezar el desarrollo con un valor inicial x0 y determinar los xk+1, mediante xk+1 = g(xk) PASO 3: El proceso se repetir hasta que xk+1 - xk<E donde E es una tolerancia prefijada, por ejemplo E=1% El punto xktal que g(xk)= xkes un punto fijo de g(x); este punto fijo es una raz de f(x)=0 VENTAJAS Y DESVENTAJAS Las ventajas es que se puede obtener fcilmente la funcin de iteracin g(x). La desventaja es que los x1,x2x3, no siempre converjan a un punto con la funcin g(x) elegida. En este caso para probar la convergencia de g(x) se debe verificar que: g(x)<1 es una vecindad de la raz

3. MTODO DE NEWTON-RAPHSON

Para determinar la ecuacin de la recta L: ( )

Pero mL = f(x0) Entonces: ( ) ( )

(x0-x1)f(x0)=f(xo)
( ( ) )

(Formula de Newton-Raphson, f(xo)o

GENERALIZANDO SE TIENE:
( ) ( )

f(xi)o

Para calcular el punto xi+1 se utilizara la formula de Newton-Raphson previa condicin inicial. El proceso se repetir hasta que xi+1-xi<E, donde E es una tolerancia prefijada.

4. MTODO DE LA SECANTE

mAB= mBC ( ) ( ) ( )

( ( Generalizando se tiene:
( ( ) ( ) ( ) (Formula )

) ( ) ( )

para el mtodo de la secante)

Para xixi-1, i=1,2,3... Para empezar el proceso se necesitan los valores iniciales x0 y x1 y el proceso se repetir hasta que un xi+1 satisfaga que xi+1-xi<E, donde E es una tolerancia prefijada.

5. MTODO DE MULLER

y = x2

y =? y = (x-4)2

x2y=(x-x2)2

y = a(x-x2)2+b(x-x2)+c

y = ax2 + bx + c (Ecuacin general de la parbola)

x2

El mtodo consiste en obtener los coeficientes de la parbola que pasa por los tres puntos, dichos coeficientes se sustituyen en la formula cuadrtica para obtener el valor donde la parbola intersecta al eje x, es decir x3. La aproximacin se facilita al escribir la ecuacin de la parbola de la siguiente forma: f(x) = a(x-x2)2+b(x-x2)+c Como la parbola pasa por los puntos (xo,f(xo);(x1,f(x1)) y (x2,f(x2)) entonces se tiene: o o o o f(x0) = a(x0-x2)2+b(x0-x2)+c f(x1) = a(x1-x2)2+b(x1-x2)+c f(x2) = a(x2-x2)2+b(x2-x2)+c f(x2) = c

Al simplificar tenemos que: o o f(x0) - f(x2) = a(x0-x2)2+b(x0-x2)+c (1) f(x1) - f(x2) = a(x1-x2)2+b(x1-x2)+c (2)

Objetivo: Hallar a y b Utilizando las siguientes nuevas variables: ho = x1 - x0 h1 = x2 - x1 0 = 1 =


( ) ( )

Al sustituir en las ecuaciones (1) y (2), se tiene: o o h11 + h00 = -a(ho+h1)2 + b(h0+h1) (3) h11 = -a(h1)2 + b(h1)(4)

Y al desarrollar (3) y (4) se tiene: o o o


ah1 + 1 f(x2)

DIAGRAMAS DE FLUJO

1. MTODO DE LA BISECCIN

2. MTODO DEL PUNTO FIJO

INICIO

LEER f(x),g(x),x0,E

x1g(x0)

x1-x0>E

X0X1 X1g(x)

ESCRIBIR x1

FIN

3. MTODO DE NEWTON-RAPHSON

INICIO

LEER F(X),F(X),X0,E

( ) ( )

|X1-X0|>E

V
X0X1

( ) ( )

ESCRIBIR X1

X1

FIN

4. MTODO DE LA SECANTE

INICIO
LEER F(X),X0,X1,E

( ( )

) ( ) ( )

F
|X2-X1|>E

V
X0X1 X1X2 ( ( ) ) ( ) ( )

ESCRIBIR X2

FIN

CODIFICACIONES EN MATLAB 1. MTODO DEL PUNTO FIJO

PUSHBUTTON: CALCULAR function pushbutton1_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); g=inline(get(handles.edit2,'string')); x0=str2double(get(handles.edit3,'string')); E=str2double(get(handles.edit4,'string')); x1=g(x0) while abs(x1-x0)>E x0=x1; x1=g(x0) end set(handles.edit5,'string',x1); PUSHBUTTON: GRAFICA f(X) function pushbutton2_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); ezplot(handles.axes1,f) grid on PUSHBUTTON: CONVERGENCIA f(X) function pushbutton3_Callback(hObject, eventdata, handles) g=inline(get(handles.edit2,'string')); ezplot(handles.axes2,g) hold on ezplot(handles.axes2,'x') zoom on grid on hold off

2. MTODO DE LA BISECCIN

PUSHBUTTON: CALCULAR function pushbutton1_Callback(hObject, eventdata, handles) F=inline(get(handles.edit1,'string')); a=str2double(get(handles.edit2,'string')); b=str2double(get(handles.edit3,'string')); E=str2double(get(handles.edit4,'string')); if F(a)*F(b)<0 while abs(b-a)>E x=(a+b)/2 if F(a)*F(x)==0 a=b; else if F(a)*F(x)<0 b=x; else a=x; end end end set(handles.edit5,'string',x); else set(handles.edit5,'string','no existe raiz'); end PUSHBUTTON: GRAFICAR function pushbutton2_Callback(hObject, eventdata, handles) F=inline(get(handles.edit1,'string')); Intervalo=str2num(get(handles.edit6,'string')); ezplot(F,Intervalo) grid on

3. MTODO DE LA SECANTE

PUSHBUTTON: CALCULAR function pushbutton1_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); x0=str2double(get(handles.edit2,'string')); x1=str2double(get(handles.edit3,'string')); E=str2double(get(handles.edit4,'string')); x2=x1-(((x1-x0)*f(x1))/(f(x1)-f(x0))) while abs (x2-x1)>E x1=x2; x2=x1-(((x1-x0)*f(x1))/(f(x1)-f(x0))) end set(handles.edit5,'string',x2); PUSHBUTTON: GRAFICO function pushbutton2_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); intervalo=str2num(get(handles.edit6,'string')); ezplot(f,intervalo), grid on

4. MTODO DE MULLER

PUSHBUTTON: CALCULAR function pushbutton1_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); x0=str2double(get(handles.edit2,'string')); x1=str2double(get(handles.edit3,'string')); x2=str2double(get(handles.edit4,'string')); E=str2double(get(handles.edit5,'string')); h0=x1-x0; h1=x2-x1; d0=(f(x1)-f(x0))/(x1-x0); d1=(f(x2)-f(x1))/(x2-x1); a=(d1-d0)/(h0+h1); b=a*h1+d1; c=f(x2); if b>0 x3=x2+(-2*c)/(b+sqrt(b^2-4*a*c)) else x3=x2+(-2*c)/(b-sqrt(b^2-4*a*c)) end while abs((x3-x2)/x3)>E x0=x1; x1=x2; x2=x3; h0=x1-x0; h1=x2-x1; d0=(f(x1)-f(x0))/(x1-x0); d1=(f(x2)-f(x1))/(x2-x1); a=(d1-d0)/(h0+h1); b=a*h1+d1; c=f(x2); if b>0

x3=x2+(-2*c)/(b+sqrt(b^2-4*a*c)) else x3=x2+(-2*c)/(b-sqrt(b^2-4*a*c)) end end set(handles.edit6,'string',x3) PUSHBUTTON: GRAFICA function pushbutton2_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); intervalo=str2num(get(handles.edit8,'string')); ezplot(f,intervalo); grid on

5. MTODO DE NEWTON-RAPHSON

PUSHBUTTON: CALCULAR function pushbutton1_Callback(hObject, eventdata, handles) f=get(handles.edit1,'string'); g=get(handles.edit2,'string'); f=inline(f); g=inline(g); x=str2double(get(handles.edit3,'string')); E=str2double(get(handles.edit4,'string')); x1=x-f(x)/g(x) while abs (x1-x)>E x=x1; x1=x-f(x)/g(x) end set(handles.edit5,'string',x1); PUSHBUTTON: GRAFICO function pushbutton2_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); intervalo=str2num(get(handles.edit6,'string')); ezplot(f,intervalo), grid on

6. MTODO GRFICO

PUSHBUTTON: GRAFICA function pushbutton1_Callback(hObject, eventdata, handles) f=inline(get(handles.edit1,'string')); ezplot(handles.axes1,f) grid on zoom on

EJERCICIOS 1. Determine la raz de : ( ) a) En forma grafica b) Con el mtodo dela biseccin, e itere hasta E0.1% c) Con el mtodo del punto fijo. Haga una eleccin inicial de X 0 = 0.5 , e itere hasta que E 0.001% d) Con el mtodo de Newton-Raphson ,e itere hasta que E 0.1% e) Con el mtodo de la secante ,e itere hasta que E 0.1% 2. Determine la menor raz positiva de: ( ) a) b) c) d) ( )

En forma grafica Con el mtodo de la biseccin ,e itere hasta que E 0.1% Con el mtodo del punto fijo ,e itere hasta E 0.1% Con el mtodo de Newton-Raphson (tres iteraciones,X0=0.3) ,e itere hasta E 0.1% e) Con el mtodo de la Secante (tres iteraciones,X0=0.5,X1=0.3) e itere hasta E 0.01%. 3. En ingeniera estructural ,la formula de la secante define la fuerza por unidad de rea/A;queocasiona la tensin mxima en una columna que tiene una razn de esbeltez L/R dada es :

)(

Donde: o ec/k2 = razn de excentricidad o E = modulo de elasticidad en MPa(Mega pascales) Si para una viga de acero, E = 3000MPa, ec/k2 =0.25 y m =40MPa, calcule P/A, para L/K =100.

Desarrolle analticamente el problema (tres iteraciones) utilizando el mtodo de Biseccin, Newton-Raphson y la Secante. 4. El desplazamiento de una estructura esta definido por la ecuacin siguiente para una oscilacin amortiguadora : ( )

Donde: k= 0.7 y w=4 a) Utilice el mtodo grafico para realizar una estimacin inicial del tiempo que se requiere para que el desplazamiento disminuya a 3.5 b) Emplee el mtodo de la Biseccin para determinar la raz, e itere hasta que E0.1% c) Emplee el mtodo de Newton-Raphson para determinar la raz, e itere hasta que E0.1% Emplee el mtodo de la Secante para determinar la raz, e itere hasta que E0.1%

DESARROLLO EJERCICIO 1 a)

ITERACIONES x3 = 1.9064 x3 = 1.9706 x3 = 1.9724

b)

ITERACIONES x=2 x = 1.5000 x = 1.7500 x = 1.8750 x = 1.9375

c) MTODO DEL PUNTO FIJO

ITERACIONES x1 = 1.2993 x1 = 1.2993 x1 = 1.8171 x1 = 1.9506 x1 = 1.9697 x1 = 1.9721 x1 = 1.9723

d)

ITERACIONES x1 = 2.0275 x1 = 1.9728

e)

ITERACIONES x2 = 2.1121 x2 = 1.9879 x2 = 1.9742

EJERCICIO 2 a)

b)

ITERACIONES x = 1.5000 x = 1.7500 x = 1.8750 x = 1.9375

d)

x1 = 0.1078 x1 = 0.1435

e)

ITERACIONES x1 = 0.1078 x1 = 0.1435 x2 = 0.0386 x2 = 0.1984 x2 = 0.1128

EJERCICIO3 a)

x = 25 x = 22.5000 x = 21.2500 x = 20.6250 x = 20.3125 x = 20.4688 x = 20.3906

b)

x1 = 21.1776 x1 = 20.4780 x1 = 20.4631

c)

ITERACIONES x2 = 20.3040 x2 = 20.4652 x2 = 20.4631

EJERCICIO 4 a)

ITERACIONES x3 = 0.4103 x3 = 0.2611 x3 = 0.2703 x3 = 0.2704

b)

ITERACIONES x = 0.5000 x = 0.2500 x = 0.3750 x = 0.4375 x = 0.4063 x = 0.3906 x = 0.3984 x = 0.3945 x = 0.3926 x = 0.3936

c)

ITERACIONES x1 = 0.3925 x1 = 0.3927

d)

ITERACIONES x2 =0.2357 x2 = 0.2870 x2 = 0.2640 x2 = 0.2731 x2 = 0.2693 x2 = 0.2709 x2 = 0.2702

EJERCICIO 5

ITERACIONES x3 = 0.9765 x3 = 0.9762

EJERCICIO 6 a)

ITERACIONES x=0 x = 0.5000 x = 0.7500 x = 0.6250 x = 0.5625 x = 0.5313 x = 0.5156 x = 0.5234 x = 0.5195 x = 0.5215 x = 0.5225

b)

ITERACIONES x1 = 191.3808 x1 = 1.7127e+007 x1 = Inf x1 = Inf EL VALOR INICIAL NO ESTA EN EL RANGO DETERMINADO PERO OBSERVANDO LA GRAFICA SE PUEDE ASIGNAR UN VALOR INICIAL INDICADO EL CUAL ES 1

Potrebbero piacerti anche