0% found this document useful (0 votes)
20 views

STA 122 Notes Part II

Uploaded by

faithsyokau04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

STA 122 Notes Part II

Uploaded by

faithsyokau04
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

STA122: Computational Methods and Data Analysis I

2. Number systems
Number System is a method of representing Numbers on the Number Line with the help
of a set of Symbols and rules.
These symbols range from 0-9 and are termed as digits.
Number System is used to perform mathematical computations ranging from great
scientific calculations to calculations like counting the number of Toys for a Kid or
Number chocolates remaining in the box.
Number Systems comprise of multiple types based on the base value for its digits.

2.1 The Number Line


A Number line is a representation of Numbers with a fixed interval in between on a
straight line.
A Number line contains all the types of numbers like natural numbers, rationals,
Integers, etc.
Numbers on the number line increase while moving Left to Right and decrease while
moving from right to left.
Ends of a number line are not defined i.e., numbers on a number line range from infinity
on the left side of the zero to infinity on the right side of the zero.

A number is a value created by the combination of digits with the help of certain rules.
These numbers are used to represent arithmetical quantities.
A digit is a symbol from a set 10 symbols ranging from 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9. Any
combination of digits represents a Number.
The size of a Number depends on the count of digits that are used for its creation.

Types of Numbers
Natural Numbers: Natural Numbers are the most basic type of Numbers that range
from 1 to infinity. These numbers are also called Positive Numbers or Counting
Numbers. Natural Numbers are represented by the symbol N.
Example: 1, 2, 3, 4, 5, 6, 7, and so on.

Whole Numbers: Whole Numbers are basically the Natural Numbers, but they also
include ‘zero’. Whole numbers are represented by the symbol W.
Example: 0, 1, 2, 3, 4, and so on.
Integers: Integers are the collection of Whole Numbers plus the negative values of the
Natural Numbers. Integers do not include fraction numbers i.e. they can’t be written in
a/b form. The range of Integers is from the Infinity at the Negative end and Infinity at
the Positive end, including zero. Integers are represented by the symbol Z.
Example: ...,-4, -3, -2, -1, 0, 1, 2, 3, 4,...

Fractions: Fractions are the numbers that are written in the form of a/b, where, a
belongs to Whole numbers and b belongs to Natural Numbers, i.e., b can never be 0. The
upper part of the fraction i.e. a is termed as a Numerator whereas the lower part i.e. b
is called Denominator.
Example: 1/2, 3/7, 8/3, etc.

Rational Numbers: Rational numbers are the numbers that can be represented in the
fraction form i.e. a/b. Here, a and b both are integers and b≠0. All the fractions are
rational numbers but not all the rational numbers are fractions.
Example: -2/5, 0.54, 1/5, 13/4, ...

Irrational Numbers: Irrational numbers are the numbers that can’t be represented in
the form of fractions i.e. they can not be written as a/b.
Example: √2, √3, √.434343, π...

Real and Imaginary Numbers: Real numbers are the numbers that can be represented
in the decimal form. These numbers include whole numbers, integers, fractions, etc. All
the integers belong to Real numbers but all the real numbers do not belong to the
integers. Imaginary Numbers are all those numbers that are not real numbers. These
numbers when squared will result in a negative number. The √-1 is represented as i.
These numbers are also called complex numbers.
Example: √-2, √-5,...

Prime Numbers and Composite Numbers: Numbers that do not have any factors
other than 1 and the number itself are termed as Prime Numbers.
All the numbers other than Prime Numbers are termed as Composite Numbers except
0.
Zero is neither prime nor a composite number.
Example: 2, 3, 5, 7,... are prime numbers and
4, 6, 8, 9, 12,... are composite numbers

Types of Number Systems


Based on the base value and the number of allowed digits, number systems are of many
types. The four common types of Number System are:
1. Decimal Number System
2. Binary Number System
3. Octal Number System
4. Hexadecimal Number System

Decimal Number System


Number system with base value 10 is termed as Decimal number system. It uses 10
digits i.e. 0-9 for the creation of numbers. Here, each digit in the number is at a specific
place with place value a product of different powers of 10. Here, the place value is
termed from right to left as first place value called units, second to the left as Tens, so
on Hundreds, Thousands, etc. Here, units has the place value as 100, tens has the place
value as 101, hundreds as 102, thousands as 103, and so on.
For example: 10285 has place values as

(1 × 104) + (0 × 103) + (2 × 102) + (8 × 101) + (5 × 100)

1 × 10000 + 0 × 1000 + 2 × 100 + 8 × 10 + 5 × 1

10000 + 0 + 200 + 80 + 5

10285

Binary Number System


Number System with base value 2 is termed as Binary number system. It uses 2 digits
i.e. 0 and 1 for the creation of numbers. The numbers formed using these two digits are
termed as Binary Numbers. Binary number system is very useful in electronic devices
and computer systems because it can be easily performed using just two states ON and
OFF i.e. 0 and 1.

Decimal Numbers 0-9 are represented in binary as: 0, 1, 10, 11, 100, 101, 110, 111,
1000, and 1001

Examples:

14 can be written as 1110

19 can be written as 10011

50 can be written as 110010

Octal Number System


Octal Number System is one in which the base value is 8. It uses 8 digits i.e. 0-7 for
creation of Octal Numbers. Octal Numbers can be converted to Decimal value by
multiplying each digit with the place value and then adding the result. Here the place
values are 80, 81, and 82. Octal Numbers are useful for the representation of UTF8
Numbers.

Example:

(135)10 can be written as (207)8

(215)10 can be written as (327)8

Hexadecimal Number System


Number System with base value 16 is termed as Hexadecimal Number System. It uses
16 digits for the creation of its numbers. Digits from 0-9 are taken like the digits in the
decimal number system but the digits from 10-15 are represented as A-F i.e. 10 is
represented as A, 11 as B, 12 as C, 13 as D, 14 as E, and 15 as F. Hexadecimal Numbers
are useful for handling memory address locations.

Examples:
(255)10 can be written as (FF)16
(1096)10 can be written as (448)16

(4090)10 can be written as (FFA)16

Conversion of Number Systems


Conversion between numbers systems is quite an easy task. Any number from any
number system can be converted to other number systems with the help of certain
methods that will be discussed below
1. Conversion from Decimal Number System to Other Number Systems
Decimal Numbers are represented with digits 0-9 and with base 10. Conversion of a
number system means conversion from one base to another. Following are the
conversion of the Decimal Number System to other Number Systems:
A. Decimal to Binary Conversion:
Decimal numbers are represented in base 10, but the binary numbers are of base 2.
Hence, to convert a decimal number to binary number, the base of that number is to
be changed. Follow the steps given below:
 Step 1: Divide the Decimal Number with the base of the number system to be
converted to. Here the conversion is to binary, hence the divisor will be 2.
 Step 2: The remainder obtained from the division will become the least significant
digit of the new number.
 Step 3: The quotient obtained from the division will become the next dividend and
will be divided by base i.e. 2.
 Step 4: The remainder obtained will become the second least significant digit i.e.
it will be added in the left of the previously obtained digit.
Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the
remainders obtained after each iteration are added to the left of the existing digits.
After all the iterations are over, the last obtained remainder will be termed as the
Most Significant digit.

Example: (131)10

Divide 131 by 2 and continue till you get the quotient as 0.


1. Divide 131 by 2, we get the quotient as 65 and remainder as 1

2. Divide 65 by 2, we get 32, remainder as 1

3. Divide 32 by 2, we get 16, and remainder as 0


4. Divide 16 by 2, we get 8 and remainder as 0

5. Divide 8 by 2, we get 4, and remainder as 0

6. Divide 4 by 2, then 2 by 2, and finally divide 1 by 2, with the quotient as 0, we get


the remainder as 1
Starting from LSB to MSB, write the binary system so formed:

(10000011)2

B. Decimal to Octal Conversion:


Octal Numbers are represented in base 8. Hence, to convert a decimal number to octal
number, the base of that number is to be changed. Follow the steps given below:
 Step 1: Divide the Decimal Number with the base of the number system to be
converted to. Here the conversion is to octal, hence the divisor will be 8.
 Step 2: The remainder obtained from the division will become the least significant
digit of the new number.
 Step 3: The quotient obtained from the division will become the next dividend and
will be divided by base i.e. 8.
 Step 4: The remainder obtained will become the second least significant digit i.e.
it will be added in the left of the previously obtained digit.
Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the
remainders obtained after each iteration are added to the left of the existing digits.

C. Decimal to Hexadecimal Conversion:


Hexadecimal Numbers are represented in base 16. Hence, to convert a decimal
number to hexadecimal number, the base of that number is to be changed. Follow the
steps given below:
 Step 1: Divide the Decimal Number with the base of the number system to be
converted to. Here the conversion is to Hex hence the divisor will be 16.
 Step 2: The remainder obtained from the division will become the least significant
digit of the new number.
 Step 3: The quotient obtained from the division will become the next dividend and
will be divided by base i.e. 16.
 Step 4: The remainder obtained will become the second least significant digit i.e.
it will be added in the left of the previously obtained digit.
Now, the steps 3 and 4 are repeated until the quotient obtained becomes 0, and the
remainders obtained after each iteration are added to the left of the existing digits.
2. Conversion from Binary Number System to Other Number Systems

Binary Numbers are represented with digits 0 and 1 and with base 2. Conversion of a
number system means conversion from one base to another. Following are the
conversion of the Binary Number System to other Number Systems:
A. Binary to Decimal Conversion:
Binary numbers are represented in base 2 but the decimal numbers are of base 10.
Hence, to convert the binary number into a decimal number, the base of that number
is to be changed. Follow the steps given below:
 Step 1: Multiply each digit of the Binary number with the place value of that digit,
starting from right to left i.e. from LSB to MSB.
 Step 2: Add the result of this multiplication and the decimal number will be
formed.
Example: To convert (11101011)2 into a decimal number

Example: 1101001

Starting from the least significant bit from 20, then 21, till the nth most significant bit,
i.e., 2ⁿ.
1 = 2⁰ = 1
1 = 2³.1 = 8
0 = 2⁴ .0= 0
1 = 2⁵ = 32
1 = 2⁶ = 64

Now, adding all these:

= 1 + 0 + 0 + 8 + 0 + 32 + 64 = (105)10
B. Binary to Octal Conversion:
Binary numbers are represented in base 2 but the octal numbers are of base 8. Hence,
to convert the binary number into octal number, the base of that number is to be
changed. Follow the steps given below:
 Step 1: Divide the binary number into groups of three digits starting from right to
left i.e. from LSB to MSB.
 Step 2: Convert these groups into equivalent octal digits.
Example: To convert (11101011)2 into an octal number

C. Binary to Hexadecimal Conversion:


Binary numbers are represented in base 2 but the Hexadecimal numbers are of base
10. Hence, to convert the binary number into Hex number, the base of that number is
to be changed. Follow the steps given below:
 Step 1: Divide the binary number into groups of four digits starting from right to
left i.e. from LSB to MSB.
 Step 2: Convert these groups into equivalent hex digits.
Example: To convert (1110101101101) 2 into a hex number

Example: 101010001

We know that hexadecimal means 16, so we will start from the least significant bit and
make groups of 4 bits:
First pair = 0001 = 1
Second pair = 0101 = 5
Third pair = 0001 = 1

So, the hexadecimal equivalent will be (151)16.


3. Conversion from Octal Number System to Other Number Systems

Octal Numbers are represented with digits 0-7 and with base 8. Conversion of a
number system means conversion from one base to another. Following are the
conversions of the Octal Number System to other Number Systems:
A. Octal to Decimal Conversion:
Octal numbers are represented in base 8, but the decimal numbers are of base 10.
Hence, to convert an octal number to a decimal number, the base of that number is to
be changed. Follow the steps given below:
 Step 1: Multiply each digit of the Octal number with the place value of that digit,
starting from right to left i.e. from LSB to MSB.
 Step 2: Add the result of this multiplication and the decimal number will be
formed.
Example:

B. Octal to Binary Conversion:


Octal numbers are represented in base 8, but the binary numbers are of base 2. Hence,
to convert an octal number to a binary number, the base of that number is to be
changed. Follow the steps given below:
 Step 1: Write each digit of the octal number separately.
 Step 2: Convert each digit into an equivalent group of three binary digits.
 Step 3: Combine these groups to form the whole binary number.
Example: (247)8 is to be converted to binary

C. Octal to Hexadecimal Conversion:


Octal numbers are represented in base 8, but the hexadecimal numbers are of base
16. Hence, to convert an octal number to a hex number, the base of that number is to
be changed. Follow the steps given below:
 Step 1: We need to convert the Octal number to Binary first. For that, follow the
steps given in the above conversion.
 Step 2: Now to convert the binary number to Hex number, divide the binary digits
into groups of four digits starting from right to left i.e. from LSB to MSB.
 Step 3: Add zeros prior to MSB to make it a proper group of four digits(if required)
 Step 4: Now convert these groups into their relevant decimal values.
 Step 5: For values from 10-15, convert it into Hex symbols i.e from A-F
Example: (5456)8 is to be converted to hex

4. Conversion from Hexadecimal Number System to Other Number Systems

Hex Numbers are represented with digits 0-9 and with letters A-F and with base 16.
Conversion of a number system means conversion from one base to another.
Following are the conversions of the Hexadecimal Number System to other Number
Systems:
A. Hexadecimal to Decimal Conversion:
Hexadecimal numbers are represented in base 16 but the decimal numbers are of base
10. Hence, to convert a hexadecimal number to a decimal number, the base of that
number is to be changed. Follow the steps given below:
 Step 1: Write the decimal values of the symbols used in the Hex number i.e. from
A-F
 Step 2: Multiply each digit of the Hex number with its place value. starting from
right to left i.e. LSB to MSB.
 Step 3: Add the result of multiplications and the final sum will be the decimal
number.
Example: To convert (8EB4)16 into a decimal value

B. Hexadecimal to Binary Conversion:


Hex numbers are represented in base 16, but the binary numbers are of base 2. Hence,
to convert a hexadecimal number to a binary number, the base of that number is to be
changed. Follow the steps given below:
 Step 1: Convert the Hex symbols into its equivalent decimal values.
 Step 2: Write each digit of the Hexadecimal number separately.
 Step 3: Convert each digit into an equivalent group of four binary digits.
 Step 4: Combine these groups to form the whole binary number.
Example: (B2E)16 is to be converted to binary

C. Hexadecimal to Octal Conversion:


Hexadecimal numbers are represented in base 16, but the octal numbers are of base
8. Hence, to convert a hex number to an octal number, the base of that number is to
be changed. Follow the steps given below:
 Step 1: We need to convert the Hexadecimal number to Binary first. For that,
follow the steps given in the above conversion.
 Step 2: Now to convert the binary number to Octal number, divide the binary
digits into groups of three digits starting from right to left i.e. from LSB to MSB.
 Step 3: Add zeros prior to MSB to make it a proper group of three digits (if
required)
 Step 4: Now convert these groups into their relevant decimal values.
Example: (B2E)16 is to be converted to hex

3. Errors and Accuracy

Any measurement made with any measuring instrument gives a certain degree of
uncertainty. This uncertainty is referred to as an error. The difference between the real
value and the estimated value of a quantity is known as measurement error. An error
may be positive or may be negative.

The deviation of the measured quantity from the actual quantity or true value is called
an Error (E).
E = Am – At
where E is the error, Am is the measured quantity and A t is the true value.
Types of Errors
Systematic or Constant Errors:
The type of error which affects the results of the experiment always in the same
direction i.e., makes the obtained result always higher or always lower than the true
value is known as systematic error. If the graduations of a meter scale are faulty or if
the measurements are carried out with a scale at a temperature other than that at
which it was calibrated, a systematic error will be introduced.
So, the systematic errors are of the following types:
(i) Instrumental errors whose examples are zero error of screw gauge, vernier
caliper, end error in meter bridge, etc.
(ii) Personal errors which are due to the observer.
(iii) Error due to external causes, due to changes in temperature, pressure, velocity,
height, etc.
(iv) Error due to Imperfection.

Systematic errors are usually determinate. So they can be eliminated by taking proper
precautions or can be rectified. However, when the source of such errors cannot be
properly identified, the experiment is repeated by different methods.

2. Random or accidental errors:


The results of several measurements of the same quantity by the same observer under
identical conditions do not show in general exact agreement but differ from one another
by a small amount.
The instrument may be a very good and sensitive one, the observer may be very careful,
yet such small differences in the results generally occur.
No definite cause for such errors can be traced; their sources are unknown and
uncontrollable.
Such errors are, therefore, purely accidental in nature and are termed random or
accidental errors.
An error that occurs randomly and whose causes are unknown and indeterminate is
called random error.

3. Gross errors:
These are large errors and occur due to carelessness or undue haste of the observer
which are also termed as mistakes.
The wrong recording of some data may be cited as an example.
So mistakes obviously do not follow the law and can be avoided only by constant
vigilance and careful observation from the observer.

Degree of Accuracy
If the measured value of a quantity is x and the limits of error are ∆x then the
accurate measurement of that quantity should be written as x ± ∆x which means that
the value of the quantity lies between x+∆x and x-∆x.

Proportional Error and Percentage Error


The ratio of the error of observation to the observed reading is known as the
proportional error. If the proportional error is multiplied by 100 or expressed in
percentages, then it is called a percentage error. Proportional error is also
called relative error or fractional Error.
The formula to calculate the Proportional error is given by,
Proportional Error = (Error / Observed reading)
or
Percentage Error = (Error / Observed reading) × 100%

Combination or Propagation of Errors


Addition and Subtraction:
In these operations, errors are combined according to the following rule:
When two quantities are added or subtracted, the net error in the measurement result
is the sum of errors associated with those quantities.
So if the observed values of two quantities are x ± Δx and y ± Δy and the sum or the
difference of them is z ± Δz then the error Δz in the value of z is given by Δz = Δ.x +
Δy.
Example: Let the lengths of two rods measured by a meter scale be 22.4 ± 0.2 cm and
20.2±0.2 cm respectively.
Then the difference in their lengths (22.4 – 20.2) or, 2.2 cm.
But each reading is erroneous by 0.2 cm. hence the greatest possible error that may
occur in the difference is 0.4 cm.
So we write, the difference in their lengths is 2.2 ± 0.4 cm.
Example: Two resistances R1=(100±5) ohm and R2=(200±10) ohm are
connected in series. Find the equivalent resistance of the series combination.
Solution:
Since, it is known that,
Equivalent resistance=R= R 1+R2
Given that, the resistance is:
R1 = (100 ± 5)
R2 = (200 ±10)
Therefore,
R = (100 ± 5) + (200 ± 10)
= (300 ± 15) ohm

Multiplication and Division:


In these operations, the concerned rule is given by:
When two quantities are multiplied or divided, the proportional error within the
outcome is that the sum of the proportional errors in those quantities.
So if z = xy or, z = (x/y), then according to this rule,
(Δz/z) = (Δx/x) + (Δy/y)

Powers of Quantities:
When a quantity is raised to a power n, the proportional error in the final result is n
times the proportional error in that quantity.
If, z = xn
Then according to this rule
(Δz/z) = n(Δx/x)
And if, z = (xnyp/wq)
Then it can be proved that:
(Δz/z) = n (Δx/x)+p(Δy/y)+q(Δw/w)

Proportional error in z = m × (proportional error in x) + p × (proportional error


in y) + q × (proportional error in w).

Absolute Error
Absolute error is the difference between the actual value and the measured value of a
quantity.

Absolute Error Formula


The absolute error is calculated by the subtraction of the actual value and the measured
value of a quantity. If the actual value is x₀ and the measured value is x, the absolute
error is expressed as,

∆x = x₀- x

Here, ∆x is the absolute error.

Absolute Error Example


Here, we are giving an example of the absolute error in real life. Suppose, we are
measuring the length of an eraser. The actual length is 35 mm and the measured length
is 34.13 mm.

So, The Absolute Error = Actual Length - Measured Length

= (35 - 34.13) mm

= 0.87 mm

Classification of Absolute Error


1. Absolute accuracy error

Absolute accuracy error is the other name of absolute error. The formula for
absolute accuracy error is written as E= E exp – E true, where E is the absolute
accuracy error, E exp is the experimental value and E true is the actual value.

2. Mean absolute error

MAE or the mean absolute error is the mean or average of all absolute errors.
The formula for Mean Absolute Error is given as,

1 n
MAE =  xi  x
n i 1
3. Absolute Precision Error

It is a standard deviation of a group of numbers. Standard deviation helps to


know how much data is spread.
Relative Error Definition
The ratio of absolute error of the measurement and the actual value is called relative
error.
By calculating the relative error, we can have an idea of how good the measurement is
compared to the actual size.
From the relative error, we can determine the magnitude of absolute error.
If the actual value is not available, the relative error can be calculated in terms of the
measured value of the quantity.
The relative error is dimensionless and it has no unit. It is written in percentage by
multiplying it by 100.

Relative Error Formula


The relative error is calculated by the ratio of absolute error and the actual value of the
quantity. If the absolute error of the measurement is ∆x, the actual value is x0, the
measured value is x, the relative error is expressed as,

xᵣ = (x₀ - x)/ x₀ = ∆x/x₀

Here, xr is the relative error.

Relative Error Example


Here, we are giving an example of relative error in real life. Suppose, the actual length
of an eraser is 35 mm. Now, the absolute error = (35-34.13) mm = 0.87 mm.

So, the relative error = absolute error/actual length

= 0.87/35

= 0.02485

(Image will be Uploaded Soon)

Relative Error as a Measure of Accuracy


In many cases, relative error is a measure of precision. At the same time, it can also be
used as a measure of accuracy. Accuracy is the extent of knowing how accurate the
value is as compared to the actual or true value. Students can find the RE accuracy only
if they know the true value or measurement. For simplicity, we have the formula for
calculating the RE accuracy which is given as

ActualError
RE Accuracy   100 %
Truevalue

Absolute Error and Relative Error in Numerical Analysis


Numerical analysis of error calculation is a vital part of the measurement. This analysis
finds the actual value and the error quantity. The absolute error determines how good
or bad the measurement is. In numerical calculation, the errors are caused by round-
off error or truncation error.
Examples
1. Find the absolute and relative errors. The actual value is 125.68 mm and the
measured value is 119.66 mm.

Solution:

Absolute Error = |125.68 – 119.66| mm

= 6.02 mm

Relative Error = |125.68 – 119.66| / 125.68

= 0.0478

2. Find out the absolute and relative errors, where the actual and measured values are
252.14 mm and 249.02 mm.

Solution:

Absolute Error = |252.14 – 249.02| mm

= 3.12 mm

Relatives Error = 3.12/252.14

= 0.0123

3. We are given an approximate value of π is 22/7 = 3.1428571 and true value is


3.1415926. Calculate absolute, relative and percentage errors?
Solution –
We have True value X= 3.1415926, And Approx. value X 1= 3.1428571.
So now we calculate Absolute error, we know that EA= X - X1=δX
Hence EA= 3.1415926- 3.1428571 = -0.0012645

Answer is -0.0012645
Now for Relative error we’ve (absolute error)/(true value of quantity)
Hence ER = EA/X = (Absolute Error)/X, E A=(-0.0012645)/3.1415926 = -
0.000402ans.

Percentage Error,
EP= 100 × EA/X = 100 × (-0.000402) = - 0.0402ans.

4. Let the approximate values of a number 1/3 be 0.30, 0.33, 0.34. Find out the best
approximation.
Solution –
Our approach is that we first find the value of Absolute Error, and any value having
the least absolute will be best. So, we first calculate the absolute errors in all
approx values are given. <pre
|X-X1| = |1/3 – 0.30| = 1/30|1/3 – 0.33| = 1/300|1/3 – 0.34| = 0.02/3 = 1/500
Hence, we can say that 0.33 is the most precise value of 1/3;
5. Finding the difference—
√5.35 - √4.35
Solution –

√5.35 = 2.31300
√4.35 = 2.08566
Hence, √5.35 - √4.35 = 2.31300 – 2.08566 = 0.22734
Here our answer has 5 significant digits we can modify them as per our
requirements

4. Interpolation
Interpolation is a method of deriving a simple function from the given discrete data set
such that the function passes through the provided data points.
This helps to determine the data points in between the given data ones.
This method is always needed to compute the value of a function for an intermediate
value of the independent function.
Therefore, interpolation is a process of determining the unknown values that lie in
between the known data points.
It is mostly used to predict the unknown values for any geographical related data
points such as noise level, rainfall, elevation, and so on.

The unknown value on the data points can be found using the linear interpolation and
Lagrange’s interpolation formula

Interpolation Methods
There are different types of interpolation methods. They are:
Linear Interpolation Method – This method applies a distinct linear polynomial
between each pair of data points for curves, or within the sets of three points for
surfaces.
Nearest Neighbour Method – This method inserts the value of an interpolated point
to the value of the most adjacent data point. Therefore, this method does not produce
any new data points.
Cubic Spline Interpolation Method – This method fits a different cubic polynomial
between each pair of data points for curves, or between sets of three points for surfaces.
Shape-Preservation Method – This method is also known as Piecewise Cubic Hermite
Interpolation (PCHIP). It preserves the monotonicity and the shape of the data. It is for
curves only.
Thin-plate Spline Method – This method consists of smooth surfaces that also
extrapolate well. It is only for surfaces only
Biharmonic Interpolation Method – This method is applied to the surfaces only.

Quadratic Interpolation
As an example, let us consider the given value
x0 = 0
x1 = π/4
x2 = π/2
and
yi = cos xi
Where i = 0, 1, 2
This gives us the three points (0, 1), (π/4, 1/√2), and (π/2, 0)
Now finding a quadratic polynomial that will contain the points-

For which
p(xi) = yi
i = 0, 1, 2
The graph of this polynomial is shown on the accompanying figure. We later give an explicit
formula.
Uses of Interpolation
1. Replace a set of data points {(xi, yi)} with a function given analytically.
The data may be from a known class of functions. Interpolation is then used to find the
member of this class of functions that agrees with the given data. For example, data may
be generated from functions of the form

Then we need to find the coefficients {aj} based on the given data values.
We may want to take function values f(x) given in a table for selected values of x, often
equally spaced, and extend the function to values of x, not in the table. For example,
given numbers from a table of logarithms, estimate the logarithm of a number x not in
the table.
Given a set of data points {(xi,yi)}, find a curve passing thru these points that are
“pleasing to the eye”. In fact, this is what is done continually with computer graphics.
How do we connect a set of points to make a smooth curve? Connecting them with
straight line segments will often give a curve with many corners, whereas what was
intended was a smooth curve.
2. Approximate functions with simpler ones, usually polynomials or ‘piecewise
polynomials’.
Is to approximate functions f(x) by simpler functions p(x), perhaps to make it easier to
integrate or differentiate f(x). That will be the primary reason for studying
interpolation in this course.
As an example of why this is important, consider the problem of evaluating

Interpolation and Extrapolation


The primary differences can be noted between interpolation and extrapolation are
given in the below table.

Interpolation Extrapolation

It is the method of using our function It is the method of using our function to
to predict the value of the dependent predict the value of the dependent
variable for an independent variable variable for an independent variable that
that lies within the data set. lies outside the range of our data.

This works within the given data set. This works beyond the given data set.

You might also like