25.18 Solutions:: Xyk y K y K y K
25.18 Solutions:: Xyk y K y K y K
18 Solutions:
If you solved the problem using Runge-Kutta you should get:
The 4th-order RK method with h = 0.5 gives
x y k1 ym k2 ym k3 ye k4 φ
0 1 -1.1 0.725 -0.75219 0.811953 -0.8424 0.578799 -0.49198 -0.79686
0.5 0.60157 -0.51133 0.473737 -0.25463 0.537912 -0.28913 0.457006 -0.0457 -0.27409
1 0.464524 -0.04645 0.452911 0.209471 0.516892 0.239062 0.584055 0.671663 0.253713
1.5 0.59138 0.680087 0.761402 1.494252 0.964943 1.893701 1.538231 4.460869 1.986144
2 1.584452 4.594911 2.73318 10.83023 4.292008 17.00708 10.08799 51.95317 18.70378
x y dy/dx
0 1 -1.1
0.5 0.45 -0.3825
1 0.25875 -0.02588
1.5 0.245813 0.282684
2 0.387155 1.122749
dT
=z
dx
dz
= 0.15T
dx
The solution was using the Heun method (without iteration) with a step-size of 0.01.
An initial condition of z = −120 was chosen for the first shot. The first few calculation
results are shown below.
The resulting value at x = 10 was T(10) = −1671.817. A second shot using an initial
condition of z(0) = −60 was attempted with the result at x = 10 of T(10) = 2047.766.
These values can then be used to derive the correct initial condition,
− 60 + 120
z (0) = −120 + (150 − (−1671.817)) = −90.6126
2047.766 − (−1671.817)
The resulting fit, along with the two “shots” are displayed below:
3000
2000
1000
0
0 2 4 6 8 10
-1000
-2000
The final shot along with the analytical solution (displayed as filled circles) shows
close agreement:
200
150
100
50
0
0 2 4 6 8 10
27.3 Solution
A centered finite difference can be substituted for the second derivative to give,
Ti +1 − 2Ti + Ti −1
− 0.15Ti = 0
h2
or for h = 1,
− Ti −1 + 2.15Ti − Ti +1 = 0
2.15T1 − T2 = 240
− T9 + 2.15T10 = 150
The tridiagonal system can be solved with the Thomas algorithm or Gauss-Seidel for
(the analytical solution is also included)
x T Analytical
0 240 240
1 165.7573 165.3290
2 116.3782 115.7689
3 84.4558 83.7924
4 65.2018 64.5425
5 55.7281 55.0957
6 54.6136 54.0171
7 61.6911 61.1428
8 78.0223 77.5552
9 106.0569 105.7469
10 150 150
The following plot of the results (with the analytical shown as filled circles) indicates
close agreement.
240
160
80
0
0 2 4 6 8 10