Use NewtonRaphson Bisection and RegulaFalsi to find a root o

Use Newton-Raphson. Bisection, and Regula-Falsi to find a root of x tan x = 2 between 0.5 and 2. Use le10^-4 Use Newton-Raphson, Bisection, and Regula-Falsi to find the roots f(x) = x^4 - x^3 - 7x^2+x + 6 Use lessthanorequalto 10^-6.

Solution

clc;
clear all;
f=@(x) x*tan(x)-2 ;
a=0.5;
b=2;
format long
eps_abs = 1e-4;
eps_step = 1e-4;

while (b - a >= eps_step || ( abs( f(a) ) >= eps_abs && abs( f(b) ) >= eps_abs ) )
c = (a + b)/2
if ( f(c) == 0 )
break;
elseif ( f(a)*f(c) < 0 )
b = c;
else
a = c;
end
  
end

c =

1.076873779296875

Regular falsi

clc;
clear all;
f=@(x) x*tan(x)-2 ;
a=0.5;
b=2;
if(f(b)<f(a))
m=a;
a=b;
b=m;
end

c=1;
while((abs(a-b)>1e-4)&&c~=50)
c=c+1;
m=(a*f(b)-b*f(a))/(f(b)-f(a))
if(f(m)>0)
b=m;
end
if(f(m)<0)
a=m;
end
end

Answer is

m =

1.076868888338143

Newton method

clc;
clear all;
f=@(x) x*tan(x)-2 ;
f1=@(x) tan(x)+x*sec(x)^2;
x=1;
n=1
while(n<100)
  
x1=x-(f(x)/f1(x))
d=f(x)
x=x1
if abs(f(x)<1e-4)
break
end
end

Answer is

x =

1.076874150976021

bisection method

clc;
clear all;
f=@(x) x^4-x^3-7*x^2+x+6 ;
a=0.5;
b=2;
format long
eps_abs = 1e-6;
eps_step = 1e-6;

while (b - a >= eps_step || ( abs( f(a) ) >= eps_abs && abs( f(b) ) >= eps_abs ) )
c = (a + b)/2
if ( f(c) == 0 )
break;
elseif ( f(a)*f(c) < 0 )
b = c;
else
a = c;
end

end

Answer is

c =

1.000000059604645

Regular falsi

clc;
clear all;
f=@(x) x^4-x^3-7*x^2+x+6 ;
a=0.5;
b=2;
if(f(b)<f(a))
m=a;
a=b;
b=m;
end

c=1;
while((abs(a-b)>1e-6)&&c~=50)
c=c+1;
m=(a*f(b)-b*f(a))/(f(b)-f(a))
if(f(m)>0)
b=m;
end
if(f(m)<0)
a=m;
end
end

Anser is

m =

1.000000000000000

Newton method

clc;
clear all;
f=@(x) x^4-x^3-7*x^2+x+6 ;
f1=@(x) 4*x^3-3*x^2-14*x+1;
x=0.7;
n=1
while(n<100)
  
x1=x-(f(x)/f1(x))
d=f(x)
x=x1
if abs(f(x)<1e-6)
break
end
end

x =

1.055933917734322

 Use Newton-Raphson. Bisection, and Regula-Falsi to find a root of x tan x = 2 between 0.5 and 2. Use le10^-4 Use Newton-Raphson, Bisection, and Regula-Falsi to
 Use Newton-Raphson. Bisection, and Regula-Falsi to find a root of x tan x = 2 between 0.5 and 2. Use le10^-4 Use Newton-Raphson, Bisection, and Regula-Falsi to
 Use Newton-Raphson. Bisection, and Regula-Falsi to find a root of x tan x = 2 between 0.5 and 2. Use le10^-4 Use Newton-Raphson, Bisection, and Regula-Falsi to

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site