You are on page 1of 13

Numerical

Methods for High School Students-- INTERPOLATION


N K Srinivasan Ph D

Introduction
The aim of this tutorial series is to instruct you in simple numerical methods. In this tutorial, you will learn to use two simple interpolation methods --very useful in scientific experiments and developing scientific 'models' as I will illustrate. Engineers use these methods in many places --to convert a set of data points into an equation they can use later. You have to employ algebra only. I do not assume that you have learned Calculus. The two 'interpolation " methods are: 1 Linear interpolation [using a straight line equation

between two data points]. 2 Quadratic or Parabolic interpolation [using a parabolic equation between three data points.]

Linear Interpolation
Suppose you measure density of a liquid at two temperatures T1 and T2. From the two data points, (T1,d1) and (T2,d2) , you want to estimate or infer the density at a temperature between T1 and T2. What will you do? The easy and logical thing to do is to connect the two data points with a straight line . Then using this line, find the density at the temperature between T1 and T2. The example illustrates the method. Example 1 Mr Larry Pasteur, a chemist measured the density of his super-solvent at 40 C and 50 C. The values of density were d1 = 1.8 gm/ml at 40 C and d2 = 1.25 gm/ml at 50 C. The data points are (40, 1.8 ) and (50,1.25)

You are asked to estimate the density at 46 C. Let us find the equation of the linear (straight) line joining the two data points: y = m x + c where x is the temperature and y is the density. 'm' is the slope and 'c' is the y-intercept. Slope = m = (y2-y1)/(x2-x1) = (1.25 - 1.8)/(50 - 40) = (- 0.55)/10 = - 0.055 To find the density at 46 C, we will use the slope-point formula: y = y1 + m (x - x1) y = 1.8 - 0.055 (46 - 40) = 1.8 - 0.055 x 6 = 1.8 - 0.33 = 1.47 g/ml Note that the value obtained may not be exact.But with two data points at 40 and 50 degrees , we cannot do anything better by calculation. The value of density at 46 C is called the "interpolated value" of density. The value is likely to be fairly accurate if the density

changes slowly with temperature . It will be exact if the density in fact changes linearly! We have used a straight line to find the interpolated value; the method is called "Linear Interpolation". The straight line equation: y = a + b x is called the "interpolating polynomial" for linear interpolation. Problems: 1 The electrical resistance of a piece of wire varies with temperature as follows: Temp (deg C) 33 51 73 Resistance (Ohms) 826 873 942 Find the values of resistance at 40 C and at 60 C by linear interpolation.

2 Find the sqrt(2) by linear interpolation taking two adjacent values: 1.4 x 1.4 = 1.96 and 1.45 x 1.45 =2.1025. Hint: here the points are (1.96,1.4) and (2.1025,1.45)

3 The solubility limit for a salt in water varies with temperatures as follows:

Temperature (deg C) 20 25 Solubility limit [gms/100 ml) 15.63 15.92 Estimate its solubility limit at 22 deg C.

4 The acceleration due to gravity (g) varies with altitude above the earth's surface as follows: h (meters) 20000 40000 g ( m/s.s) 9.7487 9.6879 Find the value of 'g' at 33000 meters altitude. ---------------------------------------------------

Quadratic Interpolation
Suppose you have three data points;say you have measured the density of a liquid at three temperatures:the data set can be written as : (t1,d1) ,(t2,d2) and (t3,d3). Let t2 > t1 and t3 > t2 where t is the temperature and d the density. You can estimate the density at some temperature between t1 and t3 , by using a parabola passing through the three points. The general equation for a parabola is:

y = a + bx + c x2 where a, b and c are constants. To find these three constants we need only three data points : (x1,y1) , (x2,y2) and (x3,y3). Since the parabola passes through these points, we can write a set of three linear equations: y1 = a + bx1 + c x1.x1 y2 = a +bx2 + c X2.x2 y3 = a + bx3 + c x3.x3 Solve this set of equations for the three unknowns : a,b and c. [You might have studied 'parabola' using this equation: y = k (x-d)2 + e Expanding the square term, we get: y = k( x2 -2xd + d.d )+ e Gathering like terms, y = (k.d.d + e) - 2kd.x + k x.x Comparing with the general equation for quadratic polynomial: we find a = k.d.d + e , b= -2kd and c= k.

So ,the two expressions for the parabola are the same.] We can write the equation: y = a + bx + c x.x and use this equation or "interpolating polynomial" for finding y value for any given x value in the interval x1 to x3.

Example 1 The electrical resistance of a piece of wire [used in a precision resistance thermometer] varies with temperature as follows: Temp (deg C) [x] 33 51 69 Resistance (ohms)[y] 820 870 930 By quadratic interpolation, find the interpolated value of resistance at 60 deg C. ------------------------------------- Let us write the set of three equations. Before that , we can simplify our calculations by writing x' = x -51. [This is the same process as shifting the x axix to the right in a graph, sometimes called 'coding'.]] x' -18 0 18

y 820 870 930


y1 = 820 = a -18b + (18 x 18) c ----(1) y2 = 870 = a +0 + 0 ------(2) y3 = 930 + a + 18 b + (18 x 18)c ------(3)

Solving these becomes easier: a = 870 subtracting (3) from (1), we get: -36 b = - 110 or b = 110/36 = 3.055 y1 = 820 = 870 -55 + 324 c c = 5/324 = 0.01543 Therefore the interpolating polynomial, parabola, : y = 870 + 3.055 x' + 0.01543 x'.x' or y = 870 + 3.055 (x-51) + 0.0154 (x-51)(x-51) =( 870 -155.8 + 40.055) + (3.055 x - 1.57x) + 0.0154 x.x y = 754.255 + 1.485 x + 0.0154 x.x

The above equation helps us to interpolate for any x value. To find the resistance at 60 deg C, substitute x = 60 in the polynomial: y = R = 754.255 + 1.485 x 60 + 0.0154 x 60 x 60 R = 754.255 + 89.1 + 55.4 R = 898.755 = 899 (approx) Check: 1 R (60) falls between the values for R (51) and R(69). 2 Check the result with linear interpolation for R (60): R = 870 + [(930-870)/18]9 = 870 +30 = 900 [ the mid-value between 930 and 870] Therefore the quadratic interpolation gives a better approximation to the value of R at 60 C. ------------------------------------------------- Further note: If you are familiar with using matrix methods to solve the set of three equations, you can set up a matrix equation as follows: A = [ 1 x1 x1.x1 1 x2 x2.x2

1 x3 x3.x3 ] B = [ a b c] C = [ y1 y2 y3] Solve the matrix equation: [A][B]= [C] The augmented matrix M = [ 1 x1 x1.x1 | y1 1 x2 x2.x2 | y2 1 x3 x3.x3 | y3]

The solution gives a,b and c. Using a graphing calculator. You can plot the data points and the interpolating polynomial with a graphing calculator . You can solve the set of three equations with the " matrix solver" in a graphing calculator. ---------------------------------------------------- Problems: 1 The solubility limit of a salt in water [gms/100 ml]

varies with temperature as follows: Temp (deg C) (x) 15 20 25 Solubility (y) 15.3 15.6 15.95 Apply quadratic interpolation and find the solubility at 22 deg C

2 Traffic police often determine the speed of a vehicle in an accident from the length of the tire scratch mark on the road. This is related to the 'stopping distance' of an automobile which depends on its speed at the time of braking. For a new model of an automobile, the data for stopping distance against speed was found as follows: Speed (Kmph) [s] 65 80 95 Stopping distance (meter)[d] 41 62 88 Find the quadratic interpolating polynomial : d = a + b s + c s2 and estimate the stopping distance for a speed of 85 kmph.

3 The solubility of n-butane in anhydrous HF at high


pressures is used in the technology of gasoline refineries. ues quadratic interpolation and find the solubility at 200 F from the following data set: temp ( F) : 100 185 240 solubility (mg/100 ml) 3.4 7.0 11.0

NOTE Empirical Relations and Interpolation Polynomials: Scientist often measure certain variables at three values of another parameter [temperature and time, density vs temperature,viscosity versus temperature, particulate pollution vs rainfall ,yield vs fertiliser used AND SO ON ] and find the interpolating polynomial using the quadratic interpolation. The quadratic relAtionship y= a + bx + c x.x becomes an empirical relationship between the two variables. This relation or equation could be very useful in applications and further research work. But it should be kept in mind that such a relation is valid only in the range of x variable studied and should

not be extended outside the range as a valid one. For instance if you find an interpolating polynomial for density vs temperature of a chemical in the range 30 to 100 deg C, the polynomial is useful only for this range .It cannot and should not be used for ,say 140 deg C because we do not know the behavior outside this range! There could be someother reaction changing the density significantly at around 140 deg C. ----------------------------------------------------------------

You might also like