10.6b PCA labs
Source: Lab ideas from Computational Physics (Landau, Páez, Bordeianu), §10.6. Iris warmup + Smith 2D PCA demo. Continues 10.6.
Explorer
Pure Python. No NumPy.
Iris warmup ()
Use this fixed table (sepal length, sepal width, petal length, petal width):
5.1 3.5 1.4 0.2
4.9 3.0 1.4 0.2
4.7 3.2 1.3 0.2
4.6 3.1 1.5 0.2
5.0 3.6 1.4 0.2
5.4 3.9 1.7 0.4
4.6 3.4 1.4 0.3
5.0 3.4 1.5 0.2
4.4 2.9 1.4 0.2
4.9 3.1 1.5 0.1
5.4 3.7 1.5 0.2
4.8 3.4 1.6 0.2
4.8 3.0 1.4 0.1
4.3 3.0 1.4 0.1
5.8 4.0 1.2 0.2
5.7 4.4 1.5 0.4
5.4 3.9 1.3 0.4
5.1 3.5 1.4 0.3
Formula refresh
Warm up: pick the matching equation among lookalikes (same walk as the theory lesson).
Labs
Activity:
Print the mean of column 0 (sepal length) with 10 decimals. Use .
No input.
Smith 2D PCA demo
Fixed points (Smith / textbook demo):
2.5 2.4
0.5 0.7
2.2 2.9
1.9 2.2
3.1 3.0
2.3 2.7
2.0 1.6
1.0 1.1
1.5 1.6
1.1 0.9
Pipeline: center → → eigenvalues / unit (flip so first component ) → project.
Activity:
Print the mean of the column with 10 decimals.
No input.