Escolar Documentos
Profissional Documentos
Cultura Documentos
1.
function y=f(x)
y=x^3+2^(x^2)+x-42
end
function raíz=bisección(a,b,error)
r0=(a+b)/2;
if f(a)×f(r0)<0
b=r0;
else
a=r0;
end
r1=(a+b)/2;
while abs(r1-r0)>=error
if f(a)*f(r1)<0
b=r1;
else
a=r1;
end
r0=r1;
r1=(a+b)/2;
end
r=r1;
bisección(-2.45,2.45,0.0000001)
2.843348
2.
function y=f(x)
y=((x^4)*sin(x+3*pi))+exp(2*x)-1
end
function raíz=bisección(a,b,error)
r0=(a+b)/2;
if f(a)×f(r0)<0
b=r0;
else
a=r0;
end
r1=(a+b)/2;
while abs(r1-r0)>=error
if f(a)*f(r1)<0
b=r1;
else
a=r1;
end
r0=r1;
r1=(a+b)/2;
end
r=r1;
bisección(-1.1,0,0.0000001)
-1.006302325
3.
function y=f(x)
y=(cos(2*x-21*pi))^2+2*x^3
end
function raíz=bisección(a,b,error)
r0=(a+b)/2;
if f(a)×f(r0)<0
b=r0;
else
a=r0;
end
r1=(a+b)/2;
while abs(r1-r0)>=error
if f(a)*f(r1)<0
b=r1;
else
a=r1;
end
r0=r1;
r1=(a+b)/2;
end
r=r1;
bisección(-0.52,-0.51,0.0000001)
-0.5125728
4.
function y=f(x)
y=(cos(2*x-21*pi))^2+2*exp(x^3)
end
function raíz=bisección(a,b,error)
r0=(a+b)/2;
if f(a)×f(r0)<0
b=r0;
else
a=r0;
end
r1=(a+b)/2;
while abs(r1-r0)>=error
if f(a)*f(r1)<0
b=r1;
else
a=r1;
end
r0=r1;
r1=(a+b)/2;
end
r=r1;
bisección(-3,-2.34,0.0000001)
-2.3565