Numerical Analysis
Numerical Analysis
Lecture: 2
Numerical Analysis
Saadman Sakib
Department of CSE
CUET
Outline Numerical Solution of Algebraic and Transcendental Equations
Bisection Method
Method of False Position(Regula Falsi method)
Newton-Raphson Method
Numerical Integration:
Trapezoidal Rule
Simpson’s Rule
Numerical Analysis
Numerical analysis is a branch of mathematics that focuses on developing and analyzing
algorithms for solving mathematical problems numerically (i.e., using approximate rather
than exact solutions).
These problems often involve continuous mathematical functions and equations that are
too complex for analytical (exact) solutions, making numerical methods essential.
Topics included in Numerical Analysis:
•Root finding (e.g., Bisection Method, Newton-Raphson Method)
•Linear algebra (solving systems of linear equations)
•Interpolation and approximation (fitting functions to data points)
•Differential equations (solving ordinary and partial differential equations)
•Optimization (finding maximum or minimum values of functions)
•Integration (numerical integration techniques like Simpson's rule or trapezoidal rule)
Numerical Solution of
Algebraic and
Transcendental Equations
But
if Degree of 𝑓(x) > 4 or it involves transcendental functions,
direct methods do not exist and we need to apply
numerical methods to find the roots of the equation 𝑓(x) = 0.
Solutions
1. Bisection Method
2. Method of False Position(Regula Falsi method)
3. Newton-Raphson Method
4. Gauss-Jacobi’s iteration method
5. Gauss-Seidal’s iteration method
interval [0.5,1]
interval [0.75,1]
First 2 decimal places have been stabilized; hence 0.8633 is the real root
correct to two decimal places.
Let, x = -x
So, Our equation becomes
-x3 + x + 11 = 0
x3 - x – 311 = 0
Φ(x) = x - x - 11
Therefore, we shall find the positive root of Φ(x) = 0
Regula Falsi Method
interval [0.5,1]
interval [0.636,1]
interval [0.6711,1]
Here,
f(0) = -28 f(5) = -3
f(1) = -27 f(6) = 8
f(2) = -24
f(3) = -19 So,
f(4) = -12
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology 34
Example 2
37
Naive Gaussian Elimination
Naive Gaussian Elimination
Examples
38
Naive Gaussian Elimination
• The method consists of two steps:
• Forward Elimination: the system is reduced to upper
triangular form. A sequence of elementary operations is
used.
• Backward Substitution: Solve the system starting from
the last variable.
39
Elementary Row Operations
40
Example
Forward Elimination
41
Example
Forward Elimination
42
Example
Forward Elimination
43
Example
Backward Substitution
44
Gauss-Jordan Method
Gauss-Jordan Algorithm
Examples
45
Gauss-Jordan Method
• The method reduces the general system of equations AX=B to IX=B where I is an
identity matrix.
46
Gauss-Jordan Method
Example
47
Gauss-Jordan Method
Example
48
Gauss-Jordan Method
Example
49
Gauss-Jordan Method
Example
50
Gauss-Jacobi’s iteration
method
Solution:
Solution:
66
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Motivation
Given a set of experimental data:
x 1 2 3
y 5.1 5.9 6.3
67
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Motivation - Curve Fitting
Given a set of tabulated data, find a curve or a
function that best represents the data.
Given:
1. The tabulated data
2. The form of the function
3. The curve fitting criteria
68
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Least Squares Regression
Linear Regression
• Fitting a straight line to a set of paired observations:
(x1, y1), (x2, y2),…,(xn, yn).
y=a0+a1x+e
a1-slope.
a0-intercept.
e-error, or residual, between the model and the observations.
69
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Selection of the Functions
•
70
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Decide on the Criterion
•
71
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Least Squares
Given: xi x1 x2 …. xn
yi y1 y2 …. yn
72
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Determine the Unknowns
•
73
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Determine the Unknowns
•
74
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Example 1
x 1 2 3
• y 5.1 5.9 6.3
75
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Remember
•
76
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Example 1
•
77
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Example 1
i 1 2 3 sum
xi 1 2 3 6
x i2 1 4 9 14
78
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Example 1
79
06/10/2024 Department of CSE, Chittagong University of Engineering & Technology
Do the same for Quadratic Equations