Lecture 1
Lecture 1
Topic 1:
Introduction to Numerical Methods and
Taylor Series
Sections 1-3:
1
Reference: Dr. Nabil Slides, Dr. Amena Slides
Section 1
Introduction to Numerical
Analysis
2
Reference book
3
Numerical Analysis
Numerical Analysis:
Algorithms that are used to obtain numerical
solutions of a mathematical problem.
Why do we need them?
1. No analytical solution exists,
2. An analytical solution is difficult to obtain
or not practical.
4
What do we need?
Basic Needs in the Numerical Analysis:
Practical:
Can be computed in a reasonable amount of time.
Accurate:
Good approximate to the true value,
Information about the approximation error
5
Outlines of the Course
Taylor Theorem Solution of linear
Number Equations
Representation Least Squares curve
Solution of nonlinear fitting
Equations Solution of ordinary
Interpolation differential equations
Numerical Solution of Partial
Differentiation differential equations
Numerical Integration
6
Solution of Nonlinear
Equations
Some simple equations can be solved analytically:
x 2 4 x 3 0
4 4 2 4(1)(3)
Analytic solution roots
2(1)
x 1 and x 3
Many other equations have no analytical solution:
x 9 2 x 2 5 0
x No analytic solution
x e
7
Methods for Solving Nonlinear
Equations
o Bisection Method
o Method of False Position
o Fixed-Point Iteration
o Newton-Raphson Method
o Secant Method
8
Solution of Systems of Linear
Equations
x1 x2 3
x1 2 x2 5
We can solve it as :
x1 3 x2 , 3 x2 2 x2 5
x2 2, x1 3 2 1
What to do if we have
1000 equations in 1000 unknowns.
9
Cramer’s Rule is Not
Practical
Cramer' s Rule can be used to solve the system :
3 1 1 3
5 2 1 5
x1 1, x2 2
1 1 1 1
1 2 1 2
11
Curve Fitting
Given a set of data:
x 0 1 2
y 0.5 10.3 21.3
12
Interpolation
Given a set of data:
xi 0 1 2
yi 0.5 10.3 15.3
yi P ( xi ) if xi is in the table
13
Methods for Curve Fitting
o Least Squares
o Linear Regression
o Nonlinear Least Squares Problems
o Interpolation
o Newton Polynomial Interpolation
o Lagrange Interpolation
o Quadratic Splines
14
Integration
Some functions can be integrated
analytically:
3 3
1 2 9 1
1
xdx x 4
2 1 2 2
But many functions have no analytical solutions :
a
x2
e
0
dx ?
15
Methods for Numerical
Integration
o Trapezoid Method
o Simpson’s Rule
o Gauss Quadrature
16
Solution of Ordinary Differential
Equations
A solution to the differential equation :
x(t ) 3 x (t ) 3 x(t ) 0
x (0) 1; x(0) 0
is a function x(t) that satisfies the equations.
2 2
u u
2
2
2 0
x t
u (0, t ) u (1, t ) 0, u ( x,0) sin(x)
18
Summary
Topics Covered in the Course
Numerical Analysis:
Algorithms that are
Solution of Nonlinear Equations
used to obtain Solution of Linear Equations
numerical solution of a Curve Fitting
mathematical problem.
Least Squares
We need them when
No analytical solution
Interpolation
exists or it is difficult to Numerical Integration
obtain it. Numerical Differentiation
Solution of Ordinary Differential
Equations
Solution of Partial Differential
Equations
19
Section 2
Number Representation and
Accuracy
Number Representation
Normalized Floating Point Representation
Significant Digits
Accuracy and Precision
Rounding and Chopping
20
Representing Real Numbers
You are familiar with the decimal system:
Standard Representations:
3 1 2 . 4 5
sign integral fraction
part part
21
Normalized Floating Point
Representation
Normalized Floating Point Representation:
d . f1 f 2 f 3 f 4 10n
sign mantissa exponent
22
Binary System
Binary System: Base = 2, Digits {0,1}
1. f1 f 2 f 3 f 4 2 n
sign mantissa signed exponent
23
Fact
Numbers that have a finite expansion in one numbering
system may have an infinite expansion in another
numbering system:
24
IEEE 754 Floating-Point
Standard
Single Precision (32-bit representation)
1-bit Sign + 8-bit Exponent + 23-bit Fraction
S Exponent8 Fraction23
S Exponent11 Fraction52
(continued)
25
Significant Digits
CISE301_Topic1 26
Calculator Example
Suppose you want to compute:
3.578 * 2.139
using a calculator with two-digit fractions
27
Significant Digits - Example
48.9
28
Significant
Figures
• Number of significant figures indicates precision.
• Significant digits of a number are those that can be used with
confidence, e.g., the number of certain digits plus one
estimated digit.
3.14159
0.00082
0.000820
3009
250
250.0
and 1000?
34
35
Rounding and Chopping
Rounding: Replace the number by the nearest
machine number.
36
Error Definitions – True Error
37
Error Definitions – Estimated
Error
38
Notation
We say that the estimate is correct to n
decimal digits if:
n
Error 10
39
Summary
Number Representation
Numbers that have a finite expansion in one numbering system
may have an infinite expansion in another numbering system.
40