Test 3
Test 3
Test 3
[ PHYS4017 ]
Numerical Methods
Explain how this method can be used to find the maximum of a unimodal
function f (x) on an interval [a, b]. [4]
(b) Consider the function f (x) = 2x3 − 9x2 + 12x on the interval [0, 2]. Apply
two iterations of the golden section method to find a smaller interval where
the maximum of that function lies. [4]
4 1 0 0 1 1/6
Imagine you are integrating a quantity u with respect to time. u has the
value un at timepoint n. Its derivative at time tn can be computed as f (tn , un ).
With the help of the Butcher tableau, write out the equations used by the RK4
method to determine the value un+1 (i.e. at time tn + h). [4]
Hence, calculate the relative error. (The exact result is π/4 .) [4]
(c) How many points should you take to calculate the same integral with the
trapezium rule to a precision of 10−5 ? [6]
(d) What other numerical integration method would you choose to compute
this integral? You should carefully justify your answer by explaining why your
chosen method would be better than the trapezium rule and considering all
relevant aspects of numerical methods discussed in class. [5]
(e) Calculate the integral from part (b) by hand, using the method you have
introduced in part (d). How do your two results compare? [5]
(b) Define the truncation error, and write down its value for the one-sided
difference method. [2]
(d) Show that for an input variable fractional accuracy of 10−16 , the one-sided
difference method can be used to estimate the derivative of a function with a
fractional accuracy of approximately 10−8 .
p
You may assume the characteristic scale of the function, xc = |f (x)/f 00 (x)|,
is approximately equal to 1. [4]
2
du
(e) A diffusion equation of the form dt = D ddxu2 can be solved using a forward-
time-centred-space (FTCS) scheme:
un+1
j − unj unj+1 − 2unj + unj−1
=D .
∆t ∆x2
(f) Another strategy for solving this initial-value problem is to use an implicit
method. State how the FTCS equation given in part (e) can be modified
slightly to create an implicit counterpart to the FTCS scheme. Explain why
it is necessary to solve a matrix equation as part of this implicit scheme. [2]
(g) Show that the associated matrix equation can be written in the form:
.
.. ..
. .. .
n+1 n
. . . 0 −α 1 + 2α −α 0 0 0 ... uj−1 uj−1
n+1 n
... 0 0
−α 1 + 2α −α 0 0 ... uj
= u
j
... 0 0 0 −α 1 + 2α −α 0 . . . un+1 un
j+1 j+1
.. .. ..
. . .
[4]
(h) The basic Gaussian elimination algorithm can successfully solve some ma-
trix equations, but not others. Discuss whether the zeros that appear in this
matrix equation would pose a problem for the basic Gaussian elimination al-
gorithm. [2]
(i) If you were to implement the Gaussian elimination algorithm for this spe-
cial case of a N × N tri-diagonal matrix, how many row-elimination operations
would be required? [2]
End of Paper