Skip to main content

4.3b Random-distribution test labs

Source: Lab ideas from Computational Physics (Landau, Páez, Bordeianu), §4.4. Rewritten as original drills. Continues 4.3 Testing random distributions.

Use the chapter LCG only (r ← (1103515245 r + 12345) % 2³¹, then r/2³¹). Stubs fail until filled in. Averages can look fine while a lattice still fails the eye — pair the labs with the explorers at the bottom.

Formula refresh​

Warm up: pick the matching equation among lookalikes (same walk as the theory lesson).

Labs​

Activity: Moment N\sqrt{N} errors

Draw NN uniforms from seed seed. For k=1,3,7k=1,3,7 print

N∣1N∑xik−1k+1∣\displaystyle\sqrt{N}\left|\frac{1}{N}\sum x_i^{k}-\frac{1}{k+1}\right|

with 6 decimals, space-separated on one line.

Input: N seed.

Write-ups​

0/3 solved
4.3b.W1

Using “look”, “scatter”, and “lattice”, explain:

Why is a successive-pair scatterplot still required even if moments look good?

Minimum 3 words. Your answer must include: “look”, “scatter”, “lattice”.

0 words/ 3 min

Meet the writing requirements, then you can open the model answer.

Explorers​

Next: 5.1 Differentiation.