Uocmath M 01 03 11 17 29 31 37 38 52 59

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

NUMERICAL ANALYSIS 01

ASSIGNMENT 01 2023

UNIVERSITY OF CHAKWAL
Department of Mathematics
Task: Assignment 01
Submitted To: Dr. Shahid Hasnain

Bismillah Batool 01 Nimra Zafar 03


Iqra Noureen 11 Naseem Akhtar 17
Areesha Andleeb 29 Rida Zahra 31
Rida Yasmeen 37 Hira Mushtaq 38
Faiza Mussrat 52 Aneeqa Urooj 59
NUMERICAL ANALYSIS
Errors and Non Linear Equations
1
Department of Mathematics , University of Chakwal, Chakwal

Email: [email protected]

Introduction
In the realm of numerical analysis, the question to solve non linear equations stands as a pivot
challenge. This report embarks on an exploration of various numerical methods employed
to tackle such complexities, focusing on the Bisection method, Newton Raphson method and
secant method. Each’s method unique approached intricacies in solving non linear equations
will be dissected and evaluated, shedding light on their applications, limitations and compar-
ative efficiency in different scenarios. Through an in depth analysis of these techniques this
report aims to unravel the naunced world of non linear equations solution providing insights
into their computational methodologies and practical implementations.
Root finding in non linear equations constitute a fundamental challenge across, scientific en-
gineering and computational domains. This report delves into fundamental principles of three
prominent numerical methods:
The bisection method known for its simplicity and reliability; the Newton Raphson method
prized for its rapid convergence but sensitive to initial guesses and the secant method: balanc-
ing convergence speed and simplicity. Through this comprehensive investigation, this report
seeks to empower practitioners with a naunced understanding of these techniques, enabling
informed selection and applications in solving non linear equations.

Methodology
The problem one is related to find root of a non linear equation. For this we use Root Brack-
eting Criteria find an interval on which function has alternative signs. Then we use Bisection
Method to find the approximated root. For this we did about 5-7 iterations and find a root.
Then same problem, we solved by using Method Of False Position, and in the same way we
get a root which is also an approximated root. Then we use Newton Raphson Method to find
the approximated root. After this we compare the solution of all three methods and found
Newton Raphson Method better than other two.
In the same way for problem 02 we use Secant method and Newton Raphson Method. Then
by comparasion of these two method we found Newton Raphson Method much better.
In the end we find the melting point of alloy containing 84 percent lead by using the given
data. For this we use Lagrange interpolation method.
Problem 01
Show that
f (x) = x3 + 4x2 -10 = 0

has a root in [xi , xi+1 ] and determine an approximation to the root that is accurate to at least within
10−4 .

Solution:
Here f(x) = x3 + 4x2 -10
Root Bracketing Criteria:
x 0 1 1.3 1.4
f(x) -10 -5 -1.043 0.584
so, we choose
a0 = 1.3 and b0 = 1.4
f (a0 ) = -1.0433 and f (b0 ) = 0.584

Bisection Method:
n an bn xn+1 = an +b
2
n
f (xn )
0 1.3 1.4 1.35 -0.2496
1 1.35 1.4 1.375 0.16211
2 1.35 1.375 1.3625 -0.0450
3 1.3625 1.375 1.36875 0.05823
4 1.3625 1.3656 1.3656 0.0065
5 1.3625 1.3656 1.36405 -0.019475

Figure 1: Graph of given function by using Bisection Method

so the approximated root is 1.36 correct upto 3 dps.

2
Method Of False Position:
Here f(x) = x3 + 4x2 -10
a0 = 1.3 and b0 = 1.4
f (a0 ) = -1.0433 and f (b0 ) = 0.584
Formula
xn+1 = an ff(b n )−bn f (an )
(bn −f (an )

n an bn f (an ) f (bn ) xn+1 f (xn )


0 1.3 1.4 -1.043 0.564 1.3641 -0.01856
1 1.3641 1.4 -0.01856 0.584 1.5632 -0.0004
2 1.3652 1.4 -0.0004 0.584 1.3652 -0.0001

Figure 2: Graph of given function by using Method of Fasle Position.

Therefore 1.3752 is the root of given equation by using regula falsi method and is correct upto 5sf.

Newton Raphson Method:


Here f(x) = x3 + 4x2 -10

Here f ′(x) = 3x2 + 48x


f (xn ) = x3n + 4x2n -10
f ′(xn ) = 3x2n + 8xn

By Newton Raphson Method:


2x3n +4x2n +10
xn+1 = 3x 2 +8x
n
x
since root lies b/w (1,2)
let x0 = 1.5

x1 x2 x3 x4
1.3733 1.3653 1.36523 1.36520013

so, 1.365230013 is the root of given equation.

3
Figure 3: Graph of given function by using Newton Raphson Method

Comparasion
As the exact root of given Equation is 1.365230013
so we get the following roots by Bisection Method,Regula Falsi Method,Newton Raphson Method.

.... Bisection Method Reg.F.Method Newton Raphson M


Root 1.36 1.3652 1.36520013
Iterations 6 2 3

So the rate of convergence of Newton Raphson Mehtod is v.high.

Problem 02

Use the secant method to find a solution to x=cos(x) and compare the approximation with newton
raphson method.

Solution
given that x= cos(x)

Secant Method:
Here f(x) = x - cos(x)
We have to use root bracketing Criterion to find the approximate root.
For this, we have to choose an interval [xi , xi+1 ] such that
f (xi ) f (xi+1 ) < 0

x 0 1
f (x) −1 0.4597
Let,
x0 = 0.7 and x1 = 0.8
f (x0 ) = -0.0648 and f (x1 ) = 0.01033
By Secant Method:

4
xn−1 f (xn )−xn f (xn−1 ))
xn+1 = f (xn )−f (xn−1 )

n xn−1 xn f (xn−1 ) f (xn ) xn+1 f (xn+1 )


1 0.7 0.8 -0.0648 0.1031 0.7385 -0.000898
2 0.7385 0.8 -0.000898 0.1033 0.7390 -0.000095
3 0.7390 0.8 -0.000092 0.1033 0.7390 -0.00005

Figure 4: Graph of given function by using Secant Method

Hence 0.7390 is an approximation to the root by Secant Method.

Newton Raphson Method:


Here f (x) = x - cos(x)
f ′ (x) = 1 + sin(x)
f (xn ) = xn − cos(xn )
f ′(xn ) = 1 + sin(xn )
xn+1 = xn - ff′(x
(xn )
n)

xn sin(xn )+cos(xn )
xn+1 = 1+sin(xn )

Let, x0 = 1.7 be the initial guess.

x1 x2 x3 x4
0.781751 0.7394691 0.7390851 0.7390851

Hence, Approximate root is 0.7390851.

Comparasion:
By using secant Method we get 0.7390 in 3 iterations.
By using Newtons Raphson Method we have an approximated root 0.7390851 , which is much closer and is
correct upto more than 4dp as compared to Secant Method.
so the root obtained by using NRM is more accurate.

5
Figure 5: Graph of given function by using Newton Raphson Method

Problem 03
The following data gives the melting point of alloy of lead and zinc where T is temperature in degrees
c and P is percentage of lead in alloy.

P 40 50 60 70 80 90
T 180 204 226 250 276 304

find the melting point of alloy containing 84 percent lead.

Solution:
P 40 50 60 70 80 90
T 180 204 226 250 276 304

The value 84 is near the end of data table.So we use Newton’ s Backward interpolation formula.

x y ▽y ▽2 y ▽3 y ▽4 y ▽5 y
40 184
20
50 204 2
22 0
60 226 2 0
24 0 0
70 250 2 0
26 0
80 276 2
28
90 304

xn = 90 , yn = 304 , ▽yn = 28 , ▽2 yn = 2
▽3 yn = 0 , ▽4 yn = 0 , ▽5 yn = 0, h=10
P = x−xh
n
= 84−90
10 = -0.6
P (P +1)▽2 yn P (P +1)(P +2)▽3 yn P (P +1)(P +2)(P +3)▽4 yn P (P +1)(P +2)(P +3)(P +4)▽5 yn
f (x) = yn + P▽yn + 2! + 3! + 4! + 5!
+ ...

6
f (84) = 304 - 16.8 - 0.24
= 286. 96

Reference

(i) Numerical Analysis With C++


(ii) Applied Numerical Analysis
(iii) Notes by Gentle Man
(iv) Differnt Youtube channels

You might also like