You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Runtime contract checks are enforced for extension points:
44
+
45
+
-`registerCompilationTarget(name, target)` validates target name format and required `LanguageTarget` methods (`getOperators()`, `getFunctions()`, `createTarget()`, `compile()`).
- This is implemented via object spread: the preset sets a default, then `...options.parse` overwrites it.
121
-
122
-
Note: `simplifyMode: 'trigonometric'` maps to the internal `strategy: 'fu'` (the Fu algorithm for trigonometric simplification, named after Fu, Zhong, and Zeng).
104
+
## Free Functions & Lazy Global Engine
105
+
106
+
Top-level free functions (`parse`, `simplify`, `evaluate`, `N`, `assign`) are exported from `index.ts` via `free-functions.ts`. They are backed by a lazily-instantiated global `ComputeEngine` accessible via `getDefaultEngine()`.
107
+
108
+
-`parse(latex)` — parse a LaTeX string
109
+
-`simplify(latex | expr)` — simplify a LaTeX string or BoxedExpression
110
+
-`evaluate(latex | expr)` — evaluate a LaTeX string or BoxedExpression
111
+
-`N(latex | expr)` — numeric approximation
112
+
-`assign(id, value)` / `assign({...})` — assign values in the global engine
113
+
-`getDefaultEngine()` — access the shared engine instance for configuration
114
+
115
+
The global engine is created on first call to any free function, using a dynamic `require('./index')` inside `getDefaultEngine()` to avoid circular dependency (since `index.ts` re-exports `free-functions.ts`).
0 commit comments