0 - Solutions Algebraic Transcendental Equations
0 - Solutions Algebraic Transcendental Equations
0 - Solutions Algebraic Transcendental Equations
Regula Falsi Method: The formula to find the first approximation 𝑥1 to the real
𝑎𝑓(𝑏)−𝑏𝑓(𝑎)
root of 𝑓(𝑥) = 0 lying in (𝑎, 𝑏) is 𝑥1 =
𝑓(𝑏)−𝑓(𝑎)
The process is continued till we get consistency in two consecutive
approximations or 𝑓(𝑥𝑖 ) = 0
Code:
Clc; clear;
syms x f(x);
a = 2; % Lower Limit
b = 3; % Upper Limit
f(x) = x^3-2*x-5; % Declare function
if f(a)*f(b)<0
for i = 1:50
c=(a*f(b)-b*f(a))/(f(b)-f(a));
if abs(f(c))<=0.001
fprintf("The root is %f",c)
break;
elseif f(a)*f(c)<0
b=c;
else
a=c;
end
end
else
fprintf("Enter a different interval")
end
Output:
The root is 2.094518
Code:
clc
clear
syms x f(x) g(x);
x0=1; % Initial approximate root
f(x) = x^3-2*x-5; % Declare a function
g(x) = diff(f(x),x);
for i=1:50
xn=x0-(f(x0)/g(x0));
if abs(f(xn))<=0.001
fprintf("Root is %f",xn)
break;
else
x0=xn;
end
end
Output:
Root is 2.094558