Shooting Method: Boundary Value Problems (BVPS)

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

Boundary Value Problems(BVPs)

Two types of numerical methods for two point BVPs:


1. Shooting Method.
2. Finite Difference Method.

BVP and IVP:

IVP BVP
The auxiliary conditions are at one point of the  The auxiliary conditions are not at one
independent variable. point of the independent variable.
x  2 x  x  e 2 t  More difficult to solve than IVP.
x  o   1, x  o   2.5 x  2 x  x  e 2t
x  o   1, x  2   1.5
Same
Different

Shooting Method
d2 y
−2 y =8 x( 9−x )
Using Shooting method, solve the equation dx 2 ; y(0 )=0 and
'
; y(9 )=0 . To solve the problem, we need initial condition y ( 0)=??

Let us assume, y ' (0)=4

Our problem become as,

d2 y
−2 y =8 x( 9−x )
dx 2 '
; y (0)=0 and y(0)=0.............................................................(1)

dy
=z=f 1 ( x, y ,z )........... ..... .................(2)
Let, dx
Then from (1), we have

dz
=2 y+8 x(9−x ).................................(2 )
dx

Now we will solve the problem by Euler method with h=3


Euler method for (2) and (3):
y i+1 = y i +f 1 ( x i , y i , z i )h

And z i+1 =z i+f 2 ( xi , y i , z i )h

For yi+1=yi+f 1(xi,yi ,zi ) ,

y 1 = y 0 +f 0 ( x 0 , y 0 , z 0 )h

=0+f 1 (0,0,4 )×3

= 12

z 1=z 0 +f 2 ( x 0 , y 0 , z0 )h

= 4 +0
=4

i.e. , at
x 1=x 0 + h=0+3=3

Now y 1 ( x 1 )=12 and z 1 ( x 1 )=4

For i=1

y 2 = y 1 +f 1 ( x 1 , y1 , z 1 )h

=12+f 1 (3 , 12 , 4 )×3

= 24

z 2=z 1 + f 2 (x 1 , y 1 , z 1 )h

=4+f 2(3 , 12 , 4 )×3

= 508

. , at
x2  x1  h  3  3  6
i.e

y2 ( x2 )  24 and z2 ( x2 )  508
Now

For i=2

y 3 = y 2 +f 1 ( x 2 , y 2 , z2 )h

=24 +f 1 (6 , 24 , 508)×3
= 1548

i.e. , at
x 3 =9 , y 3 =1548 , which is not match with the condition y(9 )=0
.
Now we have to choose one kind of hit and trial method to choose a different value.

Let y(0)  24 and go through the steps of Euler method.

dy
=z=f 1 ( x , y , z )
dx and
dz
=2 y +8 x (9−x )
dx

For yi+1=yi+f 1(xi,yi ,zi ) ,

y1  y0  f1 ( x0 , y0 , z0 )h

=0+f 1 (0,0 ,−24 )×3

= −72

z 1=z 0 + f 2 ( x 0 , y 0 , z0 )h

= −24+0
= -24

i.e., at
x1  x0  h  0  3  3 , y1 ( x1 )  72 , z1 ( x1 )  24

For i=1

y 2 = y 1 +f 1 ( x 1 , y1 , z 1 )h

=−72+f 1 (3 ,−72,−24 )×3

= -144

z 2=z 1 + f 2 (x 1 , y 1 , z 1 )h

=−24 +f 2 (3 ,−72 ,−24 )×3

= -24

For i=2

y 3 = y 2 +f 1 ( x 2 , y 2 , z2 )h
=−144 +f 1 (6 ,−144 ,−24 )×3

= -216

i xi yi zi
0 0 0 -24
1 3 -72 -24
2 6 -144 -24
5 9 -216

i.e. , at 3
x =9
, y 3 (9 )=−216 , which is more near to the given condition y(9 )=0 than the
previous assumption but not very much near value. So we have to choose different value for
y ' (0) and continue the process.

Now we can use iterative method

y ' (0) y3  y3 (9)


q 0=4 p0 =1548
 0
q1 =−24 p1 =−216

Let
q=q 0 +q 1 where

q1 =−24 , q 0=4

And
p= p0 + p1 where ,

p0 =1548 , p1 =−216

Now the straight line can be expressed as ;


q 1−q0
q=q 0 + ( p− p0 )
p 1− p 0

−24−4
4+ ( p−1548 )
= −216−1548

−28
4+ (0−1548 )
= −1764

= -20.57
Consider y ' (0)=−20 .57 and go through the steps of Euler method as before

Now

dy
=z=f 1 ( x , y , z )
dx and
dz
=2 y +8 x (9−x )
dx

For yi+1=yi+f 1(xi,yi ,zi ) ,

y1  y0  f1 ( x0 , y0 , z0 )h

=0+f 1 (0,0 ,−20 . 57)×3

= -61.71

z 1=z 0 +f 2 ( x 0 , y 0 , z0 )h

= −20 .57+0

= −20 .57

For i=1

y 2 = y 1 +f 1 ( x 1 , y1 , z 1 )h

=−61 . 71+f 1 (3 ,−61 .71 ,−20 . 57 )×3

= -123.42

z 2=z 1 + f 2 (x 1 , y 1 , z 1 )h

=−24 +f 2 (3 ,−61. 71,−20 .57 )×3

= 41.71

For i=2

y 3 = y 2 +f 1 ( x 2 , y 2 , z2 )h

=−123 . 42+f 1 (3 ,−61. 71 , 41. 17 )×3

= 0.09

i xi yi zi
0 0 0 -20.57
1 3 -61.71 -20.57
2 6 -123.42 41.17
3 9 0.09
Here,
y3 (9)  0.09  y (9)

So the solution Table is :


x y
0 0
3 -61.71
6 -123.42
9 0.09

Conclusion of Shooting Method:


1. Guess a value for the auxiliary conditions at one point of time.
2. Solve the IVP using Euler, Runge-Kutta, Taylor series.
3. Check if the boundary conditions are satisfied, otherwise modify the guess and resolve
the problem.

 Use interpolation in updating the guess.


 It is an iterative procedure and can be efficient in solving the BVP.

Problem-1: Solve the Boundary value problem by Shooting Method

ÿ−4 y+4 x=0


y ( 0 )=0 , y ( 1 ) =2

Solution: Let us assume that ẏ ( 0 )=3


Now our problem becomes
ÿ−4 y +4 x=0
ẏ ( 0 )=3 , y ( 0 )=0 (1)

dy
ẏ= =z=f 1 ( x , y , z )
Let, dx

(2)
Then from (1) we have,
dz
= ż =4 y −4 x=f 1 ( x , y , z )
dx
(3)
Now we will solve the problem by the following Euler method with h=0.5.Euler method for (2)
and (3)

y i+1 = y i +f 1 ( x i , y i , z i ) . h

z i+1 =z i+f 2 ( xi , y i , z i ) . h

y 1 = y 0 +f 1 ( x 0 , y 0 , z 0 ) . h

y 1 =0+f 1 ( 0 ,0 , 3 ) . 5
=0+3∗. 5=1. 5
z 1=z 0 +f 2 ( x 0 , y 0 , z 0 ) . h

z 1=0+f 2 ( 0 , 0 , 3 ) . 5
=3+0=3
at
x 1=x 0 +h=0+0 .5=.5
y 1 ( x 1 ) =1. 5 and z 1 ( x 1 ) =3

y2= y1+ f 1 ( x 1 , y 1 , z1 ) . h

y 1 =1. 5+f 1( .5 ,1.5 , 3 ) . 5


=1.5+3∗0 .5=3
z 2=z 1 + f 2 ( x 1 , y 1 , z 1 ) . h

z 2=3+f 1 ( .5 ,1. 5 ,3 ) . 5
=3+4∗0 .5=6
at
x 2=x 1 + h=0 . 5+0 .5=1
y 2 ( x 2 ) = y 2 ( 1 ) =3

Which is not math with the condition y(1)=2


Now we have to choose one kind of hit and trial method to choose a different value
Let,
'
y ( 0 )=1 and go through the step of Euler method
y 1= y 0+ f 1 ( x 0 , y 0 , z0 ) . h

y 1 =0+f 1 ( 0,0 , 1 ) . 5
=0. 5
z 1=z 0 + f 2 ( x 0 , y 0 , z 0 ) . h

z 1=0+f 2 ( 0,0 , 1 ) . 5
=1+0=1
at
x 1=x 0 +h=0+0 .5=.5
y 1 ( x 1 ) =.5 and z 1 ( x 1 )=1

y2= y1+ f 1 ( x 1 , y 1 , z1 ) . h

y 2 =0 .5+f 1 ( 0.5,0.5 ,1 ) 0 . 5
=0.5+0.5=1
z 2=z 1 + f 2 ( x 1 , y 1 , z 1 ) . h

y 2 =1+f 2 ( 0 .5,0 .5 ,1 ) 0 . 5
=1+0=1
x 1=x 0 +h=0. 5+0 . 5=1
y 2 ( 1 )=1

Which is also near to the condition y (1)=2


''
Now we have different value for y ( 0 ) and continue the process we can use iterative method

Let,
q=q 0 +1 , where p0 =3 , q1 =1 and p= p0 + p1

q 1−q0
q=q 0 + p− p0 )
p 1− p 0 (

1−3
q=3+ (2−3 )
1−3

=3+ (−1 )=3−1=2

So condition ẏ ( 0 )=2 go through the steps of Euler method as follow as before,


y 1= y 0+ f 1 ( x 0 , y 0 , z 0 ) . h
=0+f 1 ( 0,0,2 ) . 0 .5=0+2 ∗0 .5=1

z 1=z 0 + f 2 ( x 0 , y 0 , z 0 ) . h

z 1=1+f 2 ( 0,0 ,2 ) 0 . 5
=2+0=2
x 1=x 0 + h=0. 5
y 1 ( x 1 ) =1 z 1 ( x1 )=2

y 2= y 1+ f 1 ( x 1 , y 1 , z1 ) . h

y 2 =1+f 1 ( 0.5,1 , 2 ) 0 . 5
=1+2∗0 .5=2
z 2=z 1 + f 2 ( x 1 , y 1 , z 1 ) . h

z 2=2+f 2 ( 0. 5,1 ,2 ) 0 . 5
=2+2∗0 .5=2+1=3
i xi yi zi
0 0 0 2
1 0.5 1 2
2 1 2 1

So the solution table is

x y
0 0
.5 1
1 2

Problem-2: Solve the boundary value problem by Shooting Method


−2
yʺ=
x yʹ
y ( 1 )=0 , y (2 )=2

Solution:
Let us assume y ʹ ( 1 )=3

Now our problem become as,


−2
yʺ= ʹ
, y ( 1 )=0 , y ʹ ( 1 )=3 …(i)
xy

Let, y ʹ =z =f 1 ( x , y , z ) …(ii)

Then, from (i) we have


dz −2
= =f 2 …(iii)
dx xz
Now, we will solve the problem by Euler method with h=.5

Euler method for (ii) and (iii)

y 1= y 0 + f 1 ( x 0 , y 0 , z 0 ) h

¿ 0+ f 1 ( 1,0,3 ) .5

¿ 1.5

z 1=z 0 +f 2 ( x 0 , y 0 , z 0 ) h

¿ 3+ f 2 ( 1,0,3 ) .5

¿ 2.667
x 1=x 0+ h

¿ 1+.5
¿ 1.5

i.e x 1=¿ 1.5, y 1 ( x 1)=1.5 , z 1 ( x 1 )=2.333

y 2= y 1 + f 1 ( x 1 , y 1 , z1 ) h

¿ 2.8 ≈ 2

z 2=z 1+ f 2 ( x 1 , y 1 , z 1 ) h

¿ 2.4

At x 2=1.6+.5=2.1 ≈2 Which is match with condition y ( 2 )=2

i xi yi zi
0 1 0 3
1 1.5 1.5 2.6
2 2.1 2.8 2.4

So, the solution table is


x y
1 0
1.5 1.5
2.8 2.8

Problem-3 y  y  0

y  0   0, y  1  1

Solution:

y  0   3
Let us assume
Now our problem becomes,

y  y  0; y  0   0, y  1  1
……………………(1)
dy
y   z  f1  x, y , z 
Let, dx ……………………..(2)
Then from (1), we have
dz
 z   y  f 2  x, y , z 
dx ………………………………(3)
Now we will solve the problem by Euler method with h=0.5
Euler method for (2) & (3);

yi 1  yi  f1  xi , yi , zi  h

zi 1  zi  f 2  xi , yi , zi  h

For i  0

y1  y0  f1  x0 , y0 , z0  h

 0  f1  0, 0,3  0.5
 1.5

z1  z0  f 2  x0 , y0 , z0  h

 3  f 2  0, 0,3  0.5

3

i.e
x1  x0  h  0  0.5  0.5

y1  x1   1.5, z1  x1   3

For i  1

y2  y1  f1  x1 , y1 , z1  h

 1.5  f1  0.5,1.5,3  0.5

 1.5  3  0.5
3

z2  z1  f 2  x1 , y1 , z1  h

 3  f 2  0.5,1.5,3   0.5

 3  1.5  0.5
 3.75

i.e
x2  x1  h  0.5  0.5  1

y2  x2   3, z2  x2   3.75

which is not match with the condition y1 (1)  1 .

Now we have to choose one kind of hit and trial method to choose a different value.

Let y(0)  2 and go through the steps of Euler method.


dy
=z=f 1 ( x , y , z )
dx and
dz
 z   y  f 2  x, y , z 
dx
For yi+1=yi+f 1(xi,yi ,zi ) ,

y1  y0  f1 ( x0 , y0 , z0 )h

 0  f1 (0,0, 2)  0.5

0.5  2  1
=

z 1=z 0 + f 2 ( x 0 , y 0 , z0 )h

= 20
=2

i.e., at
x1  x0  h  0.5 , y1 ( x1 )  1 , z1 ( x1 )  2

For i=1

y 2 = y 1 +f 1 ( x 1 , y1 , z 1 )h

 1  f1 (0.5,1, 2)  0.5

= 1  0.5  2

=2

z 2=z 1 + f 2 (x 1 , y 1 , z 1 )h

 2  f 2 (0.5,1, 2)  0.5

 2  0.5  2.5

x2  1 , y2 (1)  2 , which is more near to the given condition y (1)  1 than the previous
i.e. , at
'
assumption. So we have to choose different value for y (0) and continue the process.
Now we can use iterative method

y ' (0) y2  y2 (1)


q0  3 p0  3
0 1
q1  2 p1  2
Let
q=q 0 +q 1 where

q1  2 , q0  3

And
p= p0 + p1 where ,

p0  3 p1  2
,
Now the straight line can be expressed as ;
q 1−q0
q=q 0 + ( p− p0 )
p 1− p 0

23
3 (1  3)
= 23

=1

Consider y(0)  1 and go through the steps of Euler method as before


Now

dy
=z=f 1 ( x , y , z )
dx and
dz
 z   y  f 2  x, y , z 
dx

For yi+1=yi+f 1(xi,yi ,zi ) ,

y1  y0  f1 ( x0 , y0 , z0 )h

 0  f1 (0,0,1)  0.5

= 0.5

z 1=z 0 + f 2 ( x 0 , y 0 , z0 )h

= 1 0

=1

For i=1

y 2 = y 1 +f 1 ( x 1 , y1 , z 1 )h
 0.5  f1 (0.5, 0.5,1)  0.5

=1

z 2=z 1 + f 2 (x 1 , y 1 , z 1 )h

= 1.25
So the solution Table is :
x y
0 0
0.5 0.5
1 1

You might also like