LaTeX
LaTeX is compute-engine's default text input: ce.parse("\\frac{1}{2}"). <notatio-out> takes it via format="latex" (its default); the plotting elements take notatio instead, and read LaTeX only inside a $…$ island.
The same string typesets and parses to MathJSON. (An unevaluated LaTeX input renders but doesn't populate the AST forms yet — add evaluate to box it, or see the parse results below.)
What it parses to
A few inputs and the MathJSON they produce:
| LaTeX | MathJSON |
|---|---|
\frac{1}{2} | ["Rational", 1, 2] |
x^2 + 1 | ["Add", ["Power", "x", 2], 1] |
\sin x | ["Sin", "x"] |
2x | ["Multiply", 2, "x"] |
\sqrt{-1} | ["Sqrt", -1] |
Footguns
- Implicit multiplication is inferred.
2xparses as["Multiply", 2, "x"], andf(x)may parse as multiplication unlessfis a known function — prefer\sin(x),\ln(x)with known heads. \logvs\ln. compute-engine's\logis base-10 (Log),\lnis natural (Ln) — the opposite of Wolfram's convention. See the Ln and Log pages.- Whitespace and grouping.
x^2+1andx^{2}+1parse the same, butx^2+1vsx^{2+1}do not — brace your exponents. - Display vs parse. What you type is parsed; what you see may be canonicalised when boxed (e.g. argument ordering). Use FullForm to check what compute-engine actually built.