Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
PHYS3888
How to do this exam
You may use any existing resource to solve the problems in this paper, including the lecture
notes, code you’ve already written, Matlab documentation (e.g., use doc if you are unsure of
syntax), and Google searches.
However, during the period in which this exam is active, YOU MAY NOT have any
communication with any other person about any aspect of it.
Make sure that you have downloaded the code and data that accompanies this exam.
Note that the difficulty of questions is unevenly distributed through the paper. It can be a good
strategy to skip questions you are initially stuck on.
Please leave yourself plenty of time (approximately 1 hour) to upload a pdf containing all of
your answers. You may use a mix of scanned images of pen-and-paper work and any typeset
results, or images.
You are encouraged to provide code where relevant (e.g., which can allow for partial marks to be
awarded when final results are incorrect). To aid readability, please present code in a fixed-width
font (e.g., like Monaco).
You have a total of 24 hours, so do not risk missing the deadline due to scanning/upload issues.
Statement of individual contribution
[Statement] (×0 multiplier on final score if incomplete)
To have a valid exam, you must accurately complete this question:
Copy out and sign the following statement: “The results submitted in this exam are my own
work only. I had no communication with any other person about any aspect of it.”
Setting
We are in Mordor: a land of orcs, ogres, and desolate evil. And yet, amidst the moral devastation,
there is one shining light: interdisciplinary physics.
1
Part A: Nazgul (25 marks)
Nazgul fly about Mordor, searching the land below for The One Ring.
We have obtained a dataset of their flight pattern, which you can load in as:
load('examData.mat','nazgulFlight');
The variable, nazgulFlight, contains x- and y- coordinates (columns 1 and 2, respectively)
corresponding to the set of locations that the Nazgul visited. Coordinates are measured in
kilometers, with Mount Doom at the origin. Locations were visited in the order presented down
the rows (e.g., the first location is the first row of nazgulFlight, the second location the second
row, etc.).
A1: Birds-eye view (5 marks)
[A1.1] (1 mark)
What are the (x, y) coordinates of the first location the Nazgul visited?
[A1.2] (1 mark)
How many other locations did the Nazgul subsequently visit?
[A1.3] (1 mark)
Run:
A = nazgulFlight(1:100,:);
State what the rows and columns of A correspond to.
[A1.4] (2 marks)
Plot the trajectory of Nazgul flight for the first 100 locations visited. Plot each location as its x
and y coordinates. Use a marker to denote locations and use lines to join consecutively visited
locations. Provide your plot.
A2: Power-laws in Nazgul flight (12 marks)
Compute a set of distances, dist, using the computeDistances function provided:
dist = computeDistances(nazgulFlight);
2
[A2.1] (2 marks)
By reading the lines of code in computeDistances, identify what information is stored in dist.
If N locations were visited, state why dist will be a vector of length N − 1.
[A2.2] (1 mark)
Notice the calculation sqrt(sum((y - x).ˆ2)) in computeDistances.m. Write down this
calculation in the form of a mathematical equation: d(x, y) = . . ..
[A2.3] (3 marks)
Using the function provided, binLogLog.m, plot the distribution of dist on logarithmic axes
with 10 bins.
[A2.4] (1 mark)
What feature of your plot indicates that the distances, dist, follow a power-law distribution,
p(x) ∝ x−γ?
[A2.5] (2 marks)
From the logarithmic binning above, estimate the power-law exponent, γ, to two significant
figures. Provide your code with your result.
[A2.6] (3 marks)
Speculate briefly on the scale-free distribution of distances in the context of Nazgul flight:
1. Explain qualitatively what the trajectory of Nazgul flight would look like if the distribution
of dist instead had a characteristic scale (was a unimodal distribution).
2. Speculate about a possible advantage of the scale-free distribution of dist for the Nazgul
to search for The One Ring.
A3: Nazgul are sooo random (8 marks)
In this section we aim to assess the structure of Nazgul flight patterns by comparing the distances,
dist, to those computed from random flights between the same set of locations.
Randomize the ordering of the locations visited as nazgulRand:
rng('default');
N = size(nazgulFlight,1);
nazgulRand = nazgulFlight(randperm(N),:);
[A3.1] (4 marks)
Use computeDistances to compute distances between the randomized locations, nazgulRand,
storing your result in the variable, distRand.
Plot the probability distribution of distRand as a histogram on linear axes, and again on
logarithmic axes.
Explain any relevant features of your plot, focusing on any important differences from the
power-law distribution of dist.
Use your results to assess whether the flight data in nazgulFlight are consistent with random
flights between the same set of locations.
[A3.2] (4 marks)
3
We can further investigate non-random structure in Nazgul flight by analyzing the angular
dependence of successive flight directions. Recall that for a random walk, the direction flown to
next location (from location xi → xi+1) is independent of any prior information, including the
direction from the previous location to the current location (xi−1 → xi).
Extract a vector of angles between successive locations in nazgulFlight, as θi (e.g., using the
atan2 function). Produce a scatter plot of θi+1 as a function of θi.
Provide your code and your plot.
Use your plot to assess whether angles between successive locations are independent.
Part B: Hebbian orc antics (21 marks)
The orcs guarding a key tower in Mordor enter 6× 6 binary patterns into the security control
pad shown below.
Recall that the binary Hopfield network sets network weights according to the Hebbian learning
rule,
wij =
N∑
n=1
x
(n)
i x
(n)
j , (1)
for neural states x ∈ {−1, 1} across a set of N memories.
Note that binary patterns across each key in the 6× 6 grid can be coded as a 36-long binary
vector, allowing passcodes to be represented as memories in a Hopfield network containing 36
neurons. Orcs, being quite forgetful, have trouble remembering their codes and rely on such a
Hopfield network to correct any errors in partial memories of their passcodes.
B1: The Hebbian Learning Rule (7 marks)
The Hebbian learning rule gives high positive weights, wij , to pairs of correlated neurons.
[B1.1] (1 mark)
In this context, describe what it means for two neurons to be correlated.
[B1.2] (1 mark)
Identify what it means about a pair of neurons, i and j, if wij < 0.
4
[B1.3] (2 marks)
If the learning rule, Eq. (1), were modified to take an average rather than a sum, as
wij =
1
N
N∑
n=1
x
(n)
i x
(n)
j ,
what effect would it have on the network weights and resulting behavior? Briefly explain your
answer.
[B1.4] (3 marks)
Recall the rule for updating neural states, x ∈ {−1, 1}, as a function of the neuron activation, a:
x(a) = 1 if a ≥ 0 ,
x(a) = −1 if a < 0.
Consider an alternative rule, in which neural states instead take values x ∈ {−1, 2}, and the
update rule is modified changed to (change shown bold):
x(a) = 2 if a ≥ 0 ,
x(a) = −1 if a < 0.
Briefly explain what effect (if any) this change would have on:
1. The computation of correlations, wij , and
2. The network’s dynamics.
B2: Samwise Sabotage (7 marks)
The hobbit, Samwise, watches carefully as the head orc, Murzush, retrieves his passcode. Samwise
notes down Murzush’s correct passcode as x(Murzush)i , with xi ∈ {−1, 1}. Samwise decides to
sabotage the recall device by entering a new memory that will make Murzush’s passcode less
stable in the network. His aim is to input the most deceptive possible memory using the strategy
of neutralizing any correlations that are informative of Murzush’s passcode, x(Murzush)i .
First consider the case where the network weights have been computed, from Eq. (1), using just
a single memory, x(Murzush)i . Samwise thus aims to construct a second memory, x
(Sam)
i , with the
aim of cancelling out the correlation structure of Murzush’s memory. The optimal such memory
would, after computing Eq. (1) across both memories, result in wij = 0 for all i, j.
[B2.1] (2 marks)
A physicist from UNSW suggests that the problem is trivial. To cancel out Murzush’s memory,
you should construct a new memory, x(Sam)i , that is the opposite of Murzush’s memory, as
x
(Sam)
i = −x(Murzush)i . Briefly explain why this would be a poor strategy. Include in your answer
whether any worse strategies exist (and, if so, describe them).
[B2.2] (3 marks)
Consider the first four elements of Murzush’s memory, shown below. The first two neurons are
‘on’ (x1 = 1, x2 = 1), and the next two neurons are ‘off’ (x3 = −1, x4 = −1). All pairwise
products, xixj , are annotated.
5
We can score the quality, Q, of possible states, x(Sam)i , as the number of unique weights, wij ,
i 6= j, for which wij = 0 (computed after both Murzush and Samwise’s memories).
Write down a set of the four states of x(Sam)i (i.e., for i = 1, . . . , 4), for which Q is maximal.
State whether it is possible to completely neutralize the correlations in this four-state system,
and describe whether your results provide some intuition about how the Hopfield network can
robustly store different memories.
[B2.3] (2 marks)
Consider an alternative setting in which, as well as Murzush’s passcode, the network weights were
computed from the passcodes of many other orcs. Samwise has knowledge of: (i) the resulting
weights, wij , computed from all the passcodes; and (ii) Murzush’s passcode.
Relative to having knowledge of just Murzush’s passcode, qualitatively describe how Samwise
could use knowledge of wij from the full set of orc memories to more effectively sabotage
Murzush’s passcode.
B3: The Weight is Over (7 marks)
Samwise sneaks up to the device and extracts the Hebbian weight matrix, computed using Eq.
(1) from the passcodes of many orcs.
Load the data as:
load('examData.mat','weightMatrix')
[B3.1] (2 marks)
Does weightMatrix encode a directed or undirected network? Briefly state why.