Two Variable Cubic Spline Interpolation

Page 1

IOSR Journal of Mathematics (IOSR-JM) e-ISSN: 2278-5728, p-ISSN: 2319-765X. Volume 13, Issue I Ver. VI (Jan. - Feb. 2017), PP 01-05 www.iosrjournals.org

Two Variable Cubic Spline Interpolation Dhanya Ramachandran1, Dr.V. Madhukar Mallayya2 1

Assistant Professor (Maths) Mar Baselios College ofEngg. & Tech. Nalanchira , Trivandrum 2 Professor & Head (Maths) Mohandas College of Engg. & Tech. Anad, Trivandrum

Abstract: Two variable natural cubic spline interpolation formula is derived and illustrated using an example Keywords: Two variable interpolation, Two variable spline, Natural spline Subject Classification (2000) 65D07

I. Introduction

If the explicit nature of the function y  f (x) is not known but the set of tabular values satisfying the function is known then the process of replacing f (x) by suitable function say g(x) satisfying the given set of tabular values is called interpolation. If g(x) is a polynomial then it is called polynomial interpolation [4]. In many cases it is seen that polynomial oscillates varyingly but the function varies smoothly [1]. To overcome this spline function is considered which is a function of polynomial bits joined together. The cubic spline procedure has sufficient flexibility due to the four constantsinvolved in a general cubic polynomial which ensures the condition that the interpolant is continuously differentiable in the interval and has continuous second derivative [3]. Thus because of their smoothness conditions the most frequently used spline interpolation is the cubic spline interpolation. A two variable cubic spline interpolation of a function z  f x, y is the fitting of a unique

series of cubic splines for a given set of data points

x , y , z . The points (x, y) at which f(x, y) are known i

j

ij

lie on a grid in the x-y plane. In order to derive a two variable natural cubic spline the existence of continuity condition of the spline function and its partial derivatives at the edge of each grid are assumed.

II.

Two Variable Natural Cubic Spline

I  a, b c, d . Let

a  x1  x2      xn  b and c  y1  y2      ym  d be the set of data points satisfied by f ( xi , y j )  zij for all i = 1, 2 ,…., n

Consider

the

division

rectangle

and j = 1,2,…..,m.[2] . A two variable cubic spline S ij  x, y  is a unique function coinciding with z ij in each

 

rectangular grid I ij  xi , xi 1  y j , y j 1 for all i = 1, 2 ,….,(n-1) and j = 1,2,…..,(m-1). Since S ij  x, y  is a cubic spline in two variables its all second order partial derivatives should be linear and continuous. Here we are considering the second order partial derivative with respect to x Let

 2 S ij x 2

M i xi 1  x  M i 1 x  xi  N j y j 1  y  N j 1 y  y j  ----------------- (1)    hi hi kj kj

xi 1  xi  hi y j 1  y j  k j

Let

i = 1,2, ----, n-1 j = 1,2, -----, m-1

Integrating (1) with respect to x,

S ij



x

2 2 M i xi 1  x  M i 1 x  xi  N j y j 1  y x  xi  N j 1 y  y j xi 1  x      Ay j 1  y   B 2hi 2hi kj kj

----------------- ( 2) Integrating (2) with respect to x,

3 3 N j  y j 1  y x  xi  N j 1  y  y j xi 1  x  M i xi 1  x  M x  xi   i 1    ---------(3) 6hi 6hi 2k j 2k j 2

S ij 

2

A y j 1  y x  xi   Bxi 1  x   C  y  y j   D DOI: 10.9790/5728-1301060105

www.iosrjournals.org

1 | Page


Two Variable Cubic Spline Interpolation Since the spline interpolates at the knots: (i) S ij xi 1 , y j  z i 1, j

  ( ii) S x , y   z (iii) S x , y   z (iv) S x , y   z ij

i

j 1

ij

i

j

ij

i 1

i , j 1

i, j

j 1

i 1, j 1

Applying the conditions (i), (ii), (iii), (iv) to (3) 2

2 N j hi M i 1 hi z i 1, j    Ahi k j  D ------------------- ( 4 ) 6 2 2 2 N j 1 hi M i hi z i , j 1    Bhi  Ck j  D ------------------- ( 5) 6 2 2 Mh z i , j  i i  Bhi  D 6 2 -------------------- ( 7) M h z i 1, j 1  i 1 i  Ck j  D 6

------------------- ( 6)

Solving (4), (5), (6), (7) we get the following constants

A

B

C

z

i  1, j

 zij 

hi k j

z

6

i , j 1

 zij 

kj

 zi , j 1 

hi k j

M i 1  M i hi

z

i  1, j  1

N j 1hi 2

N j 1hi

z

N

j 1

 N j hi

2k j

i  1, j  1

 zi , j 1 

hi

2

2k j

N j 1  2 M hi D  z i 1, j 1  z i , j 1   z ij   i 1  6 2   So from (3) the two variable cubic spline is 3 3 N j y j 1  y x  xi  N j 1 y  y j xi 1  x  M i xi 1  x  M i 1 x  xi  S ij     6hi 6hi 2k j 2k j 2

 z i 1, j  z ij  z i 1, j 1  z i , j 1  N j 1  N j hi     y j 1  y x  xi   hi k j 2k j  hi k j   M i 1  M i hi N j 1 hi z i 1, j 1  z i , j 1     xi 1  x   6 2 hi  

2

-------(8)

 z i , j 1  z ij  N j 1 hi 2    M i 1 N j 1  2  hi ,    y  y j   z i 1, j 1  z i , j 1   z ij     kj 2k j  6 2      ( x, y )  xi , xi 1   y j , y j 1 , i  1,2,....., (n  1), j  1,2,......(m  1)

In two variable spline function there exist a unique tangent plane at the two surfaces in every node. So

S ij x

x, y    M i xi 1  x 

2

2hi

DOI: 10.9790/5728-1301060105

S ij

x

i 1

, yj 

S i 1, j

xi1 , y j  x x 2 N j y j 1  y x  xi  N j 1 y  y j xi 1  x  M  x  xi  +  i 1  2hi kj kj 

corresponding to the node xi 1 , y j we have

www.iosrjournals.org

2 | Page


Two Variable Cubic Spline Interpolation

  z i 1, j  z ij  z i 1, j 1  z i , j 1  N j 1  N j hi      y j 1  y  h k h k 2 k   i j i j j     M i 1  M i hi N j 1 hi z i 1, j 1  z i , j 1      6 2 hi   Sij M i 1hi N j hi zi 1, j  zij M i hi xi1, y j      ------------------- (9) x 3 2 hi 6 +

2 2 N j y j 1  y x  xi 1  M i 1 xi 2  x  M i 2 x  xi 1  + x, y      x 2hi 1 2hi 1 kj

S i 1, j

N j 1 y  y j xi 1  x 

  z i 1, j  z ij  z i 1, j 1  z i , j 1  N j 1  N j hi      y j 1  y  hi k j 2k j kj    hi k j   M  M i hi N j 1hi zi 1, j 1  zi , j 1      i 1  6 2 hi   S i 1, j xi1 , y j    M i1 hi1  zi2, j  zi1, j  M i2 hi1  N j hi1 ----------------------- (10) x 3 hi 1 hi 1 6 2 +

Equating (9) and (10)

z

i  2, j

 zi 1, j 

hi 1 Assume

z

z i 1, j  z ij hi

zi 2, j  zi 1, j hi 1

i 1, j

 zij 

hi   i, j

  i 1, j

N M i 1 hi  hi1   j hi  hi1   M i hi  M i2 hi1 --------(11) 3 2 6 6

where i = 1,2, ----,(n-1) and j = 1,2,-----,(m-1)

----------------- (12)

hi 1 where i = 1,2, ----,(n-2) and j = 1,2,-----,(m-2) hi  hi 1 hi  i  1  i  ----------------- (13) hi  hi 1 6 i 1, j   i , j  d ij  hi  hi 1

Assume

i 

Therefore equation (11) will become

6  i 1, j   i , j  2M i 1 hi  hi 1   3N j hi  hi 1   M i hi  M i  2 hi 1 ---------------(14)

hi  hi 1 we get 2M i 1  3N j   i M i  i M i  2  d ij ,wherei = 1,2, ----,(n-2) and

Dividing equation (14) by j = 1,2,-----,(m-2)

-----------(15)

So the two variable natural cubic spline is

DOI: 10.9790/5728-1301060105

www.iosrjournals.org

3 | Page


Two Variable Cubic Spline Interpolation 3 3 N j  y j 1  y x  xi  N j 1  y  y j xi 1  x  M i xi 1  x  M  x  xi   i 1   6hi 6hi 2k j 2k j 2

S ij 

2

  z i 1, j  z ij  z i 1, j 1  z i , j 1  N j 1  N j hi       y j 1  y x  xi   hi k j 2k j    hi k j   M i 1  M i hi N j 1 hi z i 1, j 1  z i , j 1     xi 1  x   6 2 hi  

2    M i 1 N j 1  2   z i , j 1  z ij  N j 1 hi    hi      y  y j   z i 1, j 1  z i , j 1   z ij   , k 2 k 6 2     j j      

( x, y)  xi , xi 1  y j , y j 1 , i  1,2,....., (n  1), j  1,2,......(m  1) where 2M i 1  3N j   i M i  i M i  2  d ij , j = 1,2,-----,(m-2) For natural spline M 1

i = 1,2, ----,(n-2) and

 M n  N1  N m  0 III.

Illustration

Consider the two variable function f ( x, y)  e . The following table gives the function values for x taking values 0, 0.1, 0.2 and y taking values 0, 0.1, 0.2 xy

Y X 0 0.1 0.2

0

0.1

0.2

1 1 1

1 1.01 1.02

1 1.02 1.04

h1  h2  0.1 k1  k 2  0.1 Using (12) and (13),

 11  0  12  0.1 d 0 1  0.5 1  0.5 11  21  0 d12  0.5  22  0.1 2M 2  3N1  1 M 1  1 M 3  d11 Using (15) 2M 2  3N 2  1 M 1  1 M 3  d12

------------- (16)

For a natural cubic spline M1 = M3 = N1 = N3 = 0 Solving (16) M2 = 0 and N2 = 0.1667 Using (8) the two variable cubic splines are

  0.8335 y 0.1  x 2  0.91670.1  y x   0.091670.1  x   0.00834( y )  1.0092  ( x, y )  I 11  2  0.8335(0.2  y )( x)  1.0834(0.2  y )( x)  0.2(0.1  x)  1.04, ( x, y )  I 12  S ij x, y    0.8335( y )(0.2  x) 2  0.9167(0.1  y )( x  0.1)  0.09167(0.2  x)  0.10834 y  1.0092  ( x, y )  I 21  2  0.8335(0.2  y )( x  0.1)  1.0834(0.2  y )( x  0.1)  0.2(0.2  x)  0.1( y  0.1)  1.03  ( x, y )  I 22 

The following table shows the values of the function f at (x, y) and the corresponding interpolated values

S ij x, y 

DOI: 10.9790/5728-1301060105

www.iosrjournals.org

4 | Page


Two Variable Cubic Spline Interpolation

1 2 3 4 5

(x, y)

S ij x, y 

(0.05,0) (0.05,0.05) (0.15,0) (0.15,0.15) (0.05,0.15)

1 1.003 1 1.022 1.007

f  x, y  1 1.003 1 1.022 1.007

Error 0 0 0 0 0

IV. Conclusion Interpolated values are found to be same as the actual functional value.

References [1]. [2]. [3]. [4].

Anthony Ralston and Philip Rabinowitz, A first course in Numerical Analysis, Second Edition, Dover publication , INC, New York. Ion Lixandru, Algorithm for the calculation of the two variables cubic spline function,AnaleleStiintifice Ale UniversitatiiMatematica, Tomul Lix,2013,f.1 Richard L Burden, J. Douglas Faires, Numerical Analysis, Ninth Edition,Brooks/Cole Cengage Learning. S.S. Sastry , Introductory Methods Of Numerical Analysis, Fourth Edition, PHI Learning Private Limited

DOI: 10.9790/5728-1301060105

www.iosrjournals.org

5 | Page


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.