dynamic evaluate(EvaluationType type, ContextModel context)

Evaluates this expression according to given type and context.

Source

evaluate(EvaluationType type, ContextModel context) {
  var expEval = exp.evaluate(type, context);

  if (type == EvaluationType.REAL) {
    // Expect exponent to be real number.
    return Math.exp(expEval);
  }

  if (type == EvaluationType.INTERVAL) {
    // Special case of a^[x, y] = [a^x, a^y] for a > 1 (with a = e)
    // Expect exponent to be interval.
    return new Interval(Math.exp(expEval.min), Math.exp(expEval.max));
  }

  throw new UnimplementedError('Can not evaluate exp on ${type} yet.');
}