Example

Calculators / Generated Why explanations

Calculators with Why buttons

A calculator for your own question is only useful if you can check how it got its answer, and an explanation written by hand goes out of date every time the model changes.

Here you write the formulas, controls, and labels in Bosatsu, a typed functional programming language. We generate the page from that program, and the structure of its compiled calculation also supplies the Why view; running it fills in the current values. The same program analysis is behind the site’s other tools.

Code & run Read and edit the model and graph configuration

Small programs you can adapt

What would you calculate?

Start with a question, write the arithmetic, and choose the controls. These examples use the same generator as the market model. Each source drawer contains both files and a browser compiler.

Event budget ↗

Ticket income, event costs, and the amount left over. Change attendance or adapt the cost rules.

Try it: Add a booking fee or change the cost per guest.

Code & run Read, edit, and compile this calculator

Rainwater tank ↗

How much water does one rainfall event collect, and how much overflows the tank?

Try it: Try a different roof size or tank capacity.

Code & run Read, edit, and compile this calculator

Battery runtime ↗

Estimate runtime from a battery energy budget, a constant load, and a usable-capacity assumption.

Try it: Compare the same battery powering different devices.

Code & run Read, edit, and compile this calculator

Scale a recipe ↗

Scale ingredient weights to a different number of servings. Replace the ingredients with your own.

Try it: Replace these ingredient weights with your recipe.

Code & run Read, edit, and compile this calculator

Download time ↗

Convert file size and connection speed into transfer time, allowing for a chosen efficiency.

Try it: Compare a faster connection with a smaller file.

Code & run Read, edit, and compile this calculator

Make a calculator: change the event budget, step by step →

Supply, demand, and a per-unit taxThe market model’s rendered curves, intersections, and shaded areas.Deadweight loss Why?

Start with the market calculator

It models demand, supply, and a per-unit tax using three straight lines.

  1. Move the Per-unit tax slider.
  2. Select Deadweight loss Why? above the graph.
  3. Follow a dependency to see how the area was calculated.

The graph configuration declares its intersections and shaded areas. Yichus analyzes those calculations to build the dependency links in Why. The author does not write a separate explanation for each point or region.

Available models

These are illustrative Bosatsu models, not forecasts or policy recommendations. Each page runs its actual compiled program. Graph marks and regions have Why controls; scalar results have Why buttons. What-If controls recompute the model.

Calculators with numeric results

These models cover loan payments, compound investment growth, a flat tax rate, and an illustrative carbon footprint. Their output cards use scalar Why buttons. The loan calculator shows the scalar derivation and What-If workflow on a fixed-rate model.

The archive lists earlier UI runtime fixtures.

Where this fits

What this is about: Trace a result to its inputs