public double evaluate(double... values) throws EvaluationException {
for (int i = 0; i < values.length; ++i) {
final String variableName = variableNames[i];
final RValue invokable = variables.get(variableName);
if (!(invokable instanceof Variable)) {
throw new EvaluationException(invokable.getPosition(), "Tried to assign constant " + variableName + ".");
}
((Variable) invokable).value = values[i];
}