Agent-generated numerical code usually passes the example tests the agent wrote for it. Whether it also holds for tiny, huge, negative or nearly singular inputs is something those tests do not reveal. Property-based testing for numerical code turns the approach around: you state properties such as symmetry, conserved quantities, invertibility or scaling behaviour, and Hypothesis searches deliberately for counterexamples. In this workshop you learn to find such properties, choose sensible tolerances and have the agent write tests that genuinely check something.
Who the numerical testing workshop is for
Advanced developers, computing teams and researchers who maintain numerical libraries or simulation code in Python and use coding agents to write both code and tests.
What you'll walk away with
- Identify mathematical properties that make good tests for numerical functions
- Write Hypothesis strategies for floats, arrays and matrices with controlled value ranges
- Choose relative and absolute tolerances with reasons and understand comparisons in ULPs
- Set up metamorphic tests and convergence-order tests with manufactured solutions
- Review agent-written tests for meaningfulness and recognise trivial properties
Typical scenarios
- A team tests its own matrix decomposition with the property that the product of the factors reproduces the original matrix within tolerance, and finds a bug for ill-conditioned inputs.
- A research group checks whether an integrator conserves a pendulum's energy over many steps and discovers that its step-size control is too coarse.
- A library team has the agent refactor interpolation routines and uses metamorphic tests to confirm that shifting and scaling the data carry over correctly to the result.
Does this fit your team?
Pick a few dates that suit you. The request is non-binding, and the agenda is tailored in a short call beforehand.
What the numerical testing workshop covers
- Why example tests are not enoughWhere numerical code typically breaks and why agents often test only the smooth case.
- Finding propertiesInverses, symmetries, conserved quantities, monotonicity and comparison with simple reference implementations.
- Hypothesis for numbersStrategies for floats and arrays, handling NaN, infinity and subnormal numbers, and shrinking to minimal counterexamples.
- Tolerances with reasonsRelative, absolute or in ULPs: how conditioning and algorithm determine a sensible tolerance.
- Metamorphic and convergence testsScaling relations and the method of manufactured solutions for checking convergence order.
- Agents as test writersPrompts and instructions that get the agent to propose properties, which you then judge on their merits.
Before the numerical testing workshop: prerequisites
- Good Python skills and experience with pytest
- Basic numerical analysis, such as floating-point arithmetic and conditioning
- Optionally, numerical functions of your own that you want to test
Materials you keep
- A catalogue of numerical properties with matching Hypothesis strategies
- A guide to choosing tolerances
- A test suite for your own functions or an example module