Академический Документы
Профессиональный Документы
Культура Документы
x=-2:0.05:5;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
plot(x,f,'m')
grid on
%CONVERGENCIA
syms x
x0=9/2;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
a=subs(f,x0)
b=subs(diff(f,1),x0);
c=subs(diff(f,2),x0);
convergencia=abs((c*a)./((b).^2))
syms x
x0=9/2;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
a=subs(f,x0)
b=subs(diff(f,1),x0);
c=subs(diff(f,2),x0);
convergencia=abs((c*a)./((b).^2))
a=
exp(9/2) + sin(9/2) - 319/4
convergencia =
-((exp(9/2) + sin(9/2) - 319/4)*(sin(9/2) - exp(9/2) + 6))/(cos(9/2) + exp(9/2) 31)^2
>> -((exp(9/2) + sin(9/2) - 319/4)*(sin(9/2) - exp(9/2) + 6))/(cos(9/2) +
exp(9/2) - 31)^2
ans =
0.2283
%DISCRIMINANTE
syms x
x0=9/2;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
a=subs(f,x0)
b=subs(diff(f,1),x0);
c=subs(diff(f,2),x0);
D=b.^2-2*c*a
syms
x0=9/2;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
a=subs(f,x0)
b=subs(diff(f,1),x0);
c=subs(diff(f,2),x0);
D=b.^2-2*c*a
a=
exp(9/2) + sin(9/2) - 319/4
D=
(cos(9/2) + exp(9/2) - 31)^2 + (exp(9/2) + sin(9/2) - 319/4)*(2*sin(9/2) 2*exp(9/2) + 12)
>> (cos(9/2) + exp(9/2) - 31)^2 + (exp(9/2) + sin(9/2) - 319/4)*(2*sin(9/2) 2*exp(9/2) + 12)
ans =
1.8791e+03
syms x
x0=9/2;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
b=subs(diff(f,1),x0)
c=subs(diff(f,2),x0)
OTHER
syms x
x0=9/2;
f=exp(x)+sin(x)-3*x.^2-4*x-1;
b=subs(diff(f,1),x0)
c=subs(diff(f,2),x0)
b=
cos(9/2) + exp(9/2) - 31
c=
exp(9/2) - sin(9/2) - 6
>> cos(9/2) + exp(9/2) - 31
ans =
58.8063
>> exp(9/2) - sin(9/2) - 6
ans =
84.9947
function newton2orden
nombre_f=input('Ingrese la funcin f(x)=','s');
nombre_f2=input('Ingrese la derivada de f(x)=','s');
x0=input('Ingrese el valor inicial:');
fprintf('\n');
fprintf('it aprox g(x) error \n');
i=1; e=1; delta=0.001;
while e>3E-12 && i<=18
x=x0;
fx0=eval(nombre_f);
x=x0-delta;
df1=eval(nombre_f);
df3=eval(nombre_f2);
x=x0+delta;
df2=eval(nombre_f);
df4=eval(nombre_f2);
dfx0=(df2-df1)/(2*delta);
d2fx0=(df4-df3)/(2*delta);
ds=((dfx0).^2)-(2*(fx0.*d2fx0));
r=x0+((-dfx0)+sqrt(ds))./(d2fx0);
e=abs((r-x0)/r);
fprintf('%3.0f%10.6f%10.6f%10.6f\n',i,x0,r,e);
x0=r;
i=i+1;
end
fprintf('La Raiz es :%10.9f\n',x0);
>> newton2orden
Ingrese la funcin f(x)=exp(x)+sin(x)-3*x.^2-4*x-1
Ingrese la derivada de f(x)=cos(x)-6*x+exp(x)- 4
Ingrese el valor inicial:9/2
it aprox g(x) error
1 4.500000 4.318126 0.042119
2 4.318126 4.320057 0.000447
3 4.320057 4.320057 0.000000
4 4.320057 4.320057 0.000000
La Raiz es :4.320057250
%APLICACIN
x=-120:0.05:80;
f=0.75*(10.^(6.898-((1221.8)./(x+227.4)))+0.25)+0.25*(10.^(6.195((376.71)./(x+241.2))))-760;
plot(x,f,'b')
grid on
%CONVERGENCIA
syms x
x0=-205/2;
f=0.75*(10.^(6.898-((1221.8)./(x+227.4)))+0.25)+0.25*(10.^(6.195((376.71)./(x+241.2))))-760;
a=subs(f,x0)
b=subs(diff(f,1),x0);
c=subs(diff(f,2),x0);
convergencia=abs((c*a)./((b).^2))
>> syms x
x0=-205/2;
f=0.75*(10.^(6.898-((1221.8)./(x+227.4)))+0.25)+0.25*(10.^(6.195((376.71)./(x+241.2))))-760;
a=subs(f,x0)
b=subs(diff(f,1),x0);
c=subs(diff(f,2),x0);
convergencia=abs((c*a)./((b).^2))
a=
convergencia =
ans =
0.0059
OTHER
syms x
f=0.75*(10.^(6.898-((1221.8)./(x+227.4)))+0.25)+0.25*(10.^(6.195((376.71)./(x+241.2))))-760;
diff(f,1)
%DERIVADA
(18327*10^(3449/500 - 6109/(5*(x + 1137/5)))*log(10))/(20*(x + 1137/5)^2)
+ (37671*10^(1239/200 - 37671/(100*(x + 1206/5)))*log(10))/(400*(x +
1206/5)^2)
>> newton2orden
Ingrese la funcin f(x)=0.75*(10.^(6.898-((1221.8)./(x+227.4)))
+0.25)+0.25*(10.^(6.195-((376.71)./(x+241.2))))-760
Ingrese la derivada de f(x)=(18327*10^(3449/500 - 6109/(5*(x +
1137/5)))*log(10))/(20*(x + 1137/5)^2) + (37671*10^(1239/200 - 37671/
(100*(x + 1206/5)))*log(10))/(400*(x + 1206/5)^2)
Ingrese el valor inicial:-205/2