"MathExpression" (Interpreter Type)
-
See Also
- Interpreter
- SemanticImport
- Restricted
- Failure
-
- Interpreter Types
- HeldMathExpression
- InactiveMathExpression
- MathFormula
- Expression
- WolframLanguageSymbol
- HeldMathFormula
- InactiveMathFormula
- HeldExpression
- InactiveExpression
- SemanticExpression
- HeldSemanticExpression
- InactiveSemanticExpression
- ComputedWolframLanguageSymbol
- Related Guides
-
-
See Also
- Interpreter
- SemanticImport
- Restricted
- Failure
-
- Interpreter Types
- HeldMathExpression
- InactiveMathExpression
- MathFormula
- Expression
- WolframLanguageSymbol
- HeldMathFormula
- InactiveMathFormula
- HeldExpression
- InactiveExpression
- SemanticExpression
- HeldSemanticExpression
- InactiveSemanticExpression
- ComputedWolframLanguageSymbol
- Related Guides
-
See Also
"MathExpression" (Interpreter Type)
Mathematical expression in natural language.
Details
- "MathExpression" can be used in Interpreter and related constructs, including deployed smart form fields.
- Use of "MathExpression" requires connectivity to the Wolfram Cloud.
Restriction Specifications
-
Restricted["MathExpression",{{choice1,…}}] one among choices Restricted["MathExpression",symbols] an expression involving only the given symbols (All, Automatic, or an explicit list) Restricted["MathExpression",symbols,contexts] an expression involving only the given symbols or symbols in the given contexts (All, Automatic, or an explicit list) Restricted["MathExpression",symbols,contexts,resultcontext] an expression involving only the given symbols or symbols in the given contexts, where the new symbols are created in resultcontext
Interpretation
- "MathExpression" yields a representation of the expression in the Wolfram Language.
Examples
Basic Examples (7)
Interpret mathematical expressions:
Interpreter["MathExpression"]["1.4a+3"]Interpreter["MathExpression"]["d f(x+2)/dx"]Interpreter["MathExpression"]["y = b+3"]Interpreter["MathExpression"]["1+2+3+4+5"]Restrict to a list of choices:
Interpreter[Restricted["MathExpression", {{4, 5}}]]["2+2"]By default, all symbols are allowed. Restrict to a list of allowed symbols:
Interpreter[Restricted["MathExpression", {Plus, Times, Pi}]]["2 pi+2"]Interpreter[Restricted["MathExpression", {Plus, Times, Pi}]]["2 pi^2"]By default, new symbols are created in $Context, but a custom context can be specified:
Interpreter[Restricted["MathExpression", All, Automatic, Automatic]]["y + 2"]
Context[y]Interpreter[Restricted["MathExpression", All, Automatic, "mycontext`"]]["k + 2"]
Context[k]Specify contexts for the allowed and output symbols:
mycontext`b = 10;
Interpreter[Restricted["MathExpression", Automatic, {"mycontext`", "System`"}, "mycontext`"]]["a+b"]
Context[a]Prevent the creation of any new symbol:
Interpreter[Restricted["MathExpression", Automatic, Automatic, None]]["3+1"]Interpreter[Restricted["MathExpression", Automatic, Automatic, None]]["z+1"]See Also
Interpreter SemanticImport Restricted Failure
Interpreter Types: HeldMathExpression InactiveMathExpression MathFormula Expression WolframLanguageSymbol HeldMathFormula InactiveMathFormula HeldExpression InactiveExpression SemanticExpression HeldSemanticExpression InactiveSemanticExpression ComputedWolframLanguageSymbol
Related Guides
History
Introduced in 2014 (10.0)