mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
[apps] Add a function "sumBetweenBounds()" on Function (sum of terms on
Sequence, Integral on CartesianFunction)
This commit is contained in:
committed by
EmilieNumworks
parent
7ea0dbeb56
commit
cdfbc02499
@@ -26,6 +26,17 @@ double CartesianFunction::approximateDerivative(double x, Poincare::Context * co
|
||||
return derivative.approximateToScalar<double>(*context);
|
||||
}
|
||||
|
||||
double CartesianFunction::sumBetweenBounds(double start, double end, Poincare::Context * context) const {
|
||||
Poincare::Complex<double> x = Poincare::Complex<double>::Float(start);
|
||||
Poincare::Complex<double> y = Poincare::Complex<double>::Float(end);
|
||||
Poincare::Expression * args[3] = {expression(context), &x, &y};
|
||||
Poincare::Integral integral(args, true);
|
||||
/* TODO: when we will simplify integral, we might want to simplify the
|
||||
* integral here. However, we might want to do it once for all x (to avoid
|
||||
* lagging in the derivative table. */
|
||||
return integral.approximateToScalar<double>(*context);
|
||||
}
|
||||
|
||||
char CartesianFunction::symbol() const {
|
||||
return 'x';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user