Agentic Coding · Workshop · Numerical computing

Property-Based Testing for Numerical Code: A Workshop on Invariants, Tolerances and Coding Agents

Test numerical functions not on three examples but on thousands of random inputs, with properties that must hold mathematically and tolerances that fit the problem.

  • Workshops & trainings since 2014
  • jocapps GmbH · Freiburg, Germany
  • The team behind Mathe-VollLogo
Format
Workshop
Duration
1 day (7.5 hours)
Delivery
Live online · On-site (in-house) · Hybrid
Group size
4–12 participants
Level
Advanced
Language
German or English

Tools: Claude Code · Python · Hypothesis · pytest · NumPy

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

  1. 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.
  2. 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.
  3. 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.

Request dates

What the numerical testing workshop covers

  1. Why example tests are not enoughWhere numerical code typically breaks and why agents often test only the smooth case.
  2. Finding propertiesInverses, symmetries, conserved quantities, monotonicity and comparison with simple reference implementations.
  3. Hypothesis for numbersStrategies for floats and arrays, handling NaN, infinity and subnormal numbers, and shrinking to minimal counterexamples.
  4. Tolerances with reasonsRelative, absolute or in ULPs: how conditioning and algorithm determine a sensible tolerance.
  5. Metamorphic and convergence testsScaling relations and the method of manufactured solutions for checking convergence order.
  6. 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

How it works

  1. Request with preferred datesTick the date proposals that suit you or name a period of your own.
  2. Short callWe talk about your goals, prior knowledge and the tools your team already uses.
  3. Agenda for your teamYou receive a plan tailored to your group, with exercises that match your subject and material.
  4. Course and materialsThe course runs online, on-site or hybrid, and you keep the materials afterwards.

Why train with us

  • jocapps GmbH has offered workshops and trainings since 2014. The topics have moved with the technology; today the focus is on agentic coding and prompt engineering.
  • Hands-on rather than slides: you practise on realistic examples from maths and STEM, or on your own tasks, code or prompts if you wish.
  • Online, on-site or hybrid, held in German or English.
  • jocapps GmbH is certified to ISO 27001 (information security) and ISO 9001 (quality management).

Questions about the numerical testing workshop

Does this work outside Python?

The principles transfer. Julia, C++, Rust and other languages have their own property-based testing tools. The workshop uses Hypothesis because it suits numerical Python code well; the way of thinking when you look for properties stays the same.

Won't the tests become very slow?

Property-based tests run more cases than example tests. With a limited number of examples in everyday runs, longer runs in nightly CI and small problem sizes, run time stays manageable. Hypothesis stores the counterexamples it finds and replays them on every run.

How can we tell that the agent is writing weak properties?

Warning signs are properties that merely restate the implementation, tolerances that let everything through, or strategies that only generate harmless values. In the workshop you practise exposing such tests, for instance by planting bugs deliberately and checking whether the tests catch them.

Is the workshop held online or on-site, and in which language?

Both are possible: live online, at your premises (in-house) or hybrid. The course is held in German or English; you choose when you send the request.

Can the content be tailored to our team?

Yes. The agenda, examples and emphasis are agreed in the call beforehand, based on your team's prior knowledge, subjects and tools. On request we work with your own exercises, data or code.