# SOLUTION TO PROBLEM SET NUMBER 9

Document Sample

```					ENGRD241 Engineering Computation                                                                         PS09S, Fall 2002

SOLUTION TO PROBLEM SET NUMBER 9

1. C&C Problem 21.20, page 611. Do part (a) as stated, but instead of parts (b) and (c),
employ 2-point Gauss-Legendre quadrature in each direction.
(a) Analytical solution:
2    4
The given double integral is,    
2 0
( x 2  3 y 2  xy 3 )dxdy . We shall first integrate it with
respect to x, treating y as a constant. Therefore, the integral becomes:
4
2   x3          x2                                                64
2  3
2


 3xy 2  y 3  dy , which reduces to:
2 0                                  2
(
3
-12y2 +16y3)dy. Now, when this is
2
 64    y3   y4 
integrated with respect to y, it becomes:  y  12  16  , which on simplification
3      3    4  2
yields 21.3333.
Possible approaches are: (i) Start with x, treating y as a constant, and then treat y as a
variable; or (ii) Start with y, treating x as a constant, and then treat x as a variable. Both
will yield the same result. Alternatively: (iii) one can treat both x and y as variables and
work with a 2x2 grid of sampling points, each weighted by the appropriate product of G-
L weighting factors (in this case, unity). This too should yield the same result. Here we
pursue approach (i). Note that in this case, we expect to obtain an exact answer because
2-point G-L Quadature should be able to exactly integrate a polynomial of order (2n – 1)
= (2x2 –1) = 3.
The first step is to perform a change of variable for x, so that the limits are from -1 to +1.
(b  a)  (b  a) xd
To do this, we substitute a = 0 and b = 4, in the equation x                                         , to obtain
2
ba
x = 2 + 2xd. Now, using the same values for a and b in the equation dx                                dxd , we
2
  (2  2 x           ) 2  3 y 2  (2  2 xd ) y 3  2 xd
1
obtain dx = 2dxd. The inner integral becomes,                              d
1

 1      1 
Using the 2-point Gauss-Legendre formula I  f        f      , we reduce the inner
 3       3
integral to: 2(10.6665 - 6y2 + 4y3). Now the problem takes the form of
2
2  (10.6665  6 y 2  4 y 3 ) dy . Changing the variable in order to have the limits -1 to +1,
2

as done previously, we have, y = 2yd and dy = 2dyd . The above integral now becomes:
4 10.6665  6(2 yd ) 2  4(2 yd )3 dy . Using the 2-point Gauss-Legendre formula, we get
1

1

the value of the integral as: 21.3333.

Page 1 of 2
ENGRD241 Engineering Computation                                                                     PS09S, Fall 2002

2. C&C Problem 25.7, page 724. Use Excel and submit a printout of your tabular
d2y
We first transform the given 2nd order ordinary differential equation                          t  y  0 into
dt 2
dy          dz
two first order differential equations as,   z and  t  y . We then apply Euler’s and
dt          dt
st
Heun’s formulae to each of the above 1 order differential equations to obtain the result.
The formulae used are: Euler’s, yi+1 = yi + f(xi , yi)h
Heun’s predictor, yi01  yi  f ( xi , yi )h
f ( xi , yi )  f ( xi 1 , yi01 )
Heun’s corrector, yi 1  yi                                  h
2
The given initial conditions are, y(0) = 2, and z(0) = 0. An EXCEL spreadsheet can be used
to do the integration from 0 to 4. The first few rows of the EXCEL sheet are given below.

Euler's                                                                   Heun's
t                z                 y                     z(predictor)            z(corrector) y (predictor)   y (corrector)
0                0                 2                          0                         0             2             2
0.1             -0.2                2                         -0.2                    -0.195           2          1.99025
0.2            -0.39              1.98                     -0.384025                -0.37805        1.97075      1.9615975
0.3           -0.568             1.941                    -0.55420975              -0.5473195     1.9237925    1.915329025
0.4          -0.7321             1.8842                  -0.708852403            -0.701115805 1.860597075       1.85290726
0.5         -0.88052            1.81099                  -0.846406531            -0.837900952 1.782795679      1.775956422
0.6        -1.011619           1.722938                  -0.965496594            -0.956307089 1.692166327       1.68624602
0.7       -1.1239128          1.6217761                  -1.064931691            -1.055150156 1.590615311      1.585673158
0.8      -1.21609041          1.50938482                 -1.143717472            -1.133441721 1.480158142      1.476243564
0.9     -1.287028892         1.387775779                 -1.201066077            -1.190398869 1.362899392      1.360051534
1       -1.33580647          1.25907289                 -1.236404022            -1.225452028 1.241011647      1.239258989

The final answers are:         By Euler’s method, y = 3.2933
By Heun’s method, y = 3.4522

4

Euler's Method       Heun's Method

3

2

y

1

0
0                 1                            2                         3                      4

-1
t

Page 2 of 2

```
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
 views: 5 posted: 10/3/2012 language: Unknown pages: 2