evaluate
Evaluates a parser value immediately, optionally with substitutions.
evaluate(value) invokes the value's existing evaluation behavior from Nerdamer Scripting.
The two-argument form accepts a Dictionary whose entries are substitutions for that evaluation only. They do not create or replace parser assignments, and they can be applied to expressions and supported structured values including SolutionSet results.
The three-argument form accepts a variable Vector and a same-length point Vector, which is useful for repeated numerical evaluation without rebuilding substitution dictionaries.
Examples
These examples use Nerdamer Scripting.
Evaluate a numerical expression immediately.
evaluate(sin(2))
// → 0.9092974268256816954Evaluate a structured value with Dictionary substitutions.
evaluate([x+y,x*y],{x=>2,y=>3})
// → [5, 6]Store a periodic SolutionSet with : and evaluate one indexed family member by supplying the reserved _n index locally.
sol: solve(sin(x),x); evaluate(sol,{_n=>0})
// → {0}Evaluate from parallel variable and point Vectors.
evaluate([u+v,u*v],[u,v],[2,3])
// → [5, 6]Interfaces
The same operation is available through the interfaces below.
Nerdamer Scripting
Use this form in Nerdamer Scripting input passed to nerdamer(...).
evaluate(value[, substitutions]) | evaluate(value, variables, point)
Parameters
value— Expression, equation, or structured parser value to evaluate.substitutions— Optional Dictionary mapping variable names to substitution values.variables— Variable Vector used with point in the three-argument form.point— Value Vector corresponding positionally to variables.
Notes
- If evaluation cannot complete, evaluate returns the resolved input unchanged rather than creating a symbolic evaluate(...) node.
- Dictionary substitutions are local to the evaluate call. Supplying {_n=>0} does not assign _n globally; _n remains a reserved solver-family index and _n:0 is still rejected.
- When a value must be stored before evaluation, use Nerdamer Scripting assignment with :. The = operator denotes an equation and does not store a parser value.
