0% found this document useful (0 votes)
75 views16 pages

Derivations PDF

The document discusses the derivation of cubic spline equations. Cubic splines are piecewise third order polynomial functions used to generate smooth curves through data points. The derivation involves: 1) Defining the cubic spline equation for a given interval between data points. 2) Applying four conditions to solve for the coefficients: the spline must pass through each data point, have continuous derivatives up to the second order at knots, and be continuous across knots. 3) This results in a system of equations that can be solved to determine the coefficients for each cubic spline segment.

Uploaded by

Mihir Kumar Mech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views16 pages

Derivations PDF

The document discusses the derivation of cubic spline equations. Cubic splines are piecewise third order polynomial functions used to generate smooth curves through data points. The derivation involves: 1) Defining the cubic spline equation for a given interval between data points. 2) Applying four conditions to solve for the coefficients: the spline must pass through each data point, have continuous derivatives up to the second order at knots, and be continuous across knots. 3) This results in a system of equations that can be solved to determine the coefficients for each cubic spline segment.

Uploaded by

Mihir Kumar Mech
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Derivation of Cubic Splines: [adapted from Chapra]

fi  ai  bi  x  xi   ci  x  xi   di  x  xi 
2 3
Equation for Cubic Splines:

Now, Let us consider 4 points then there will be 3 splines and 2knots.

Thus, for n points, there will be (n-1) splines and (n-2) knots.

Number of unknowns therefore is = 4(n-1) ; [4 for ai , bi , ci , d i ]

Hence, We need to have 4(n-1) equations to solve for the unknowns. In the following context an
example of 3 splines and then it is generalized for n points.

Equations for the splines may be written as follows:

S1  x   a1  b1  x  x1   c1  x  x1   d1  x  x1 
2 3
For n=4;

S2  x   a2  b2  x  x2   c2  x  x2   d2  x  x2 
2 3

S3  x   a3  b3  x  x3   c3  x  x3   d3  x  x3 
2 3

Si  x   ai  bi  x  xi   ci  x  xi   di  x  xi 
2 3
General : (1)

First Condition : Splines pass through all the data points.

For n=4;

S1 passes through  x1 , y1  : S1  x1   a1  b1  x1  x1   c1  x1  x1   d1  x1  x1 
2 3

or, S1  x1   a1  f1

S 2 passes through  x2 , y2  : S2  x2   a2  f 2

S3 passes through  x3 , y3  : S3  x3   a3  f3

General : Si  xi   ai  fi (2)

Again,

S3 passes through  x4 , y4  : S3  x4   a3  b3  x4  x3   c3  x4  x3   d3  x4  x3 
2 3

Ie., Sn 1 passes through  xn , yn  :

Sn1  xn   an1  bn1  xn  xn1   cn1  xn  xn1   dn1  xn  xn 1 


2 3
General: (3)
Second Condition : Second Derivative continuity : Second derivatives at the knots are equal.

Si  x   bi  2ci  xi 1  xi   3di  xi 1  xi 


2
Equation (1) can be differentiated twice to give :

Si  x   2ci  6di  xi 1  xi 

or, Si  x   2ci  6di hi (4)

For n=4 : S1  x  | x2 , y2   S2  x  | x2 , y2 

2c1  6d1  x2  x1   2c2  6d2  x2  x2 

2c1  6d1h1  2c2

S2  x  | x3 , y3   S3  x  | x3 , y3 

2c2  6d2 h2  2c3

General : Si  x  | xi1 , yi1   Si 1  x  | xi1 , yi1 

2ci  6di hi  2ci 1

ci  3di hi  ci 1 (5)

ci 1  ci
or, di  (6)
3hi

Third Condition: First derivative continuity : First derivatives at the knots are equal.

Si  x   bi  2ci  xi 1  xi   3di  xi 1  xi 


2
Equation (1) can be differentiated to give : (7)

or, Si  x   bi  2ci hi  3di hi 2

For n=4 : S1  x  | x2 , y2   S2  x  | x2 , y2 

b1  2c1  x2  x1   3d1  x2  x1   b2  2c2  x2  x2   3d2  x2  x2 


2 2

b1  2c1h1  3d1h12  b2

S2  x  | x3 , y3   S3  x  | x3 , y3 

b2  2c2 h2  3d2 h2 2  b3
General : Si  x  | xi1 , yi1   Si 1  x  | xi1 , yi1 

bi  2ci hi  3di hi 2  bi 1 (8)

equation (6) can be substituted in equation (8) to get :

bi 1  bi  hi  ci  ci 1  (9)

Reducing the index of the equation by 1 we get :

bi  bi 1  hi 1  ci 1  ci 

bi  bi 1  hi 1  ci 1  ci  (10)

Fourth Condition : Continuity : Splines are continuous at the knots, ie.,

For n=4 ; S1  x  | x2 , y2   S2  x  | x2 , y2 

a1  b1  x2  x1   c1  x2  x1   d1  x2  x1   a2  b2  x2  x2   c2  x2  x2   d2  x2  x2 
2 3 2 3

a1  b1  x2  x1   c1  x2  x1   d1  x2  x1   a2
2 3

S2  x  | x3 , y3   S3  x  | x3 , y3 

a2  b2  x3  x2   c2  x3  x2   d2  x3  x2   a3  b3  x3  x3   c3  x3  x3   d3  x3  x3 
2 3 2 3

a2  b2  x3  x2   c2  x3  x2   d2  x3  x2   a3
2 3

General : Si  x  | xi1 , yi1   Si 1  x  | xi1 , yi1 

ai  bi  xi 1  xi   ci  xi 1  xi   di  xi 1  xi   ai 1
2 3

From Equation (2) we may write,

fi 1  fi  bi  xi 1  xi   ci  xi 1  xi   di  xi 1  xi 
2 3

Now, hi  xi 1  xi ;

Therefore , fi 1  fi  bi hi  ci hi 2  di hi 3 (11)

equation (6) can be substituted in equation (11) to get :


 c c  3
fi 1  fi  bi hi  ci hi 2   i 1 i  hi
 3hi 

hi 2
fi 1  fi  bi hi   ci 1  2ci 
3

fi 1  fi hi
bi    ci 1  2ci  (12)
hi 3

Reducing the index of the equation by 1 we get :

fi  fi 1 hi 1
bi 1    ci  2ci 1  (13)
hi 1 3

Substracting equation (13) from (12) we get ;

f f h  f f h 
bi  bi 1   i 1 i  i  ci 1  2ci    i i 1  i 1  ci  2ci 1  (14)
 hi 3   hi 1 3 

Equating equations (11) and (14) we get :

f f h  f f h 
hi 1  ci 1  ci    i 1 i  i  ci 1  2ci    i i 1  i 1  ci  2ci 1 
 hi 3   hi 1 3 

hi 1 h f f f f
 ci  2ci 1   hi 1  ci 1  ci   i  ci 1  2ci   i i 1  i 1 i
3 3 hi 1 hi

fi 1  fi f  fi 1
hi 1ci 1  2  hi 1  hi  ci  hi ci 1  3 3 i (15)
hi hi 1

The equation can be made a little more concise by recognizing that the terms on the right
fi  f j
hand side of equation (15) are finite differences, f  xi , x j  
xi  x j

Therefore, equation (15) may be re-written

hi 1ci 1  2  hi 1  hi  ci  hi ci 1  3  f  xi 1 , xi   f  xi , xi 1  (16)

Equation (15) can be written for the Knots, i=2,3,……,(n-1),which results in (n-2) simultaneous
tridiagonal equations with n unknown coefficients, c1 , c2 , …… , cn . Therefore if we now have two
additional conditions, we can solve for the c ’s.

fi 1  fi hi
Once this is done, b ’s can be determined from equation (12) : bi    ci 1  2ci 
hi 3
ci 1  ci
And d ’s can be determined from equation (6) : di 
3hi

Cubic splines and End Conditions :

1. Natural Condition : In this condition, the second derivative at the first and the last node is
equal to zero.
Si  x   ai  bi  x  xi   ci  x  xi   di  x  xi 
2 3
From equation (1):

Si  x   bi  2ci  x  xi   3di  x  xi 


2

Si  x   2ci  6di  x  xi 

For the first node : S1  x1   0  2c1  6d1  x1  x1  (17)

Therefore , c1  0 (18)

For the last node : Sn1  xn   2cn1  6dn1  xn  xn1   0


cn1  3dn1hn1  0

We can conveniently define an extraneous parameter cn , in which equation (18) becomes

cn1  6dn1hn1  cn  0
cn  0 (19)

For n points : equation (16) can be written as :

h1c1  2  h1  h2  c1  h2c2  3  f  x3 , x2   f  x2 , x1 

h2c2  2  h2  h3  c2  h3c3  3  f  x4 , x3   f  x3 , x2 

hn2cn2  2  hn2  hn1  cn1  hn1cn  3  f  xn , xn1   f  xn1 , xn2 

Hence the final equations may be written in matrix form as :

For n=4 points,

1 0 0 0   c1   0 
 
h
 1 2  h1  h2  h2 0  c2  3  f  x3 , x2   f  x2 , x1  
  
0 h2 2  h2  h3  h3  c3  3  f  x4 , x3   f  x3 , x2 
 
0 0 0 1  c4   0 

For n points,

1 0 0   c1   0 
h  c   3  f  x3 , x2   f  x2 , x1  
 1 2  h1  h2  h2 0 0 0   2 
0 h2 2  h2  h3  h3 0 0     3  f  x4 , x3   f  x3 , x2  
     
 0 0    
 0 0 0     
    
 0 0 0 hn  2 2  hn  2  hn 1  hn 1  cn 1  3  f  xn , xn 1   f  xn 1 , xn  2  
0    
 0 1   cn  
 0 

As shown, the system is tridiagonal and hence efficient to solve.

2. Clamped Condition : in this condition f1 and f n are specified at the first and last node.
Hence,
Si  x   ai  bi  x  xi   ci  x  xi   di  x  xi 
2 3
From equation (1) :

Si  x   bi  2ci  x  xi   3di  x  xi 


2

S1  x   b1  2c1  x  x1   3d1  x  x1 


2
For the first node :

S1  x  | x1 , y1   f1  b1  2c1  x1  x1   3d1  x1  x1 


2

S1  x  | x1 , y1   f1  b1

fi 1  fi hi
Substituting the above equation in equation (12): bi    ci 1  2ci  , we get ,
hi 3

f 2  f1 h1
f1    2c2  c1 
h1 3

f 2  f1 h
 f1  1  c2  2c1 
h1 3

c2 h1  2h1c1  3 f  x2 , x1   3 f1

For Last node : Sn1  x   bn1  2cn1  x  xn1   3dn1  x  xn1 


2
Sn1  x  | xn , yn   f n  bn1  2cn1  xn  xn1   3d n1  xn  xn1 
2

Sn1  x  | xn , yn   f n  bn1  2cn1hn1  3dn1hn12

Again from equation (8)we know, bi  2ci hi  3di hi 2  bi 1

Hence, f n  bn

From equation (9) we know , bi 1  bi  hi  ci  ci 1 

bn  bn1  hn1  cn1  cn 

f n  bn1  hn1  cn1  cn 

fi  fi 1 hi 1
From equation (13) we know, bi 1    ci  2ci 1 
hi 1 3

f n  f n 1 hn 1
bn 1    cn  2cn1 
hn 1 3

f  f n 1 hn 1
f n  hn 1  cn 1  cn   n   cn  2cn1 
hn1 3

h
f n  hn1  cn1  cn   f  xn , xn 1   n1  cn  2cn1 
3


2hn1cn1  hn1cn  3 f n  f  xn , xn 1  
The final equations can now be written in a matrix form as :

 3 f  x2 , x1   3 f1 
 2h1 h1 0 0   c1   
h 2  h1  h2  h2 0 0 0   c   3  f  x3 , x2   f  x2 , x1  
 1  2   
 0 h2 2  h2  h3  h3 0 0     3  f  x4 , x3   f  x3 , x2  
    
 0 0    
 0 0 0     
     
 0 0 0 hn  2 2  hn  2  hn 1  hn 1  cn 1  3  f  xn , xn 1   f  xn 1 , xn  2  
hn 1   cn   
 0
 2hn 1
 
3 f n  f  xn , xn 1   

3. Not –a- knot condition : The third derivative at the second and next to last knots are
continuous, therefore,
Si  x   ai  bi  x  xi   ci  x  xi   di  x  xi 
2 3

Si  x   2ci  6di  xi 1  xi 

Si  x   6di

S1  x  | x2 , y2   S2  x  | x2 , y2 

6d1  6d2 or, d1  d 2

ci 1  ci
From equation (6) we know , di 
3hi

c2  c1 c3  c2

3h1 3h2

h2c2  h2c1  h1c3  h1c2

h2c1   h1  h2  c2  h1c3  0

For last but one node : Sn2  x  | xn1 , yn1   Sn1  x  | xn1 , yn1 

dn1  dn2

cn 1  cn 2 cn  cn 1

3hn 2 3hn 1

hn1cn1  hn1cn2  hn2cn  hn2cn1

hn1cn2   hn2  hn1  cn1  hn2cn  0

 h2   h1  h2  h1 0 0   c1   0 
    3  f  x3 , x2   f  x2 , x1  
 h1 2  h1  h2  h2 0 0 0   c2  
0 h2 2  h2  h3  h3 0 0     3  f  x4 , x3   f  x3 , x2  
     
 0 0     
 0 0 0     
    
 0 0 0 hn  2 2  hn  2  hn 1  hn 1  cn 1  3  f  xn , xn 1   f  xn 1 , xn  2  
0
 hn 1   hn  2  hn 1  hn  2   cn   
 0 

Thus for the above mentioned conditions the Splines may be determined.
GENERAL LINEAR LEAST SQUARES (adapted from Mathews & Finks)

Simple linear, polynomial and multi linear all three belongs to the following general linear least
squares model:

(1)
y  a0 z 0  a1 z1  a2 z 2  a3 z 3  a4 z 4  a5 z 5 .  ........am z m  e
It can easily be seen how simple linear and multi linear regression fall within this model ie
z 0  1, z1  x1 , z 2  x2 , , z m  xm . Polynomial regression is also included if the basis functions are
z 0  1, z1  x1 , z 2  x2 , , z m  xm

‘n’ number of data points  Z k yk  and z 0 , z1 , z 2 , z 3 , z 4 , z 5 , , z m are  m  1 independent


functions. So for k th deta point the equation is:

yk  a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5  ........am zkm  ek

IF coefficient vector is {a} then

 y   Z a  e
(2)
 Z  '  Z  {a}  [ Z ]'{ y}   Z  'e

Where

 Z10 Z11 Z12 Z1m 


 0 
Z2 Z 21 Z 22 Z 2m 
 Z    Z30 Z 31 Z 32 Z 3m 
 
 
Z 0 Z n1 Z n2 m (3)
 n Zn 
a  a0 a1 a2 am  '
 y   y1 y2 y3 yn  '
e  e1 e2 e3 en  '

If residual part e become zero then e  0 0 0 '

 Z  '  Z  a   Z  ' y (4)


 Z10 Z 20 Z 30 Z n0   Z10 Z11 Z12 Z1m 
 1   0 
 Z1 Z 21 Z 31 Z n1  Z2 Z 21 Z 22 Z 2m 
 Z  '  Z    Z12 Z 22 Z 32 Z n2   Z 30 Z 31 Z 32 Z 3m 
   
   
Z m Z 2m Z 3m m Z 0 Z n1 Z n2 m
 1 Zn   n Zn 

 N 0 0 n n n

  Zk Zk Z Z Z
0
k Z k1 0
k Z k2 0
k Z km 
 k 1 k 1 k 1 k 1

 n 1 0 n n n

  Zk Zk  Z k1 Z k1 Z Z 
1 2
k k Z k1 Z km 
 k 1 k 1 k 1 k 1

 n 2 0 n n n

  Zk Zk  Z k2 Z k1 Z 
2
k Z k2 Z k2 Z km 
 k 1 k 1 k 1 k 1 
  (5)
 n n n n 
 Z mZ 0 m m
  Z Z 
m
Z k1 m
Z k2 Zk Zk
k 1
k k
k 1
k
k 1
k
k 1


The element of i th row j th column of  Z '  Z  is =


n

Z
k
i 1
k Z kj 1  Z1i 1Z1j 1  Z 2i 1Z 2j 1  Z3i 1Z3j 1  Z 4i 1Z 4j 1   Z ni 1Z nj 1

 Z10 Z 20 Z 30 Z n0   y1 
 1 1 1  y 
 Z1 Z 2 Z 3 Z n1   2
 Z  '  y   Z12 Z 2
Z 2
Z n2 

 y3 
 
2 3

   
Z m Z 2m Z 3m Z nm   yn 
 1
 n 0 
  Z k yk 
 k 1  (6)
 n 1 
  Z k yk 
 k 1 
 n 2 
  Z k yk 
 k 1 
 
 n 
 Z km yk 
 k 1 

Final expression is:


 N 0 0 n n n
  n 0 
  Zk Zk Z Z Z   Z k yk 
0
k Z k1 0
k Z k2 0
k Z km 
 k 1 k 1 k 1 k 1
  k 1 
 n 1 0 1 m  0   n 1 
n n n a
  Zk Zk  Z k1 Z k1 Z Z  Z k Z k      Z k yk 
1 2
k k
a
 k 1 k 1 k 1 k 1
  1   k 1 
 n 2 0 n n n
  a    n
 (7)
  Zk Zk  Z k2 Z k1 Z  Z k2 Z km   2    Z k2 yk 
2
k Z k2
 k 1 k 1 k 1 k 1     k 1 
  am   
 n n n n   n 
 Z mZ 0 m m
   Z km Z k1 Z   k k 
m
Z k2 Z Z  Z m
y
k 1
k k
k 1 k 1
k
k 1
k k
  k 1

After solving a  a0 a1 a2 am  ' the model equation is:

y  a0 z 0  a1 z1  a2 z 2  a3 z 3  a4 z 4  a5 z 5 .  ........am z m (8)

y = prediction of least square fit

From equation 1 e is residual, and then square of residual is Sr

sr    yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5 .  ........am zkm 


n
(9)
k 1

To minimize Sr it is necessary that each partial derivative be zero and these results in the system of
equations

Sr
0 (10)
ak
sr
  2 zk0  yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5  ........am zkm    0
n

a0 k 1
sr
  2 z1k  yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zi4  a5 zk5  ........am zkm    0
n

a1 k 1
sr
  2 z20  yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5  ........am zkm    0
n

a2 k 1
sr
  2 zk3  yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5  ........am zkm    0
n
(11)
a3 k 1

sr
  2 zkm  yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5  ........am zkm    0
n

am k 1

Rearranging equation 11 wrt to a0 a1 a2 am

a0   zk0   a1  zk0 z1k  a2  zk0 zk2  a3  zk0 zk3  ............  am  zk0 zkm   Z k0 yk
n n n n n n

k 1 k 1 k 1 k 1 k 1 k 1

a0  z1k zk0  a1   z1k   a2  z1k zk2  a3  z1k zk3  ............  am  z1k zkm   Z k1 yk
n n 2 n n n n

k 1 k 1 k 1 k 1 k 1 k 1

a0  zi2 zi0  a1  zk2 z1k  a2   zk2   a3  zk2 zk3  ............  am  z1k zkm   Z k2 yk
n n n n n n
2

k 1 k 1 k 1 k 1 k 1 k 1

(12)

a0  z z  a1  z z  a2  z z  a3  z z  ............  am   z   Z
n n n n n n
m 0 m 1 m 2 m 3 m m
i i k k k k k k k k yk
k 1 k 1 k 1 k 1 k 1 k 1

It can be easily recognized as a system of m+1 linear equations m+1 unknown.

So
 Aa  B
or ,
 N 0 0 n n n
0 m   n 0 
  Zk Zk  Z k0 Z k1  Z k0 Z k2  Z Z
k k    Z k yk 
 k 1 k 1 k 1 k 1
  k 1 
 n 1 0 n n n
  a   n

  Zk Zk  Z k1 Z k1 Z Z  Z k1 Z km      Z k1 yk 
1 2 0
k k
a1 
 k 1 k 1 k 1 k 1
   k 1
  

 n 2 0 2 m   a2    
n n n n

  Zk Zk Z Z  Z k Z k      Z k yk 
2
k Z k1 2
k Z k2 2

 k 1 k 1 k 1 k 1     k 1 
 am    (13)
 n n n n   n 
 Z mZ 0 m m
  Z Z   Z k yk 
m
Z k1 m
Z k2 Zk Zk  m

  k 1
k k k k
k 1 k 1 k 1 k 1 

Out cum of the process from equation  8  to 13 is

 Z '  Z  a   Z ' y


So, previous assumption in equation  4  was correct. After solving a , Sr can be calculated as

sr    yk   a0 zk0  a1 z1k  a2 zk2  a3 zk3  a4 zk4  a5 zk5 .  ........am zkm  


n

k 1
(14)
n
   yk  yk 
k 1
 

 
n
S t   yk  y
k 1

 
n 2

St  Sr S  yk  y (15)
r2   1  r  1  k 1 2

 y 
St St n

k  y
k 1

y = prediction of least square method

y = mean of yk
Quadratic Spline:
The objective in quadratic splines is to derive a 2nd order polynomial for each interval
between data points. The polynomial for each interval can be generally represented as:
Si (xi )  ai  bi (x  x i )  ci (x  x i )2 (1)

For n data points (i  1, 2 n) , there are  n  1 intervals and, consequently, 3  n  1


unknown constants (the a ’s, b ’s & c ’s) to evaluate. So, 3  n  1 equations or conditions are
required to evaluate the unknowns.

It can be developed as follows:

 1: The function must pass through all the points.

fi  ai  bi (xi  xi )  ci (xi  xi )2

fi  ai (2)
Or,

So the constant in each spline must be equal to the value of the dependent variable at the
beginning of the interval. Result can be incorporated into Eq 1

Si (xi )  fi  bi (x  x i )  ci (x  x i )2

For  n  1 spline must pass through  xn , yn  point. So,


th

f n1  an1  bn1 (x n  x n1 )  cn1 (x n  x n1 )2  3


th
The equation can be simplified mathematically by defining the width of the i interval as
hi   xi 1  xi 

So Eq  3 simplifies to

f n1  an1  bn1 h n1  cn1 h n12

Number of conditions to be evaluated has now reduced to 3  n  1   n  1  1   2n  1

 2: The function values of adjacent polynomials must be equal at knots. This condition
can be written for knot  i  1 as

fi  bi (x i 1  x i )  ci (x i 1  x i ) 2  fi 1  bi 1 (x i 1  x i 1 )  ci 1 (x i 1  x i 1 ) 2  ci (x i 1  x i 1 ) 2 4
fi  bi hi  ci hi  fi 1
2
 5

The equation can be written for nodes i  1, 2,3,  n 1 . So there are  n  1 conditions,
Number of conditions to be evaluated has now reduced to  2n  1   n  1  n
 3: The first derivatives at the interior nodes must be equal. It means that adjacent
splines will be joined smoothly. The Eq 1 can be differentiated to yield

Si' (x)  bi  2ci (x  x i )

The equation of the derivatives at interior node  i  1 can therefore be written as

bi  2ci hi  bi 1  6
Writing this equation for all the interior nodes amounts to  n  2  conditions. This means that
there is 1 remaining condition.

 4: Assume the 2nd derivative is zero at the first point. 2nd derivative of the Eq 1 is
2ci . So, from Eq(6)

c1  0 7
Putting this condition in Eq(5) for i  1

b1h1  ( f 2  f1 )  8
 bi 1  bi 
From Eq(6) ci  9
2hi

Putting Eq(8) in Eq(5) bi hi  bi 1hi  2( fi 1  fi ) 10


So putting i  1, 2, , n  1 in to Eq(9) there are  n  1 equations with  n  variable.

b1h1  b2 h1  2( f 2  f1 )
b2 h2  b3h2  2( f 3  f 2 )
11
bn 1hn 1  bn hn 1  2( f n  f n 1 )

Here we are assuming bn as an extra variable. We have  n  1 splines so  n  1 b are


there.

From Eq 8 & Eq 11

b1  b2 b1  b2

 h1 0 0  b 2   ( f 2  f1 ) 
h h2 0   b 3   2( f3  f 2 ) 
 2 
 0    
    
0 hn 1 hn 1  b n   2( f n  f n 1 ) 

After solving b1 , b2 , bn we can calculate values of c1 , c2 cn1 from equation (9).


Taylors Series Second Order RK Method is given by
𝑓′(𝑥 𝑖 , 𝑦𝑖 ) 2 𝑦𝑖+1 = 𝑦𝑖 + (𝑎1 𝑘1 + 𝑎2 𝑘2 )ℎ
𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑥𝑖 , 𝑦𝑖 )ℎ + ℎ +⋯
2!
𝑘1 = 𝑓(𝑥𝑖 , 𝑦𝑖 ) and 𝑘2 = 𝑓(𝑥𝑖 + 𝑝1 ℎ, 𝑦𝑖 + 𝑞11 𝑘1 ℎ)
′ (𝑥
Now, 𝑓 𝑖 , 𝑦𝑖 ) can be written by chain-rule differentiation
Taylors Series for a two variable function
𝜕𝑓(𝑥, 𝑦) 𝜕𝑓(𝑥, 𝑦) 𝑑𝑦 𝜕𝑔 𝜕𝑔
𝑓 ′ (𝑥𝑖 , 𝑦𝑖 ) = + 𝑔(𝑥 + 𝑟, 𝑦 + 𝑠) = 𝑔(𝑥, 𝑦) + 𝑟 +𝑠 +⋯
𝜕𝑥 𝜕𝑦 𝑑𝑥 𝜕𝑥 𝜕𝑦
Using the above equation for k 2
𝜕𝑓(𝑥, 𝑦) 𝜕𝑓(𝑥, 𝑦)
𝑓(𝑥𝑖 + 𝑝1 ℎ, 𝑦𝑖 + 𝑞11 𝑘1 ℎ) = 𝑓(𝑥𝑖 , 𝑦𝑖 ) + 𝑝1 ℎ + 𝑞11 𝑘1 ℎ +⋯
Using the above equation in L1 𝜕𝑥 𝜕𝑦
𝜕𝑓(𝑥, 𝑦) 𝜕𝑓(𝑥, 𝑦) 𝑑𝑦 ℎ2 Using the above equation in L1
𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑥𝑖 , 𝑦𝑖 )ℎ + ( + ) +⋯ 𝜕𝑓 𝜕𝑓
𝜕𝑥 𝜕𝑦 𝑑𝑥 2! 𝑦𝑖+1 = 𝑦𝑖 + 𝑎1 ℎ𝑓(𝑥𝑖 , 𝑦𝑖 ) + 𝑎2 ℎ𝑓(𝑥𝑖 , 𝑦𝑖 ) + 𝑎2 𝑝1 ℎ2 + 𝑎2 𝑞11 ℎ2 𝑓(𝑥𝑖 , 𝑦𝑖 ) +⋯
𝜕𝑥 𝜕𝑦
dy
Using dx = f(xi , yi ) in the above equation
Group like terms
𝜕𝑓(𝑥, 𝑦) 𝜕𝑓(𝑥, 𝑦) ℎ2 𝜕𝑓 𝜕𝑓
𝑦𝑖+1 = 𝑦𝑖 + 𝑓(𝑥𝑖 , 𝑦𝑖 )ℎ + ( + 𝑓(𝑥𝑖 , 𝑦𝑖 )) + ⋯ 𝑦𝑖+1 = 𝑦𝑖 + (𝑎1 + 𝑎2 )𝑓(𝑥𝑖 , 𝑦𝑖 )ℎ + [𝑎2 𝑝1 + 𝑎2 𝑞11 𝑓(𝑥𝑖 , 𝑦𝑖 ) ]ℎ2 + ⋯
𝜕𝑥 𝜕𝑦 2! 𝜕𝑥 𝜕𝑦

Comparing the above two equations, we get


(𝑎1 + 𝑎2 ) = 1;
1
𝑎2 𝑝1 = 2;
1
𝑎2 𝑞11 =
2

Taken from Numerical Methods for Engineers – Chapra & Canale

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy