Numerical
Methods
Lecture-1
[MA-200]
ARISHA ALI
Numerical Method
The process of obtaining a solution is to reduce the original problem to a
repetition of the same step or series of steps so that computations become
automatic such a process is called a numerical methods and a numerical method,
which can be used to solve a problem is called algorithm.
 Numerical methods are algorithms:
 Precise sets of rules to follow.
 Generate a Numerical approximation of the mathematical problem.
 Do not tell how good/poor approximation is.
2
ARISHAALI
Need of Numerical Methods
 Analytical Methods may not exist at all to solve the problem.
 Analytical methods exist but are time consuming, very laborious to apply or
may be huge data is involved or may not be easily computed.
3
ARISHAALI
Error
Error is the difference between the actual value and Approximated (Calculated)
value.
If we denote the actual value with 𝒙 and the calculated value with 𝒙∗
then error will be,
∈ = 𝐸 = 𝑥 − 𝑥∗
4
ARISHAALI
Example
𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟖𝟗𝟑 𝑎𝑛𝑑 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑑 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟔𝟕𝟐
𝑆𝑜, 𝐸𝑟𝑟𝑜𝑟 = 𝟎. 𝟐𝟐𝟏
𝐸𝑟𝑟𝑜𝑟 𝑚𝑎𝑦 𝑏𝑒 𝑛𝑒𝑔𝑎𝑡𝑖𝑣𝑒, 𝑜𝑟 𝑒𝑟𝑟𝑜𝑟 𝑚𝑎𝑦 𝑏𝑒 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒
𝐼𝑓 𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟔𝟕𝟐 𝑎𝑛𝑑 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑑 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟖𝟗𝟑
𝑆𝑜, 𝐸𝑟𝑟𝑜𝑟 = −𝟎. 𝟐𝟐𝟏
5
ARISHAALI
Example
The derivative of a function 𝑓 𝑥 at a particular value of 𝑥 can be approximately
calculated by
𝑓′ 𝑥 ≡
𝑓 𝑥 + ℎ − 𝑓(𝑥)
ℎ
Find 𝑓′
2 for 𝑓 𝑥 = 7𝑒0.5𝑥
and ℎ = 0.3, Find
a) The approximate value of 𝑓′ 2
b) The actual value of 𝑓′ 2
c) The Error
6
ARISHAALI
Cont…
a) 𝑓′ 𝑥 ≡
𝑓 𝑥+ℎ −𝑓(𝑥)
ℎ
,
𝑥 = 2 𝑎𝑛𝑑 ℎ = 0.3
𝑓′ 2 ≡
𝑓 2 + 0.3 − 𝑓(2)
0.3
𝑓′ 2 =
𝑓 2.3 − 𝑓(2)
0.3
=
22.107 − 19.028
0.3
= 10.265
7
ARISHAALI
Cont…
b) 𝑓 𝑥 = 7𝑒0.5𝑥
𝑓′
𝑥 = 7 ∗ 0.5 ∗ 𝑒0.5𝑥
𝑓′ 2 = 7 ∗ 0.5 ∗ 𝑒0.5(2)
= 9.5140
c) Error = Actual Value – Approximated Value
𝐸𝑟𝑟𝑜𝑟 = 9.5140 − 10.265
= −0.75061
8
ARISHAALI
Types of Error
We have three types of errors
 Absolute Error
 Relative Error
 Percentage Error
9
ARISHAALI
Absolute Error
If 𝒙 is the actual value and 𝒙∗ is the calculated value, then
𝐴. 𝐸 = 𝐸𝑎 = |𝑥 − 𝑥∗|
For example,
𝐼𝑓 𝑝 = 0.3000 ∗ 101
𝑎𝑛𝑑 𝑝∗
= 0.3100 ∗ 101
𝐸𝑎 = −0.1 = 0.1
10
ARISHAALI
Relative Error
Relative error is the ratio of the absolute error to the actual value
𝑅. 𝐸 = 𝐸𝑅 =
𝐸𝑎
|𝑥|
=
|𝑥−𝑥∗|
|𝑥|
For example,
𝐼𝑓 𝑃 = 0.3000 ∗ 101
𝑎𝑛𝑑 𝑝∗
= 0.3100 ∗ 101
𝐸𝑅 =
𝐸𝑎
|𝑝|
=
0.1
|0.30000 ∗101|
= 0.03333 = 0.3333 ∗ 10−1
11
ARISHAALI
Percentage Error
Relative Error expresses in terms of a percentage error
𝑃. 𝐸 =
𝐸𝑎
|𝑥|
∗ 100
For example,
𝐼𝑓 𝑃 = 0.3000 ∗ 101
𝑎𝑛𝑑 𝑝∗
= 0.3100 ∗ 101
𝐸𝑅 =
𝐸𝑎
|𝑝|
=
0.1
|0.30000 ∗101|
= 0.03333 = 0.3333 ∗ 10−1
𝑃. 𝐸 =
𝐸𝑎
|𝑝|
∗ 100 = 0.03333 ∗ 100 = 3.333%
12
ARISHAALI
If we Don’t have Actual Value
 𝐴. 𝐸 = 𝐸𝑎 = |𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒 − 𝑃𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒|
 𝑅. 𝐸 = 𝐸𝑅 =
𝐸𝑎
|𝑥|
=
|𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐸𝑠𝑖𝑡𝑖𝑚𝑎𝑡𝑒 −𝑃𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒|
|𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒|
𝑃. 𝐸 =
𝐸𝑎
|𝑥|
∗ 100
13
ARISHAALI
Homework
 If 𝑃 = 0.3000 ∗ 10−3
𝑎𝑛𝑑 𝑝∗
= 0.3100 ∗ 10−3
, Find the absolute error and
relative error and percentage error.
 If 𝑃 = 0.3000 ∗ 104
𝑎𝑛𝑑 𝑝∗
= 0.3100 ∗ 104
, Find the absolute error and
relative error and percentage error
14
ARISHAALI
Significant Digits
A significant digit in a number is a digit which gives a reliable information about
the size of a number
Rules:
 Every nonzero digit is significant E.g.,
 8.7456 has five significant digits
 495 has three significant digits
 Zero between nonzero digits are always significant. E.g.
 2047 has four significant digits,
 50.032 has five significant digits.
15
ARISHAALI
Cont…
 Zeros before nonzero digits are not significant. E.g,
 0.0123 has three significant digits
 0.00000000123 has three significant digits
 Zeros after decimal point are significant. E.g,
 3.000 has four significant digits.
 Zeros behind significant numbers are sometimes significant E.g,
 2000 has one significant digit.
16
ARISHAALI
Examples
 6.4320 ℎ𝑎𝑠 𝑓𝑖𝑣𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
 0.06432 ℎ𝑎𝑠 𝑓𝑜𝑢𝑟 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
 64 ℎ𝑎𝑠 𝑡𝑤𝑜 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
 64.0 ℎ𝑎𝑠 𝑡ℎ𝑟𝑒𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
 6.432 ∗ 104 ℎ𝑎𝑠 𝑓𝑜𝑢𝑟 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
 6.43200 ℎ𝑎𝑠 𝑠𝑖𝑥 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠
 5000 ℎ𝑎𝑠 𝑜𝑛𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡
17
ARISHAALI
Rounding the Numbers
Rule 1:
 If the last digit is less than 5 then it is simply dropped.
 e.g., 1.943 is rounded to 1.94
Rule 2:
 If the last digit is greater than 5 then the previous digit increased by one.
 e.g., 1.47 is rounded to 1.5
Rule 3:
 If the last digit is 5, then it is rounded to get nearest even
 e.g., 1.35 is rounded to 1.4 & 1.45 is rounded to 1.4
18
ARISHAALI
19

Lecture #1.pdf

  • 1.
  • 2.
    Numerical Method The processof obtaining a solution is to reduce the original problem to a repetition of the same step or series of steps so that computations become automatic such a process is called a numerical methods and a numerical method, which can be used to solve a problem is called algorithm.  Numerical methods are algorithms:  Precise sets of rules to follow.  Generate a Numerical approximation of the mathematical problem.  Do not tell how good/poor approximation is. 2 ARISHAALI
  • 3.
    Need of NumericalMethods  Analytical Methods may not exist at all to solve the problem.  Analytical methods exist but are time consuming, very laborious to apply or may be huge data is involved or may not be easily computed. 3 ARISHAALI
  • 4.
    Error Error is thedifference between the actual value and Approximated (Calculated) value. If we denote the actual value with 𝒙 and the calculated value with 𝒙∗ then error will be, ∈ = 𝐸 = 𝑥 − 𝑥∗ 4 ARISHAALI
  • 5.
    Example 𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒 =𝟕. 𝟖𝟗𝟑 𝑎𝑛𝑑 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑑 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟔𝟕𝟐 𝑆𝑜, 𝐸𝑟𝑟𝑜𝑟 = 𝟎. 𝟐𝟐𝟏 𝐸𝑟𝑟𝑜𝑟 𝑚𝑎𝑦 𝑏𝑒 𝑛𝑒𝑔𝑎𝑡𝑖𝑣𝑒, 𝑜𝑟 𝑒𝑟𝑟𝑜𝑟 𝑚𝑎𝑦 𝑏𝑒 𝑝𝑜𝑠𝑖𝑡𝑖𝑣𝑒 𝐼𝑓 𝐴𝑐𝑡𝑢𝑎𝑙 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟔𝟕𝟐 𝑎𝑛𝑑 𝐴𝑝𝑝𝑟𝑜𝑥𝑖𝑚𝑎𝑡𝑒𝑑 𝑉𝑎𝑙𝑢𝑒 = 𝟕. 𝟖𝟗𝟑 𝑆𝑜, 𝐸𝑟𝑟𝑜𝑟 = −𝟎. 𝟐𝟐𝟏 5 ARISHAALI
  • 6.
    Example The derivative ofa function 𝑓 𝑥 at a particular value of 𝑥 can be approximately calculated by 𝑓′ 𝑥 ≡ 𝑓 𝑥 + ℎ − 𝑓(𝑥) ℎ Find 𝑓′ 2 for 𝑓 𝑥 = 7𝑒0.5𝑥 and ℎ = 0.3, Find a) The approximate value of 𝑓′ 2 b) The actual value of 𝑓′ 2 c) The Error 6 ARISHAALI
  • 7.
    Cont… a) 𝑓′ 𝑥≡ 𝑓 𝑥+ℎ −𝑓(𝑥) ℎ , 𝑥 = 2 𝑎𝑛𝑑 ℎ = 0.3 𝑓′ 2 ≡ 𝑓 2 + 0.3 − 𝑓(2) 0.3 𝑓′ 2 = 𝑓 2.3 − 𝑓(2) 0.3 = 22.107 − 19.028 0.3 = 10.265 7 ARISHAALI
  • 8.
    Cont… b) 𝑓 𝑥= 7𝑒0.5𝑥 𝑓′ 𝑥 = 7 ∗ 0.5 ∗ 𝑒0.5𝑥 𝑓′ 2 = 7 ∗ 0.5 ∗ 𝑒0.5(2) = 9.5140 c) Error = Actual Value – Approximated Value 𝐸𝑟𝑟𝑜𝑟 = 9.5140 − 10.265 = −0.75061 8 ARISHAALI
  • 9.
    Types of Error Wehave three types of errors  Absolute Error  Relative Error  Percentage Error 9 ARISHAALI
  • 10.
    Absolute Error If 𝒙is the actual value and 𝒙∗ is the calculated value, then 𝐴. 𝐸 = 𝐸𝑎 = |𝑥 − 𝑥∗| For example, 𝐼𝑓 𝑝 = 0.3000 ∗ 101 𝑎𝑛𝑑 𝑝∗ = 0.3100 ∗ 101 𝐸𝑎 = −0.1 = 0.1 10 ARISHAALI
  • 11.
    Relative Error Relative erroris the ratio of the absolute error to the actual value 𝑅. 𝐸 = 𝐸𝑅 = 𝐸𝑎 |𝑥| = |𝑥−𝑥∗| |𝑥| For example, 𝐼𝑓 𝑃 = 0.3000 ∗ 101 𝑎𝑛𝑑 𝑝∗ = 0.3100 ∗ 101 𝐸𝑅 = 𝐸𝑎 |𝑝| = 0.1 |0.30000 ∗101| = 0.03333 = 0.3333 ∗ 10−1 11 ARISHAALI
  • 12.
    Percentage Error Relative Errorexpresses in terms of a percentage error 𝑃. 𝐸 = 𝐸𝑎 |𝑥| ∗ 100 For example, 𝐼𝑓 𝑃 = 0.3000 ∗ 101 𝑎𝑛𝑑 𝑝∗ = 0.3100 ∗ 101 𝐸𝑅 = 𝐸𝑎 |𝑝| = 0.1 |0.30000 ∗101| = 0.03333 = 0.3333 ∗ 10−1 𝑃. 𝐸 = 𝐸𝑎 |𝑝| ∗ 100 = 0.03333 ∗ 100 = 3.333% 12 ARISHAALI
  • 13.
    If we Don’thave Actual Value  𝐴. 𝐸 = 𝐸𝑎 = |𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒 − 𝑃𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒|  𝑅. 𝐸 = 𝐸𝑅 = 𝐸𝑎 |𝑥| = |𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐸𝑠𝑖𝑡𝑖𝑚𝑎𝑡𝑒 −𝑃𝑟𝑒𝑣𝑖𝑜𝑢𝑠 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒| |𝐶𝑢𝑟𝑟𝑒𝑛𝑡 𝐸𝑠𝑡𝑖𝑚𝑎𝑡𝑒| 𝑃. 𝐸 = 𝐸𝑎 |𝑥| ∗ 100 13 ARISHAALI
  • 14.
    Homework  If 𝑃= 0.3000 ∗ 10−3 𝑎𝑛𝑑 𝑝∗ = 0.3100 ∗ 10−3 , Find the absolute error and relative error and percentage error.  If 𝑃 = 0.3000 ∗ 104 𝑎𝑛𝑑 𝑝∗ = 0.3100 ∗ 104 , Find the absolute error and relative error and percentage error 14 ARISHAALI
  • 15.
    Significant Digits A significantdigit in a number is a digit which gives a reliable information about the size of a number Rules:  Every nonzero digit is significant E.g.,  8.7456 has five significant digits  495 has three significant digits  Zero between nonzero digits are always significant. E.g.  2047 has four significant digits,  50.032 has five significant digits. 15 ARISHAALI
  • 16.
    Cont…  Zeros beforenonzero digits are not significant. E.g,  0.0123 has three significant digits  0.00000000123 has three significant digits  Zeros after decimal point are significant. E.g,  3.000 has four significant digits.  Zeros behind significant numbers are sometimes significant E.g,  2000 has one significant digit. 16 ARISHAALI
  • 17.
    Examples  6.4320 ℎ𝑎𝑠𝑓𝑖𝑣𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠  0.06432 ℎ𝑎𝑠 𝑓𝑜𝑢𝑟 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠  64 ℎ𝑎𝑠 𝑡𝑤𝑜 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠  64.0 ℎ𝑎𝑠 𝑡ℎ𝑟𝑒𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠  6.432 ∗ 104 ℎ𝑎𝑠 𝑓𝑜𝑢𝑟 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠  6.43200 ℎ𝑎𝑠 𝑠𝑖𝑥 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡𝑠  5000 ℎ𝑎𝑠 𝑜𝑛𝑒 𝑠𝑖𝑔𝑛𝑖𝑓𝑖𝑐𝑎𝑛𝑡 𝑑𝑖𝑔𝑖𝑡 17 ARISHAALI
  • 18.
    Rounding the Numbers Rule1:  If the last digit is less than 5 then it is simply dropped.  e.g., 1.943 is rounded to 1.94 Rule 2:  If the last digit is greater than 5 then the previous digit increased by one.  e.g., 1.47 is rounded to 1.5 Rule 3:  If the last digit is 5, then it is rounded to get nearest even  e.g., 1.35 is rounded to 1.4 & 1.45 is rounded to 1.4 18 ARISHAALI
  • 19.