Skip to content

Check 2.8's new LaTeX output against CSharpMath.Evaluation #2484

Description

@Rafael-SOWNet

AGENTS.md (Latexize has a round trip too, and it is enforced in someone else's repository, from #822) asks that new Latexize output be checked against CSharpMath.Evaluation, with a PR there where it cannot read a command this library now prints. 2.8 adds LaTeX output that has not been checked; the check was skipped for the 2.8.0 release and is owed:

node LaTeX PR
product over a set \prod_{x \in S} f #2467
partialderivative(L, q[, n]) \frac{\partial}{\partial q} L, with ^{n} for higher orders #2477
zeta(s), zeta(s, a) \operatorname{\zeta}\left(s\right), \operatorname{\zeta}\left(s, a\right) #2476
beta(a, b) \operatorname{B}\left(a, b\right) #2486
norm(v, p) \left| v \right|_{p} #2486
factorization(n), primefactors(n) 2^{3} \cdot 3^{2} \cdot 5 (reads back as the number by notation, which is expected) #2471
dot, cross on names; matrix-operation nodes as printed since #2455 and #2436

For each: parse into a MathList, evaluate back to an Entity, compare; where CSharpMath lacks a command, a PR there with a test, per AGENTS.md (the standard command wins).

Activity

  1. added this to the 3.0 milestone on Nov 16, 2026
  2. Rafael-SOWNet commented on Nov 17, 2026

    @Rafael-SOWNet
    MemberAuthor

    Checked against CSharpMath with the published 2.8.0 package. For each row: Latexize, then LaTeXParser.MathListFromLaTeX, then Evaluation.Evaluate, then the result compared with the original entity.

    Parsing: every row parses. They are now strict rows of CSharpMath's AngouriMathLatexSweepTests, in verybadcat/CSharpMath#338, which moves CSharpMath to 2.8.0. On 2.8.0, Evaluation passes 968/968, Core 1,584/1,584 and Rendering 1,241/1,241. Two Evaluation rows had to change: they pinned [1, 2]^2 squared entry by entry, which 2.8.0 leaves written.

    Evaluating back: most do not come back.

    input LaTeX evaluated back by CSharpMath
    product(1 - 1/p^2, p in {2, 3, 5}) \prod_{p \in \left\{ 2, 3, 5 \right\}} … error: unsupported ∏
    partialderivative(L, q), (L, q, 2) \frac{\partial}{\partial q}L, \frac{\partial^{2}}{\partial q^{2}}L error: unsupported 𝜕
    zeta(s), zeta(s, a) \operatorname{\zeta}\left(s\right) error: unsupported operator ζ
    beta(a, b) \operatorname{B}\left(a, b\right) error: unsupported operator B
    norm(v, p) \left| v \right|_{p} error: unrecognised bracket pair ‖ ‖
    primefactors(360) \operatorname{primefactors}\left(360\right) error: unsupported operator
    det(A) \det\left(A\right) error: unsupported operator det
    trace(A) \operatorname{tr}\left(A\right) error: unsupported operator tr
    A[1, 2] {A}_{1,2} error: , in a subscript
    factorization(360) 2^{3} \cdot 3^{2} \cdot 5 2^3 * 3^2 * 5, the number, as expected
    dot(a, b) a \cdot b a * b
    cross(a, b) a \times b a * b
    transpose(A) {A}^{\mathrm{T}} A ^ T, a power of a variable T
    gradient(f, [x, y]) a bmatrix of derivatives equal

    Nodes from before 2.8 fare the same, so this gap is in CSharpMath's evaluator and 2.8 did not open it:

    • \sum, max, gcd, \lfloor x \rfloor and set-builder { x : x > 0 } are all evaluation errors.
    • binomial(n, k) comes back as n / k.
    • gamma, derivative, integral, limit, matrices, piecewise, provided, mod, phi and the logic come back equal.

    The silent misreadings are the worse half:

    • binomial(n, k) comes back as n / k.
    • transpose(A) comes back as A ^ T.
    • dot and cross come back as products. A product of two vectors is written, not computed, since 2.8, so this one is at least not a wrong value.

    Owed on the CSharpMath side, where each is evaluator work:

    • ^{\mathrm{T}} read as the transpose, and \binom as the binomial.
    • \prod, \partial, \det, \operatorname{tr}, \zeta and B as functions, \| \| as the norm, and A_{1,2} as an entry.

    I'm keeping this open for those.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions