-
See Also
- Interpreter
- Restricted
- Failure
- HoldComplete
-
- Interpreter Types
- MathFormula
- InactiveMathFormula
- MathExpression
- Expression
- WolframLanguageSymbol
- HeldMathExpression
- InactiveMathExpression
- HeldExpression
- InactiveExpression
- SemanticExpression
- HeldSemanticExpression
- InactiveSemanticExpression
- ComputedWolframLanguageSymbol
- Related Guides
-
-
See Also
- Interpreter
- Restricted
- Failure
- HoldComplete
-
- Interpreter Types
- MathFormula
- InactiveMathFormula
- MathExpression
- Expression
- WolframLanguageSymbol
- HeldMathExpression
- InactiveMathExpression
- HeldExpression
- InactiveExpression
- SemanticExpression
- HeldSemanticExpression
- InactiveSemanticExpression
- ComputedWolframLanguageSymbol
- Related Guides
-
See Also
"HeldMathFormula" (Interpreter Type)
Details
- "HeldMathFormula" can be used in Interpreter and related constructs, including deployed smart form fields.
- Use of "HeldMathFormula" requires connectivity to the Wolfram Cloud.
- "HeldMathFormula" keeps its result unevaluated by wrapping it in HoldComplete.
Restriction Specifications
-
Restricted["HeldMathFormula",{{choice1,…}}] one among choices Restricted["HeldMathFormula",symbols] a formula involving only the given symbols (All, Automatic, or an explicit list) Restricted["HeldMathFormula",symbols,contexts] a formula involving only the given symbols or symbols in the given contexts (All, Automatic, or an explicit list) Restricted["HeldMathFormula",symbols,contexts,resultcontext] a formula involving only the given symbols or symbols in the given contexts, where the new symbols are created in resultcontext
Interpretation
- "HeldMathFormula" yields a representation of the formula in the Wolfram Language, usually with an Equal, Greater, GreaterEqual, Less, or LessEqual head. The result is wrapped in HoldComplete.
Examples
Basic Examples (7)
Interpret mathematical formulas:
Interpreter["HeldMathFormula"]["sin(x)+1 = 1.5"]Interpreter["HeldMathFormula"]["b^2-4ac < 0"]Find out Wolfram Language representations of natural language queries:
Interpreter["HeldMathFormula"]["limit of 1/x for x->0 = infinity"]No evaluation is attempted when matching the choices:
Interpreter[Restricted["HeldMathFormula", {{True, False}}]]["2=2"]Interpreter[Restricted["HeldMathFormula", {{ HoldComplete[2 == 2] , False}}]]["2=2"]By default, all symbols are allowed. Restrict to a list of allowed symbols:
Interpreter[Restricted["HeldMathFormula", {Greater}]]["x>2"]Interpreter[Restricted["HeldMathFormula", {Greater}]]["log e>2"]By default, new symbols are created in $Context, but a custom context can be specified:
Interpreter[Restricted["HeldMathFormula", All, Automatic, Automatic]]["x = y + 2"]
Context[y]Interpreter[Restricted["HeldMathFormula", All, Automatic, "mycontext`"]]["h = log k"]
Context[h]Specify contexts for the allowed and output symbols:
mycontext`b = 10;
Interpreter[Restricted["HeldMathFormula", Automatic, {"mycontext`", "System`"}, "mycontext`"]]["a = b+c"]
Context[c]Prevent the creation of any new symbol:
Interpreter[Restricted["HeldMathFormula", Automatic, Automatic, None]]["cos(pi) = -1"]Interpreter[Restricted["HeldMathFormula", Automatic, Automatic, None]]["cos(z) = -1"]See Also
Interpreter Restricted Failure HoldComplete
Interpreter Types: MathFormula InactiveMathFormula MathExpression Expression WolframLanguageSymbol HeldMathExpression InactiveMathExpression HeldExpression InactiveExpression SemanticExpression HeldSemanticExpression InactiveSemanticExpression ComputedWolframLanguageSymbol
Related Guides
History
Introduced in 2014 (10.0)