[SciPy-Dev] Code review for trapz update

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


On 3/10/2015 8:37 AM, fizyxnrd wrote:
> This data should integrate to positive "area", even though the x data is
> decreasing (and we have negative intervals):
> x = [5, 4, 3, 2, 1]
> y = [2, 2, 2, 2, 2]
> (currently, get -8, but should get +8).


I still don't get it.
Why are you claiming the sign is currently wrong?
$\int_{5}^{1}  2 dx  = |_5^1   2x  = 2 - 10  = -8$.
Why would we not want `trapz` to embody the core property
of integrals that $\int_a^b f(x) dx = - \int_b^a f(x) dx$?

Alan Isaac



More information about the SciPy-Dev mailing list