labs / lab-c-mathematics--propositions-and-truth-values
Next task →
Practical Labs/Lab: Propositions and truth values
Level 1 · mathematics

Lab: Propositions and truth values

Build a minimal, verifiable implementation that demonstrates Propositions and truth values. Connect the code to the governing equation, inspect its output numerically, and explain one failure case.

Mathematical basis

For Propositions and truth values, write the defining identity and prove the bound ∣f(x)−f(a)∣<ε|f(x)-f(a)|<\varepsilon whenever ∣x−a∣<δ|x-a|<\delta.

Instructions

  1. 01Read section 7 of the Propositions and truth values learning page and write its governing equation on paper.
  2. 02Implement the core operation in SymPy/NumPy on synthetic matrices and scalar functions. Do not call a library function that solves the whole task.
  3. 03Verify the implementation on a hand-computed three-element or 3×3 example before scaling up.
  4. 04Run the experiment with the tolerance ε and record maximum residual.
  5. 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 Propositions and truth values."""
    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)