dynamic evaluate(EvaluationType type, ContextModel context)

Evaluates this expression according to given type and context.

Source

evaluate(EvaluationType type, ContextModel context) {
  var argEval = arg.evaluate(type, context);

  if (type == EvaluationType.REAL) {
    return Math.sin(argEval);
  }

  if (type == EvaluationType.VECTOR) {
    //TODO Apply function to all vector elements
  }

  if (type == EvaluationType.INTERVAL) {
    // TODO evaluate endpoints and critical points ((1/2 + n) * pi)
    // or just return [-1, 1] if half a period is in the given interval
  }

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