Scripting reference · Nerdamer Language

evaluate

Evaluates a value now, optionally with values for its variables.

With one argument, it evaluates numerically. With a dictionary such as {x=>2}, it uses those values for this call only. With a list of variables and a list of values, it does the same faster when you evaluate many points.

Scripting

evaluate(value[, substitutions]) | evaluate(value, variables, point)

Write it in a script: nerdamer('evaluate(sin(2))'), or in the Playground.

Parameters

value
An expression, equation, vector, matrix, set or solution set.
substitutions
Optional. A dictionary of values, such as {x=>2}.
variables
In the three-argument form: a vector of variables.
point
In the three-argument form: a vector of their values, in the same order.

Examples

A decimal value.

evaluate(sin(2))
// → 0.9092974268256816954
Open in Playground

Values for this call, on a vector.

evaluate([x+y,x*y],{x=>2,y=>3})
// → [5, 6]
Open in Playground

Pick one solution from a periodic family by giving _n a value.

sol: solve(sin(x),x); evaluate(sol,{_n=>0})
// → {0}
Open in Playground

Variables and values as two lists.

evaluate([u+v,u*v],[u,v],[2,3])
// → [5, 6]
Open in Playground

Good to know

  • The values apply to this call only. They don't assign the variables, so {_n=>0} works even though _n:0 is an error.
  • If it can't evaluate further, evaluate returns its input unchanged.
  • To store a value first, assign it with :; = makes an equation.

← Back to Nerdamer Scripting