Está en la página 1de 3

PRUEBA DE ENTRADA

GOMEZ ALAYA WILDER

Graficar la función Y=x 4-3x3+10x-ln(x)+5

EJERCICIO 1

x
0.05
F(X)
1.8506612
F(X)
0.1 2.0971
0.15 2.46429 10
0.2 2.87657
0.25 3.3090912
0.3 3.7499787
0.35 4.1923132 9
0.4 4.63154
0.45 5.0644187
0.5 5.48853
0.55 5.9020186 8
0.6 6.3034487
0.65 6.6917179
0.7 7.066002
0.75 7.42572 7
0.8 7.77051
0.85 8.1002123
0.9 8.4148575
6

EJERCICIO 2
1 5
function biseccion
f=input('ingrese la funcion f=','s');
ezplot(f),grid4
a=input('ingrese el valor de a=');
b=input('ingrese el valor de b=');
3
E=0.001;
fa=double(subs(f,a));
fb=double(subs(f,b));
2
T=1;
c=1;
if fa*fb < 0
1
x=(a+b)/2;
while T > E
x=(a+b)/2;
0
fx=double(subs(f,x));
0 0.2 0.4 0.6 0.8 1 1.2
if fa*fx < 0
b=x;
else
a=x;
end
x1=(a+b)/2;
T=abs((x1-x)/x1);
x=x1;
c=c+1;
disp([c a b x fa fx T])
end
fprintf('El valor de la raiz es %1.3f \n',x)
else
disp('no tiene raices')
end
end

2
function secante
f=input('ingrese la funcion f=','s');
ezplot(f),grid
a=input('ingrese el valor de a=');
b=input('ingrese el valor de b=');
E=0.001;
fa=double(subs(f,a));
fb=double(subs(f,b));
T=1;
c=1;
if fa*fb < 0
x=b-((fb*(b-a))/(fb-fa));
while T > E
x=b-((fb*(b-a))/(fb-fa));
fx=double(subs(f,x));
if fa*fx < 0
b=x;
else
a=x;
end
x1=b-((fb*(b-a))/(fb-fa));
T=abs((x1-x)/x1);
x=x1;
c=c+1;
disp([c a b x fa fx T])
end
fprintf('El valor de la raiz es %1.3f \n',x)
else
disp('no tiene raices')
end
end
3
function Newton
epsi=input('Valor para epsilon: ');
Nuit=input('Valor para numero maximo de iteraciones: ');
v=feval(fun,x0); vp=feval(fprima,x0);
disp('k x f(x) ');
out=[0,x0,v];
fprintf('%4.0f %8.3e %8.3e\n',out);
for k=1:Nuit
x1=x0-v/vp;
v=feval(fu,x1);vp=feval(fprima,x1);
out=[k,x1,v];
fprintf('%4.0f %8.3e %8.3e\n',out);
if(abs(x1-x0)<epsi| abs(v)<epsi)
break
end
x0=x1;
end
4
function puntofijo
global fun
fprintf('Método del punto fijo:\n');
fx = input('Ingrese la función original:\n','s');
fun=input('Ingrese la función despejada:\n','s');
ezplot(fun),grid;
x0=input('Ingrese el punto inicial:\n');
n=input('Ingrese el numero de iteraciones:\n');
it=0;
fprintf(' it x0 x1 x0-x1');
while(it<n)
it = it+1;
x=x0;
x1=eval(fun);
fprintf('\n%3.0f%15.10f%15.10f%15.10f\n',it,x0,x1,abs(x1-x0));
x0=x1;
end
fprintf('\n el punto fijo aproximado es=%10.6f\n',x1);

También podría gustarte