[go: up one dir, main page]

0% found this document useful (0 votes)
68 views14 pages

Numerical Methods Problems

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 14

Numerical Methods Problems

Epiphany Term
Numerical Dierentiation
Question 1
Use the forward, central and backward dierence formulae to complete the last row
of the table
x 0.5 0.6 0.7
f(x) 0.493 0.712 0.933
f

(x)
Solution:
We use the forward dierence formula to get the rst entry:
f

(0.5)
f(x + h) f(x)
h
=
0.712 0.493
0.1
= 2.190,
the central dierence formula to get the middle entry:
f

(0.6)
f(x + h) f(x h)
2h
=
0.933 0.493
0.2
= 2.200
and the backward dierence formula to get the last entry:
f

(0.7)
f(x) f(x h)
h
=
0.933 0.712
0.1
= 2.210.
Question 2
Recall the error term for the 2
nd
order central dierence formula is given by
1
6
f

(c)h
2
for some x h < c < x +h. For the function f(x) = x
3
+ 2x, how small a stepsize h
would this require to compute f

(0) to within an accuracy of 0.001 ?


Solution:
We use the error formula at x = 0. Since f

(c) = 6, we have |f

(c)| 6 for
h < c < h. Hence, then absolute error satises

1
6
f

(c)h
2

1
6
(6)h
2
= h
2
.
Thus we need h
2
0.001 and so h 0.03 will suce. (Note that we should round
down from

0.001 = 0.0316... here.)


1
Question 3
Apply the 2
nd
order central dierence formula with stepsizes h = 0.1, h = 0.2 and
h = 0.4 to estimate the derivative of x
4
at x = 1 and compare with the actual value.
A 4-point dierence formula for the derivative is given by
f

(x)
2f(x h) 3f(x) + 6f(x + h) f(x + 2h)
6h
Repeat your estimates with this formula and comment on the order of the error.
Solution:
Using the central dierence formula,
f

(1)
f(x + h) f(x h)
2h
=
_

_
1.1
4
0.9
4
2 0.1
= 4.04 when h = 0.1
1.2
4
0.8
4
2 0.2
= 4.16 when h = 0.2
1.4
4
0.6
4
2 0.4
= 4.64 when h = 0.4
Using the 4-point formula,
f

(1)
_

_
2 0.9
4
3 1
4
+ 6 1.1
4
1.2
4
6 0.1
= 3.998 when h = 0.1
2 0.8
4
3 1
4
+ 6 1.2
4
1.4
4
6 0.2
= 3.984 when h = 0.2
2 0.6
4
3 1
4
+ 6 1.4
4
1.8
4
6 0.4
= 3.872 when h = 0.4
The actual value of the derivative is f

(1) = 4.
For the central dierence formula, the error is 4h
2
each time conrming that it is
a 2
nd
order method.
For the 4-point formula the error is 2h
3
each time which suggests that it is a 3
rd
order method.
Question 4
Using the central dierence formula for the second derivative
f

(x)
f(x + h) 2f(x) + f(x h)
h
2
with a stepsize h = 0.1, estimate f

(2) when f(x) = xe


x
. Repeat with h = 0.2 and
h = 0.4 and comment on the order of the error.
Page 2
Solution:
Using the central dierence formula for f

(x),
f

(2)
_

_
2.1e
2.1
2 2e
2
+ 1.9e
1.9
0.1
2
= 29.593 when h = 0.1
2.2e
2.2
2 2e
2
+ 1.8e
1.8
0.2
2
= 29.704 when h = 0.2
2.4e
2.4
2 2e
2
+ 1.6e
1.6
0.4
4
= 30.152 when h = 0.4
The actual 2
nd
derivative is f

(x) = (x + 2)e
x
so f

(2) = 4e
2
= 29.556.
Hence the errors are -0.037, -0.148 and -0.595 respectively.
These are roughly 3.7h
2
in each case which suggests the method is 2
nd
order.
Numerical Integration
Question 5
Given data
x 1.0 1.2 1.4 1.6 1.8
f(x) 3.120 4.426 6.042 8.030 10.467
use the Left, Right and Midpoint rectangular rules to approximate
_
1.8
1
f(x) dx.
Solution:
For the Left and Right Endpoint Rules, we can take n = 4 subintervals of width
h = 0.2.
The Left Endpoint Rule gives:
_
1.8
1
f(x) dx h
n

i=1
f(x
i1
)
= 0.2(3.120 + 4.426 + 6.042 + 8.030) = 4.3236
The Right Endpoint Rule gives:
_
1.8
1
f(x) dx h
n

i=1
f(x
i
)
= 0.2(4.426 + 6.042 + 8.030 + 10.467) = 5.7930
To use the Midpoint Rule, since we need values of f(x) at midpoints of each subin-
terval, well need to take only n = 2 intervals of width h = 0.4. Then we get:
_
1.8
1
f(x) dx h
n

i=1
f(x
i
h/2)
= 0.4(4.426 + 8.030) = 4.9824
Page 3
Question 6
The arclength of a curve y = g(x) over a x b is given by the integral
_
b
a
_
1 + g

(x)
2
dx
Use the Midpoint rule with 3 panels on the integral when g(x) = sin(x), a = 0 and
b = /2 and hence estimate the length of a complete sine wave.
Given that the 2nd derivative of f(x) =
_
1 + g

(x)
2
satises
1
2

2 f

(x) 1,
nd a bound for the error in your estimate.
Solution:
Let f(x) =
_
1 + g

(x)
2
=

1 + cos
2
x.
Applying the Midpoint Rule with n = 3 intervals, h = /6 and x
i
= ih, we get
_
/2
0
f(x) dx h
n

i=1
f(x
i
h/2)
=

6
_
f
_

12
_
+ f
_
3
12
_
+ f
_
5
12
__
= 0.5236 [1.3903 + 1.2247 + 1.0330]
= 1.9102
From x = 0 to /2 is a quarter of a wave, hence we estimate 4 1.9102 = 7.6404
for the length of a full wave.
From the given information, we know |f

(c)| K = 1 for 0 < c < /2 hence the


Midpoint Rule error satises
|E
M
|
K(b a)h
2
24
=

3
288
= 0.1077
Hence after multiplying by 4, our estimate is bounded above by 0.4306.
(The actual error is less than 0.00001 ! )
Question 7
Use the Midpoint Rule to estimate
_
1
0
x
4
2x
3
dx to within 0.02 of the correct value.
Justify the number of panels you have used.
Solution:
The second derivative f

(x) = 12x
2
6 is increasing over the interval 0 x 1 so
takes its largest absolute values at the endpoints.
These are f

(0) = 6 and f

(1) = 6 so |f

(x)| K = 6 for 0 x 1.
Hence the error term satises |E
M
|
K(b a)
24n
2
=
1
4n
2
.
Page 4
We want
1
4n
2
0.02 and so n
2
> 12.5, i.e. we should use n 4 panels.
Hence use the Midpoint Rule with h = 0.25:
_
1
0
x
4
2x
3
dx 0.25 [f(0.125) + f(0.375) + f(0.625) + f(0.875)] = 0.295
Question 8
Given the table
x 1 1.2 1.4
f(x) 1.0 2.5 2.0
use the Trapezoidal rule with 2 panels to estimate
_
1.4
1
f(x) dx. If we are told that
f(1.1) = f(1.3) = d and that the Trapezium Rule with 4 panels gives the value 0.9,
calculate d.
Solution:
With 2 panels, the Trapezoidal Rule gives
_
1.4
1
f(x) dx
0.2
2
[1.0 + 2 2.5 + 2.0] = 0.8
With 4 panels, the Trapezoidal Rule give
_
1.4
1
f(x) dx
0.1
2
[1.0 + 2d + 2 2.5 + 2d + 2.0] = 0.9
Rearranging we nd d = 2.5.
Question 9
Compute the integral
_
0.4
0
sin(x
2
) dx correct to 3 decimal places by repeatedly apply-
ing the Trapezoidal rule with 1, 2, 4, 8, . . . panels until the sequence stabilises.
Solution:
Write T(h) for the Trapezoidal Method approximation with interval width h.
T(0.4) =
0.4
2
_
sin(0) + sin(0.4
2
)

= 0.03186
T(0.2) =
0.2
2
_
sin(0) + 2 sin(0.2)
2
+ sin(0.4
2
)

= 0.02393
T(0.1) =
0.1
2
_
sin(0) + 2 sin(0.1
2
) + 2 sin(0.2)
2
+ 2 sin(0.3
2
) + sin(0.4
2
)

= 0.02195
T(0.05) =
0.05
2
_
sin(0) + 2 sin(0.05
2
) + + 2 sin(0.35
2
) + sin(0.4
2
)

= 0.02146
T(0.025) =
0.025
2
_
sin(0) + 2 sin(0.025
2
) + + 2 sin(0.375
2
) + sin(0.4
2
)

= 0.02134
The sequence has stabilised at 0.021.
Page 5
Question 10
Use Simpsons Rule with n = 6 intervals to estimate
_
4
1

1 + x
3
dx.
Solution:
Using Simpsons Rule with h =
41
6
= 0.5,
_
4
1

1 + x
3
dx
0.5
3
_

1 + 1
3
+ 4

1 + 1.5
3
+ 2

1 + 2
3
+ 4

1 + 2.5
3
+2

1 + 3
3
+ 4

1 + 3.5
3
+

1 + 4
3
_
= 12.8718
Question 11
Approximate
_
2
0
x
2
e
x
2
dx using intervals of width h = 0.5 using
(a) the Composite Midpoint Rule,
(b) the Composite Trapezoidal Rule,
(c) the Composite Simpsons Rule.
Solution:
(a) With the Midpoint Rule,
_
2
0
x
2
e
x
2
dx 0.5
_
0.25
2
e
0.25
2
+ 0.75
2
e
0.75
2
+ 1.25
2
e
1.25
2
+ 1.75
2
e
1.75
2
_
= 0.42498
(b) With the Trapezoidal Rule,
_
2
0
x
2
e
x
2
dx
0.5
2
_
0
2
e
0
2
+ 2 0.5
2
e
0.5
2
+ 2 1
2
e
1
2
+ 2 1.5
2
e
1.5
2
+ 2
2
e
2
2
_
= 0.41818
(c) With Simpsons Rule,
_
2
0
x
2
e
x
2
dx
0.5
3
_
0
2
e
0
2
+ 4 0.5
2
e
0.5
2
+ 2 1
2
e
1
2
+ 4 1.5
2
e
1.5
2
+ 2
2
e
2
2
_
= 0.42274
(The actual value is 0.42272506...)
Page 6
Question 12
Determine the interval width h required to approximate
_
1
0
sin(3x) dx to within
0.0001 using
(a) the Composite Midpoint Rule,
(b) the Composite Trapezoidal Rule,
(c) the Composite Simpsons Rule.
Solution:
(a) Set f(x) = sin(3x). Then f

(x) = 9 sin(3x) and |f

(x)| K = 9 for all


0 < x < 1. So we need
|E
M
|
(b a)h
2
K
24
=
9h
2
24
0.0001
i.e. h 0.0163. Hence taking h = 1/62 = 0.0161 i.e. 62 panels will suce.
(b) We can take K = 9 again and need
|E
T
|
(b a)h
2
K
12
=
9h
2
12
0.0001
i.e. h 0.1154. Hence taking h = 1/87 = 0.01149 i.e. 87 panels will suce.
(c) Now f
(4)
(x) = 243 sin(x) and |f
(4)
(x)| K = 243. We need
|E
S
|
(b a)h
4
K
180
=
243h
4
180
0.0001
i.e. h 0.0927. Hence taking h = 1/12 = 0.0833 i.e. 12 panels will suce.
(Remember for Simpsons Rule we need n to be even.)
Question 13
(a) How many intervals are required to approximate
_
1
0
(x
3
+x
5
) dx using Simpsons
Rule to within 0.0001 of the actual answer ?
(b) Do the numerical integration with this value of n.
Solution:
(a) Let f(x) = x
3
+x
5
. Then f
(4)
(x) = 120x so for 0 < x < 1, |f
(4)
(x)| < K = 120.
Hence the bound for the error term is Hence the error term satises
|E
S
|
K(b a)
5
180n
4
=
2
3n
4
.
We want
2
3n
4
0.0001 and so n
4
> 6667, i.e. we should use n 9 panels.
Simpsons Rule must use an even number so we take n = 10 panels of width
h = 0.1.
Page 7
(b) With Simpsons Rule,
_
1
0
(x
3
+ x
5
) dx
0.1
3
_
(0
3
+ 0
5
) + 4(0.1
3
+ 0.1
5
) + 2(0.2
3
+ 0.2
5
) + 4(0.3
3
+ 0.3
5
)
+2(0.4
3
+ 0.4
5
) + 4(0.5
3
+ 0.5
5
) + 2(0.6
3
+ 0.6
5
)
+4(0.7
3
+ 0.7
5
) + 2(0.8
3
+ 0.8
5
) + 4(0.9
3
+ 0.9
5
) + (1
3
+ 1
5
)

= 0.4167
Question 14
Determine the value of n such that the Trapezoidal Rule approximates the value of
_
3
0
ln(x
2
+ 2) dx
to within 0.01. Compute the estimated value.
Solution:
Let f(x) = ln(x
2
+ 2). Then f

(x) =
2x
x
2
+ 2
and f

(x) =
2(2 x
2
)
(x
2
+ 2)
2
.
To apply the error formula for the Trapezoidal rule, we need to calculate the max-
imum value of |f

(x)| for 0 < x < 3. This value must be at either the ends of the
interval or at a turning point. Now f

(0) = 1 and f

(3) =
14
121
.
Also, the turning points of f

(x) are found by solving


f

(x) =
4x(x
2
6)
(x
2
+ 2)
3
= 0
i.e. when x = 0 or x =

6. The only new value to calculate is f

6) =
1
8
.
Comparing these values, we nd the maximum K = |f

(0)| = 1.
The error term for the Trapezoidal rule satises
|E
T
|
K(b a)
3
12n
2
=
1 (3 0)
3
12n
2
=
9
4n
2
and we require this to be 0.01.
Hence n
2

9
40.01
= 225, so taking n = 15 will suce.
Applying the Trapezoidal Rule with h =
ba
n
=
3
15
= 0.2,
_
3
0
ln(x
2
+ 2) dx
0.2
2
_
ln(0
2
+ 2) + 2 ln(0.2
2
+ 2) + ... + 2 ln(2.8
2
+ 2) + ln(3
2
+ 2)

= 4.39243
Page 8
Question 15
The following table shows the speed of a snail at various distances in a race of overall
distance 20cm.
Distance (in cm) 0 5 10 15 20
Speed (in cm/sec) 4 8 9 6 4
Use Simpsons Rules to estimate how long it took to nish.
Solution:
We want to integrate 1/speed against distance. To see this, let p(t) be the distance
travelled after t seconds and T be the overall time. Then dp = p

(t)dt so
T =
_
T
0
dt =
_
20
0
1
p

(t)
dp.
(Also notice this has the right dimensions: distance/speed=time.)
Applying Simpsons Rule with h = 5, we nd
T
0.5
3
_
1
4
+ 4
1
8
+ 2
1
9
+ 4
1
6
+
1
4
_
= 3
4
27
sec.
To check that our estimate makes sense, notice that if the snail moved at constant
speed 4cm/sec it would nish in 5 seconds and if it moved at constant speed 9cm/sec
it would nish in about 2 seconds. Its a very fast snail !
Numerical Solutions of ODEs
Question 16
Apply Eulers Method to the initial value problem y

= t y, y(1) = 2 to estimate
y(1.1) and y(1.2) using stepsizes h = 0.1 and 0.05.
Repeat using the 2
nd
order Taylor Series Method and compare your results with the
exact solution.
Solution:
Set f(t, y) = t y. For Eulers method with h = 0.1,
y
i+1
= y
i
+ hf(t
i
, y
i
) = 0.9y
i
+ 0.1t
i
t
0
= 1, y
0
= y(1) = 2
t
1
= 1.1, y
1
= 0.9 2 + 0.1 1 = 1.9 y(1.1) 1.9
t
2
= 1.2, y
2
= 0.9 1.9 + 0.1 1.1 = 1.82 y(1.2) 1.82
Page 9
For Eulers method with h = 0.05,
y
i+1
= y
i
+ hf(t
i
, y
i
) = 0.95y
i
+ 0.05t
i
t
0
= 1, y
0
= y(1) = 2
t
1
= 1.05, y
1
= 0.95 2 + 0.05 1 = 1.95
t
2
= 1.1, y
2
= 0.95 1.95 + 0.05 1.05 = 1.905 y(1.1) 1.905
t
3
= 1.15, y
3
= 0.95 1.905 + 0.05 1.1 = 1.86475
t
4
= 1.2, y
4
= 0.95 1.86475 + 0.05 1.15 = 1.82901 y(1.2) 1.82901
For the 2
nd
order Taylor series method with h = 0.1, we need the derivative f

(t, y) =
1 y

= 1 t + y. Then
y
i+1
= y
i
+ hf(t
i
, y
i
) +
1
2
h
2
f

(t
i
, y
i
)
= y
i
+ 0.1(t
i
y
i
) + 0.005(1 t
i
+ y
i
)
= 0.905y
i
+ 0.095t
i
+ 0.005
t
0
= 1, y
0
= y(1) = 2
t
1
= 1.1, y
1
= 0.905 2 + 0.095 1 + 0.005 = 1.91 y(1.1) 1.91
t
2
= 1.2, y
2
= 0.905 1.91 + 0.095 1.1 + 0.005 = 1.83805 y(1.2) 1.83805
For the 2
nd
order Taylor series method with h = 0.05,
y
i+1
= y
i
+ hf(t
i
, y
i
) +
1
2
h
2
f

(t
i
, y
i
) = 0.95125y
i
+ 0.04875t
i
+ 0.00125
t
0
= 1, y
0
= y(1) = 2
t
1
= 1.05, y
1
= 0.95125 2 + 0.04875 1 + 0.00125 = 1.9525
t
2
= 1.1, y
2
= 0.95125 1.9525 + 0.04875 1.05 + 0.00125 = 1.90975
y(1.1) 1.90975
t
3
= 1.15, y
3
= 0.95125 1.905 + 0.04875 1.1 + 0.00125 = 1.87152
t
4
= 1.2, y
4
= 0.95125 1.86475 + 0.04875 1.15 + 0.00125 = 1.8376
y(1.2) 1.8376 .
The equation y

+ y = t is linear with integrating factor = e


t
and
(e
t
y)

= e
t
y

+ e
t
y = te
t
.
Integrating by parts gives e
t
y =
_
te
t
dt = e
t
(t 1) + C.
Since y(1) = 2, this means C = 2e and so y(t) = t 1 + 2e
1t
.
Hence y(1.1) = 0.1 + 2e
0.1
= 1.90967 and y(1.2) = 0.2 + 2e
0.2
= 1.83746.
Page 10
Question 17
Given
dy
dt
= 2ty and y(1) = 1, estimate y(1.2) using step size h = 0.1 with
(a) the Euler Method
(b) the Modied Euler Method
(c) the 4
th
order Runge-Kutta Method.
Solution:
(a) Set f(t, y) = 2ty. For Eulers method with h = 0.1,
y
i+1
= y
i
+ hf(t
i
, y
i
) = y
i
+ 0.2t
i
y
i
t
0
= 1, y
0
= y(1) = 1
t
1
= 1.1, y
1
= 1 + 0.2 1 1 = 1.2
t
2
= 1.2, y
2
= 1.2 + 0.2 1.1 1.2 = 1.464 y(1.2) 1.464
(b) For the Modied Eulers method with h = 0.1,
y
i+1
= y
i
+ hf(t
i
, y
i
) = y
i
+ 0.2t
i
y
i
y
i+1
= y
i
+
1
2
h(f(t
i
, y
i
) + f(t
i+1
, y
i+1
)) = y
i
+ 0.1t
i
y
i
+ 0.1t
i+1
y
i+1
t
0
= 1, y
0
= y(1) = 1
t
1
= 1.1, y
1
= 1 + 0.2 1 1 = 1.2
y
1
= 1 + 0.1 1 1 + 0.1 1.1 1.2 = 1.232
t
2
= 1.2, y
2
= 1.232 + 0.2 1.1 1.232 = 1.50304
y
2
= 1.232 + 0.1 1.1 1.232 + 0.1 1.2 1.50304 = 1.54788
y(1.2) 1.54788
(c) For the 4
th
order Runge-Kutta Method with h = 0.1,
k
1
= hf(t
i
, y
i
) = 0.2t
i
y
i
k
2
= hf(t
i
+ h/2, y
i
+ k
1
/2) = 0.2(t
i
+ 0.05)(y
i
+ 0.5k
1
)
k
3
= hf(t
i
+ h/2, y
i
+ k
2
/2) = 0.2(t
i
+ 0.05)(y
i
+ 0.5k
2
)
k
4
= hf(t
i+1
, y
i
+ k
3
) = 0.2t
i+1
(y
i
+ k
3
)
y
i+1
= y
i
+
1
6
(k
1
+ 2k
2
+ 2k
3
+ k
4
)
t
0
= 1, y
0
= y(1) = 1
t
1
= 1.1, k
1
= 0.2 1 1 = 0.2
k
2
= 0.2 1.05 (1 + 0.5 0.2) = 0.231
k
3
= 0.2 1.05 (1 + 0.5 0.231) = 0.234255
Page 11
k
4
= 0.2 1.1 (1 + 0.234255) = 0.271536
y
1
= 1 +
1
6
(0.2 + 2 0.231 + 2 0.234255 + 0.271536) = 1.23367
t
2
= 1.2, k
1
= 0.2 1.1 1.23162 = 0.271408
k
2
= 0.2 1.15 (1.23367 + 0.5 0.271408) = 0.314957
k
3
= 0.2 1.15 (1.23367 + 0.5 0.314957) = 0.319965
k
4
= 0.2 1.2 (1.23367 + 0.319965) = 0.372873
y
2
= 1.23367+
1
6
(0.271408+20.314957+20.319965+0.372873) = 1.55270
y(1.2) 1.55270
Question 18
Given y

= sin(ty) and y(0) = 1 estimate y(0.2) using the Midpoint Method with
stepsize h = 0.2 and h = 0.1.
Writing M(h) for the estimate of y(0.2) with stepsize h, use Richardsons extrapola-
tion i.e. compute
4M(h/2) M(h)
3
to get a better estimate.
Solution:
For the Midpoint method with h = 0.2,
y
i+
1
2
= y
i
+
1
2
hf(t
i
, y
i
) = y
i
+ 0.1 sin(t
i
y
i
)
y
i+1
= y
i
+ hf
_
t
i+
1
2
, y
i+
1
2
_
= y
i
+ 0.2 sin
_
t
i+
1
2
y
i+
1
2
_
t
0
= 0, y
0
= y(0) = 1
t1
2
= 0.1, y1
2
= 1 + 0.1 sin(0 1) = 1
t
1
= 0.2, y
1
= 1 + 0.2 sin(0.1 1) = 1.01997 y(0.2) M(0.2) = 1.01997
For the Midpoint method with h = 0.1,
y
i+
1
2
= y
i
+
1
2
hf(t
i
, y
i
) = y
i
+ 0.05 sin(t
i
y
i
)
y
i+1
= y
i
+ hf
_
t
i+
1
2
, y
i+
1
2
_
= y
i
+ 0.1 sin
_
t
i+
1
2
y
i+
1
2
_
t
0
= 0, y
0
= y(0) = 1
t1
2
= 0.05, y1
2
= 1 + 0.05 sin(0 1) = 1
t
1
= 0.1, y
1
= 1 + 0.1 sin(0.05 1) = 1.00500
t3
2
= 0.15, y3
2
= 1.00500 + 0.05 sin(0.1 1.00500) = 1.01001
t
2
= 0.2, y
2
= 1.00500 + 0.1 sin(0.15 1.01001) = 1.02009
y(0.2) M(0.1) = 1.02009
Page 12
Applying Richardsons Extrapolation, a better estimate is
y(0.2)
4M(0.1) M(0.2)
3
= 1.02013
Question 19
Use the Modied Euler Method with steplength 0.1 to estimate y(0.2), given that
dy
dt
= sin(y
2
) and y(0) = 1.
Keep 5 decimal places in your calculations.
Solution:
For the Modied Eulers method with h = 0.1,
y
i+1
= y
i
+ hf(t
i
, y
i
) = y
i
+ 0.1 sin(y
2
i
)
y
i+1
= y
i
+
1
2
h(f(t
i
, y
i
) + f(t
i+1
, y
i+1
)) = y
i
+ 0.05 sin(y
2
i
) + 0.05 sin( y
2
i+1
)
t
0
= 0, y
0
= y(0) = 1
t
1
= 0.1, y
1
= 1 + 0.1 sin(1
2
) = 1.08415
y
1
= 1 + 0.05 sin(1
2
) + 0.05 sin(1.08415
2
) = 1.04669
t
2
= 0.2, y
2
= 1.04669 + 0.1 sin(1.04669
2
) = 1.13561
y
2
= 1.04669 + 0.05 sin(1.04669
2
) + 0.05 sin(1.13561
2
) = 1.13898
y(0.2) 1.13898
Question 20
Given the system of 1
st
order equations
x

= 2tx + 3y
2
x(0) = 1
y

= 3x
2
(1 y) y(0) = 2
use Eulers Method with stepsize h = 0.1 to compute approximations for x(t) and
y(t) at time t = 0.1 and 0.2.
Question 21
Write y

= ty as a pair of equations of 1
st
order. Hence apply Eulers Method with
stepsizes h = 0.1 and h = 0.05 to estimate y(0.2) given that y(0) = y

(0) = 1.
Question 22
Consider the equation for a simple harmonic oscillator i.e.
y

= y, y(0) = 0, y

(0) = 1
Find an estimate for y(0.4) by writing the equation as a system and then applying
the Modied Euler Method with stepsize h = 0.2.
Solve the equation exactly and compare your estimate with the actual value.
Page 13
Question 23
Repeat the previous question using the 4
th
order Runge-Kutta Method with a single
step of stepsize h = 0.4.
Question 24
Consider a driven simple harmonic oscillator equation
y

= 4y 2y

+ sin(t), y(0) = 0, y

(0) = 1
Estimate y(0.4) by applying the Euler Method with stepsize h = 0.2.
Page 14

You might also like