0% found this document useful (0 votes)
23 views3 pages

PHY8X08

The document is an exam paper for the Computational Physics course at the University of Johannesburg, featuring a total of 70 marks and a duration of 150 minutes. It includes various questions on topics such as number representation, error analysis, numerical derivatives, and the Variational Monte-Carlo method. Students are instructed to adhere to university examination rules and are provided with a formula sheet for assistance.

Uploaded by

keryntshifhiwa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

PHY8X08

The document is an exam paper for the Computational Physics course at the University of Johannesburg, featuring a total of 70 marks and a duration of 150 minutes. It includes various questions on topics such as number representation, error analysis, numerical derivatives, and the Variational Monte-Carlo method. Students are instructed to adhere to university examination rules and are provided with a formula sheet for assistance.

Uploaded by

keryntshifhiwa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

University of Johannesburg

PHY8X08: Computational Physics


Exam 2022, Paper B

Examiner: Dr. R. Warmbier


Moderator: Prof. Michael Chapwanya (UP)
Time: 150 minutes
Total Marks: 70

Please note:

• This is an individual assessment. University examination rules must be obeyed.

• Read all questions carefully.

• The paper has 3 pages including this cover page.

• In addition you are provided with a formula sheet.

• Check for completeness of the material.

• Hint: The marks for each question scale roughly with the effort required to answer. Avoid
overly long answers.

1/ 3
1. Answer the following short questions. [XX]

(a) Define underflow and overflow in the context of number representation on the computer.
Give an example when these can occur.
Devise an algorithm (list of steps or flowchart) to test for the under- and overflow of a
computer. Present it in such a way, that it can be programmed unambiguously. (4)
(b) Explain the following python snippet and its output. (3)
>>> xt = 1 . e20 ; yt = −1. e20 ; z t = 1 .
>>> ( xt + yt ) + z t
1.0
>>> xt + ( yt + z t )
0.0

(c) Explain the concept of compensated summation. Give an algorithm on how use it. (3)
(d) Describe the idea of finite representation of a function f (x) on a regular grid in an
interval [a, b]. How can we use finite differences to compute derivatives, and why would
we use this approach? (3)
(e) How is the particle number N (t) modelled for decay processes in the limit of small and
large N ? Connect the two expressions mathematically. (3)
Rb Rb
(f) Explain the variance reduction method, defined as a f (x)dx = a [f (x) − g(x)]dx −
Rb
a g(x)dx. What is g(x)? (2)

2. Assume that numbers xc stored on a computer are related to the exact numbers x by xc '
x(1 + εx ). [8]

(a) Define and explain subtractive cancellation in words. (2)


(b) Derive an expression for the error in cc for c = b − a. (2)

(c) For y = x2 − `2 − x, when is the error in y largest and why? (2)
a
(d) Derive an expression for the error in c = b and discuss. (2)
f (x+h)−f (x−h)
3. For the first derivative central difference equation f 0 (x) = h do the following:
[11]

(a) Derive the above equation. (5)


(b) Give the expression for the total error E. Justify or directly derive. (2)
(c) Determine the optimal step size hopt and the corresponding error E(hopt ). (4)

4. The attached programme numerical derivatives.py produces the figure below. [10]

(a) Briefly describe the functionality of the code, including which quantities are plotted.
Use the line numbers printed on the left to refer to specific lines of code. (4)
(b) Give a detailed analysis and interpretation of the figure, including theoretical justifica-
tions of why we see what we see. (6)

2/ 3
5. Derive the condition number for a matrix problem A~x = ~b under the assumption that a
perturbed matrix A + ∆A will yield a perturbed solution vector ~x + ∆~x. [6]
Rx
6. Derive the approximation error of the mid-point version of rectangle rule xii+1 f (x)dx ≈
hf (xi + h2 ). Give expressions for both a single panel and the whole interval [a, b]. [6]

7. The Variational Monte-Carlo method can be used to solve high-dimensional eigenvalue prob-
lems, like an interacting n electron system with the Hamiltonian [11]
n−1 n−1 n−1
~2 X 2 1 X  2 2 2 2 2 2
X
exp −(~rj − ~rk )2 .
 
Ĥ = − ∇j + m ωx [(~rj )x ] + ωy [(~rj )y ] + ωz [(~rj )z ] + g
2m 2
j=0 j=0 j,k=0
j<k

(a) Shortly describe how to use random numbers to evaluate the integral of a function. (2)
(b) Make use of arguments, equations, and the python codes in eloc.py and vmc.py to ex-
plain how Variational Monto Carlo works and how we can use it to find an approximation
for the ground-state solution of Ĥ. 6
(c) The below figures show the results of vmc.py for Ncalc = 1000 on the left and Ncalc =
10000 on the right. Discuss the results. [3]

—END OF PAPER—

3/ 3

You might also like