Numerical Computation Fundamentals
Binary numbers
Binary numbers are expressed as
where each binary digit, or bit, is 0 or 1. The base 10 equivalent to the number is
EXAMPLE:
The decimal number 4 is expressed as
Decimal to Binary
To convert a decimal number to binary, it is simplest to break the number into integer and fractional parts and convert each part separately.
Integer part. Convert decimal integers to binary dividing by 2 successively and recording the remainders.
53 ÷ 2 = 26 R 1
26 ÷ 2 = 13 R 0
13 ÷ 2 = 6 R 1
6 ÷ 2 = 3 R 0
3 ÷ 2 = 1 R 1
1 ÷ 2 = 0 R 1Therefore, the base 10 number 53 can be written in bits as 110101, denoted as
Fractional part. Convert
0.7 × 2 = 1.4 → 1
0.4 × 2 = 0.8 → 0
0.8 × 2 = 1.6 → 1
0.6 × 2 = 1.2 → 1
0.2 × 2 = 0.4 → 0
0.4 × 2 = 0.8 → 0
...Therefore,
where overbar notation is used to denote infinitely repeated bits. Putting the two parts together, we conclude that
Binary to Decimal
To convert a binary number to decimal, it is again best to separate into integer and fractional parts.
Integer part: Simply add up powers of 2. The binary number
Fractional part: If the fractional part is finite, proceed the same way
When the fractional part is not a finite base 2 expansion.
EXAMPLE:
When the fractional part is not a finite base 2 expansion, we can use the shift property of multiplication by 2.
Suppose
Subtracting yields
Then solve for
Floating point representation of real numbers
A floating point number consists of three parts: the sign (+ or −), a mantissa, which contains the string of significant bits, and an exponent. The three parts are stored together in a single computer word. The form of a normalized floating point number is
where each of the
The double precision format, common in C compilers, Python, and MATLAB, uses exponent length
The floating-point form of
Chopping
Chop off the digits
Rounding
Adds
When
EXAMPLE:
(a) The floating-point form of
(b) The floating-point form of
Correct within 𝑝 decimal places
A Solution is correct within
Absolute Error & Relative Error
DEFINITION: Let
and
EXAMPLE:
(a)
(b)
Same relative error,
Loss of significance
Assume that through considerable effort, as part of a long calculation, we have determined two numbers correct to seven significant digits, and now need to subtract them:
Let’s write the subtraction in normalized decimal float-point:
The subtraction problem began with two input numbers that we knew to seven-digit accuracy, and ended with a result that has only one-digit accuracy. It is called loss of significance, and in many cases this can be avoided by restructuring the calculation.
Convergence
To calculate convergence, we usually try to estimate the error in the numerical solution compared to the actual solution. We try to find out how fast this error is decreasing (or increasing).
DEFINITION:
Suppose
then we say that
DEFINITION:
Let
DEFINITION:
We say that the algorithm has linear convergence if
DEFINITION:
We say that the algorithm has quadratic convergence if
设误差为
其中
若存在常数
则称该方法具有 p 阶收敛(order of convergence = p)。
| 收敛类型 | 条件 | 特征 | 示例 |
|---|---|---|---|
| 线性收敛(Linear) | 误差按比例缩小 | 二分法、FPI | |
| 超线性收敛(Superlinear) | 介于线性与二次之间 | 割线法 | |
| 二次收敛(Quadratic) | 误差平方级减少 | 牛顿法 |
Review of calculus
Limits and Continuity

DEFINITION:
A function
if, given any real number
whenever
DEFINITION:
Let
The function
DEFINITION:
Let
means that the sequence
THEOREM:
If
a.
b. If
Differentiability
DEFINITION:
Let
exists. The number
THEOREM:
If the function
THEOREM (Rolle’s Theorem):
Suppose

THEOREM (Mean Value Theorem):
If

THEOREM (Intermediate Value Theorem):
If

Integration
DEFINITION:
The Riemann integral of the function
where the numbers

Taylor Polynomials and Series
THEOREM (Taylor’s Theorem):
Suppose
where
and
Here
The infinite series obtained by taking the limit of
The term truncation error in the Taylor polynomial refers to the error involved in using a truncated, or finite, summation to approximate the sum of an infinite series.
Example
Let
a. The second Taylor polynomial for
b. The third Taylor polynomial for
SOLUTION:
So
a.
where

When
Since
Furthermore, since
Substitute into the remainder, the error is in the region
b. Since
where
The approximating polynomial remains the same, and the approximation is still
So,