derive method

  1. @override
Expression derive(
  1. String toVar
)
override

Derives this expression with respect to the given variable.

Implementation

@override
Expression derive(String toVar) {
  MathFunction gDF;
  final Expression gD = g.derive(toVar);

  if ((gD is! MathFunction)) {
    // Build function again..
    gDF = CustomFunction('d${g.name}', g.args, gD);
  } else {
    gDF = gD;
  }

  // Chain rule.
  return CompositeFunction(f, gDF) * f.derive(toVar);
}