[SciPy-Dev] Code review for trapz update

Alan G Isaac alan.isaac at gmail.com
Tue Mar 10 12:00:03 EDT 2015


On 3/10/2015 10:50 AM, fizyxnrd wrote:
> If y(x) > 0, then the area bounded by [a, b] between y(x) and
> x=0 should always be positive.


That claim is what you have to justify. This is not true mathematically:
as I noted, it is a **core** property of integrals that
$\int_a^b  f(x) dx = - \int_b^a  f(x) dx$
So the sign of the integral *should* change if you reverse the sequences.
That is how integration works.

So, why do you want to break the usual mathematical relationship?
That seems like a terrible idea.

Non-monotonic sequences are also currently handled correctly,
from a mathematical perspective.  This is because (mathematically)
integration is sub-interval additive.  I admit it is hard to
imagine a user making use of this feature, but it is a feature
and not a bug.

Alan Isaac




More information about the SciPy-Dev mailing list