Practical Labs/Lab: Quantifiers
Level 1 · mathematics
Lab: Quantifiers
Build a minimal, verifiable implementation that demonstrates Quantifiers. Connect the code to the governing equation, inspect its output numerically, and explain one failure case.
Mathematical basis
For Quantifiers, write the defining identity and prove the bound whenever .
Instructions
- 01Read section 7 of the Quantifiers learning page and write its governing equation on paper.
- 02Implement the core operation in SymPy/NumPy on synthetic matrices and scalar functions. Do not call a library function that solves the whole task.
- 03Verify the implementation on a hand-computed three-element or 3×3 example before scaling up.
- 04Run the experiment with the tolerance ε and record maximum residual.
- 05Inspect the output, identify one discrepancy with the theory, and write a one-paragraph explanation.
Starter code
import numpy as np
def demonstrate(x, tol=1e-9):
"""Numerical check for Quantifiers."""
x = np.asarray(x, float)
assert x.size > 0
return np.sum(x), np.max(np.abs(x))
s, m = demonstrate([1.0, 2.0, 3.0])
assert abs(s - 6.0) < 1e-12 and m == 3.0
print(s, m)