The consistency problem.
A numerical teaching tool can look convincing while two implementations quietly disagree about interval counts, signed area or invalid functions. IntegraDraw had a Java desktop history and needed a modern browser edition without turning them into unrelated calculators.
The rebuild makes the mathematical contract explicit: exactly the requested number of intervals, signed results, visible approximation error and clear rejection of non-finite inputs.
What both runtimes must agree on.
The interface is useful only when the numerical rules stay stable:
- Midpoint and trapezoidal methods use exactly the segment count entered by the user.
- Negative area remains negative instead of being silently converted to geometric area.
- The comparison value is labelled a Simpson reference, never an exact symbolic result.
- The browser expression parser must not use eval or Function.
A contract above the implementation.
Sharing source code between Java and TypeScript would create an awkward runtime bridge without proving much. Sharing expected behaviour is the more useful boundary.
I introduced a versioned golden corpus consumed by JUnit and Vitest. Runtime-specific tolerances and limits remain explicit, so a mismatch cannot disappear behind a generic loose equality helper.
Two interfaces, one numerical record.
The Java application packages a Swing interface and numerical core in an executable JAR. The web application uses a dependency-free expression parser, TypeScript integration routines and a responsive Canvas plot. Both verify against the shared corpus.
Why the implementations share a contract, not a runtime.
The desktop and web tools stay native to their environments while one corpus defines the behaviour they both promise.
Java and TypeScript keep separate numerical implementations.
- Why
- The executable JAR and browser application can each run independently with their platform’s normal packaging, interface and numerical code.
- What I ruled out
- A runtime bridge or generated shared source would couple both releases and could make the same implementation defect appear as agreement rather than independent evidence.
- What it cost
- Algorithm changes and fixes must be implemented twice, and parity is enforced through tests instead of source reuse.
The browser uses a custom bounded expression parser.
- Why
- A documented grammar can admit x, arithmetic, constants and selected functions while rejecting unsupported syntax before numerical evaluation.
- What I ruled out
- JavaScript eval or Function would accept a broader expression language, but it would also execute arbitrary code in a tool that only needs mathematics.
- What it cost
- The supported language is intentionally smaller, and the project owns tokenization, precedence, validation and useful parse errors.
Canvas renders the responsive browser plot.
- Why
- The workbench controls sampling, axes and curve rendering directly without adding a charting dependency or mapping numerical state into a large set of document nodes.
- What I ruled out
- A chart library would bring its own data and interaction conventions, while an SVG-first plot would require managing many generated elements for each redraw.
- What it cost
- Resizing, labels, high-density rendering and non-visual explanations must be implemented explicitly because Canvas has no semantic structure of its own.
A versioned golden corpus defines cross-runtime behaviour.
- Why
- JUnit and Vitest consume the same cases while retaining explicit Java and TypeScript expected values and tolerances. Reviewers can see exactly where legitimate floating-point differences are allowed.
- What I ruled out
- Sharing the calculation code would guarantee similar outputs but would not independently check that two implementations satisfy the intended numerical contract.
- What it cost
- The corpus is a governed artifact: every supported behavioural change requires reviewed cases, versioning and runtime-specific expectations.
Decisions that improve mathematical clarity.
The workbench labels approximation as approximation.
Preserve signed area
Midpoint, trapezoidal and Simpson calculations retain the sign of the function, so regions below the x-axis subtract from the definite integral instead of being presented as positive geometric area.
The trade-offA user who wants total geometric area must split or transform the problem; preserving the sign keeps the tool faithful to the integral it labels.
Name the reference correctly
The web comparison uses composite Simpson’s rule with 8,192 subintervals and calls it a reference rather than an exact result.
The trade-offSome discontinuous or non-finite functions are rejected; the project is not a symbolic proof system.
Use exactly the requested segment count
Midpoint and trapezoidal estimates calculate and draw exactly the number of subintervals the user entered, including odd counts; the interface does not silently round it to an even value.
The trade-offA small count can produce a visibly rough approximation, but the picture remains an honest rendering of the requested experiment.
Packaging both applications.
CI compiles Java 17, runs JUnit, packages and smoke-tests the executable JAR, then type-checks, tests and builds the TypeScript application. Release candidates also include the web bundle and SBOMs for both runtimes.
Publication compares independent builds, validates dependency inventories and checks SHA-256 manifests and GitHub attestations before making a stable release visible.
What the workbench makes visible.
Users can change a function, interval and segment count, then see how midpoint and trapezoidal estimates relate to the plotted curve and Simpson reference.
The desktop and web applications remain useful independently, while the shared corpus gives maintainers one place to review the numerical behaviour they promise.
Evidence ledger.
The numerical contract is small enough to enumerate:
- Golden corpus
- Six integral cases, three invalid-expression cases and seven validation cases under schema version 1.
- Verification
- 22 JUnit and 80 TypeScript test declarations in the audited release.
- Reference
- The browser’s composite Simpson comparison uses 8,192 subintervals.
- Boundary
- The reference is not exact; discontinuities and non-finite expressions can be rejected, and runtime limits intentionally differ.
Verified release v1.1.2 Verified on
IntegraDraw is an exploratory teaching tool. It does not provide symbolic integration, proof, guaranteed handling of discontinuities or an exact result for arbitrary functions.