Before you run
A successful run ends with surface checks passed. A traceback is a failed assert — a failed claim, not a rounding nuisance. Use this starter only as an output shape; the derivation is yours.
def check():
# 1. define the constants and the constraint
# 2. assert the stated benchmarks
# 3. assert the undefined / boundary case explicitly
print("surface checks passed")
if __name__ == "__main__":
check()
The full worked asserts follow. Type them out; do not paste them.
[MATHEMATICAL] · [MODEL-DEPENDENT] · SURFACE CHECK
Verify the gas manifold yourself
[MATHEMATICAL] No numpy, no plotting library, no hidden state. Copy this into a Python file and run it. Every assertion is a claim you can check.
import math
R = 8.314462618
A = 0.3640
B = 4.267e-5
def ideal(V, T, n=1.0):
P = n * R * T / V
return P, P * V - n * R * T, (V, P, -n * R)
def gaussian_K(V, T, n=1.0):
a = n * R
P = a * T / V
dV = -P / V
dT = a / V
dVV = 2 * a * T / (V ** 3)
dVT = a / (V ** 2)
return (dVV * 0 - dVT ** 2) / ((1 + dV ** 2 + dT ** 2) ** 2)
P, residual, grad = ideal(0.025, 300)
assert abs(P - 99773.5514) < 1e-3
assert abs(residual) < 1e-9
assert all(component != 0 for component in grad)
assert gaussian_K(0.025, 300) < 0
Tc = 8 * A / (27 * R * B)
Pc = A / (27 * B * B)
assert abs(Tc - 304.00) < 0.1
assert abs(Pc / 1e6 - 7.404) < 0.01
def vdw(V, T, n=1.0):
if V <= n * B:
return None
return n * R * T / (V - n * B) - n * n * A / (V * V)
assert vdw(3 * B, Tc) is not None
def slope(V, T, n=1.0):
return -n * R * T / ((V - n * B) ** 2) + 2 * n * n * A / (V ** 3)
assert slope(4 * B, 280) > 0
assert slope(0.005, 340) < 0
print("surface checks passed")
[MATHEMATICAL] The tangent vector d x = (dV,dT,dP) satisfies ∇F · d x = 0 exactly when the step stays on the sheet. Orthogonality is not a visual impression; it is an algebraic test. [MATHEMATICAL] None for V <= nb is ⊥, not a pressure of zero. [MODEL-DEPENDENT] The subcritical middle branch with ∂P/∂V > 0 is BOUNDARY_VIOLATION, not a permissible equilibrium.
Rubric
| Rung | Tier | Pass condition | Failure signature |
|---|---|---|---|
| Observe | Description | Names F = PV − nRT, the positive octant, and the three historical slices. |
Calls the drawn surface the molecule itself. |
| Manipulate | Description → Prediction | Changes T,V,n, confirms residual is machine zero, and switches models without losing the state. |
Moves sliders and reports a story instead of a number. |
| Predict | Prediction | Foresees ∇F ≠ 0 for ideal gas, K < 0, and Tₒ ≈ 304 K for CO₂. |
Predicts a smooth surface below Tₒ or treats V = b as zero pressure. |
| Construct | Explanation | Writes the asserts above and explains the fold as a vanishing gradient, not a plotting error. | Uses a real-experiment claim to certify a model assertion. |