Skip to content

Math tools: the calculator computes with AngouriMath - #44

Open
simonebortolin wants to merge 1 commit into
ccr-f0e25fb4-eczbl3-trianglesfrom
ccr-f0e25fb4-eczbl3-angouri
Open

simonebortolin wants to merge 1 commit into
ccr-f0e25fb4-eczbl3-trianglesfrom
ccr-f0e25fb4-eczbl3-angouri

Conversation

@simonebortolin

Copy link
Copy Markdown
Owner

Stacked on #42. It is a trial of AngouriMath (MIT, 2.6.0). The package goes into the math tools sample only; the core and the editor packages stay without dependencies.

What it does

  • MathReader reads what an equation means from its normalized presentation MathML and builds an expression of AngouriMath. It handles:

    • implicit multiplication (2x);
    • functions applied with U+2061 (sin x, sin²x, sin⁻¹x, log_2 x);
    • fractions, roots, powers;
    • |x|, ⌊x⌋, ⌈x⌉, n!;
    • Σ and Π with their limits;
    • ∫ with or without limits, up to dx or ⅆx (the parser groups the integrand with its differential, so MathReader unpacks that group);
    • d/dx;
    • one =; a trailing = is dropped.

    What it cannot read, it reports with a message.

  • Algebra runs the actions:

    • the value: exact, plus the decimal value when it differs (√2+1/3, then ≈ 1.747546896);
    • Solve, Simplify, Expand, Factor, d/dx and ∫ dx, by a letter you pick.

    The results come back through the LaTeX of AngouriMath, which SharpEquations reads.

  • "Compute" card in the calculator:

    • the value updates as you type;
    • each action shows its result drawn, with a "To the editor" button.

    AngouriMath runs on another thread, with a 10-second timeout.

WebAssembly

It works in the browser: I checked the published site with Playwright, typing in the editor and clicking Solve. The trade-offs:

  • Size: the download (Brotli) grows from 9.6 MB to 13.3 MB, which is +3.6 MB (+37%).
  • Single thread: WebAssembly runs on one thread, so a long computation blocks the interface until it ends, and the timeout cannot fire there.

The alternative is to keep it desktop only, by removing the package reference from the browser project.

Tests

  • AlgebraTests:
    • 29 values;
    • solutions;
    • the result of each action drawn;
    • solving for a chosen letter;
    • the error messages.
  • The window test CalculatorComputes.

Generated by Claude Code

MathReader reads what an equation means from its normalized presentation MathML, as an
expression of AngouriMath: implicit multiplication, functions applied (sin x, sin²x,
log_2 x), fractions, roots, powers, absolute values, factorials, sums, products and
integrals with their limits, d/dx. The calculator shows the value of what is typed as
it is typed (exact and decimal), and solves, simplifies, expands, factors,
differentiates and integrates on a click; the results come back through the LaTeX of
AngouriMath, drawn and ready to go back to the editor.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyVio8afJsGwHW9i5v5HDs
@github-actions

Copy link
Copy Markdown

Pre-release 1.1.0-pr.44.116 is ready: https://github.com/simonebortolin/SharpEquations/releases/tag/pr-44-116-1

NuGet package of 4fe9ead. Updated on every push, deleted when this PR is closed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants