0 - Solutions Algebraic Transcendental Equations

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Solution of algebraic and transcendental equation by Regula-Falsi

and Newton-Raphson method

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

Example 1: Find a real root of the equation 𝒙𝟑 − 𝟐𝒙 − 𝟓 = 𝟎 using Regula


Falsi method.

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

Lab Manual Department of Mathematics, NIE, Mysuru P a g e | 10


Exercise:
1. Find the real root of the equation 𝑥 𝑙𝑜𝑔10 𝑥 − 1.2 = 0
Hint: Enter f(x)=x*log10(x)-1.2; Ans: 2.7406
2. Find the real root of the equation cos 𝑥 = 3𝑥 − 1 Ans: 0.607

Newton Rapson Method: The formula to find the first approximation 𝑥1


𝑓(𝑥0 )
to the real root of 𝑓(𝑥) = 0 near to 𝑥0 is 𝑥1 = 𝑥0 −
𝑓′ (𝑥0 )
𝑓(𝑥𝑛 )
In general, 𝑥𝑛+1 = 𝑥𝑛 −
𝑓′ (𝑥𝑛 )
The process is continued till we get consistency in two consecutive
approximations or 𝑓(𝑥𝑖 ) = 0

Example 1: Find a real root of the equation 𝒙𝟑 − 𝟐𝒙 − 𝟓 = 𝟎 using Newton


Rapson method

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

Lab Manual Department of Mathematics, NIE, Mysuru P a g e | 11


Exercise:
1. Find the real root of the equation 𝑥 3 + 𝑥 2 + 3𝑥 + 4 = 0 near 𝑥0 = −1
Ans: −1.222495
𝑥
2. Find the real root of the equation 𝑥𝑒 − 2 = 0
Ans: 0.852783 (𝑥0 = 1)

Lab Manual Department of Mathematics, NIE, Mysuru P a g e | 12

You might also like