evaluate method

  1. @override
dynamic evaluate(
  1. EvaluationType type,
  2. ContextModel context
)
override

Evaluates this expression according to given type and context.

Implementation

@override
dynamic evaluate(EvaluationType type, ContextModel context) {
  final dynamic 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 Interval(math.exp(expEval.min), math.exp(expEval.max));
  }

  throw UnimplementedError('Can not evaluate $name on $type yet.');
}