Re: [sage-devel] Definite Integral wrong

2020-08-06 Thread rjf
I suppose you could have some function like RPSqrt, for realpositivesqrt which maps from non-negative reals to non-negative reals. It would be an error to type RPSqrt(x) unless x were guaranteed to be oretty much explicitly in [0,oo]. Sqrt(x^2) under some conditions might be considered RPSqrt(

Re: [sage-devel] Definite Integral wrong

2020-08-06 Thread kcrisman
On Thursday, August 6, 2020 at 4:07:11 AM UTC-4 Markus Wageringel wrote: > Even if there are two possible choices, the result of the definite > integral should be ±8, not 0. It is rather strange to pick the positive > square root for half the integral and then (discontinuously) the negative >

Re: [sage-devel] Definite Integral wrong

2020-08-06 Thread Markus Wageringel
Even if there are two possible choices, the result of the definite integral should be ±8, not 0. It is rather strange to pick the positive square root for half the integral and then (discontinuously) the negative one for the other half. There is a ticket for exactly this integral, by the way:

Re: [sage-devel] Definite Integral wrong

2020-08-05 Thread Samuel Lelievre
2020-08-05 18:59:01 UTC, rjf: > > There are two square roots. In this (classic) integration > example/bug, a choice has to be made. You know that 4 has > two square roots, -2 and 2. The integrand, which also can > be rewritten as sqrt ( 4-4*cos(x/2)^2) , has 2 square > roots. Therefore there a

Re: [sage-devel] Definite Integral wrong

2020-08-05 Thread Michael Orlitzky
On 2020-08-05 15:49, NicoJG wrote: > @rjf Isn't the square root defined to be positive? > Sure: x^2=y <=> x=+/-sqrt(y) > But I think you would never consider f(x):=sqrt(x) to have the codomain > of all negative numbers. > At least I would expect a CAS to interpret a square root to be positive. >

Re: [sage-devel] Definite Integral wrong

2020-08-05 Thread Nils Bruin
On Wednesday, August 5, 2020 at 12:49:37 PM UTC-7, NicoJG wrote: > > @rjf Isn't the square root defined to be positive? > Sure: x^2=y <=> x=+/-sqrt(y) > But I think you would never consider f(x):=sqrt(x) to have the codomain of > all negative numbers. > With complex numbers, there's no concept

Re: [sage-devel] Definite Integral wrong

2020-08-05 Thread Dave Morris
I agree with the general analysis, but I think the statement "Any answer that supplies only one answer is wrong." goes too far. It may be the case that sage works inherently in the complex domain, and is unable to understand that elementary calculus and certain other fields want to remain in t

Re: [sage-devel] Definite Integral wrong

2020-08-05 Thread NicoJG
@rjf Isn't the square root defined to be positive? Sure: x^2=y <=> x=+/-sqrt(y) But I think you would never consider f(x):=sqrt(x) to have the codomain of all negative numbers. At least I would expect a CAS to interpret a square root to be positive. rjf schrieb am Mittwoch, 5. August 2020 um 20:

Re: [sage-devel] Definite Integral wrong

2020-08-05 Thread rjf
There are two square roots. In this (classic) integration example/bug, a choice has to be made. You know that 4 has two square roots, -2 and 2. The integrand, which also can be rewritten as sqrt ( 4-4*cos(x/2)^2) , has 2 square roots. Therefore there are two potential different values for t

Re: [sage-devel] Definite Integral wrong

2020-08-04 Thread Emmanuel Charpentier
BTW : sage: integrate(sqrt(2-2*cos(x)),x, algorithm="fricas") -2*(cos(x) + 1)*sqrt(-2*cos(x) + 2)/sin(x) sage: integrate(sqrt(2-2*cos(x)),x, algorithm="mathematica_free") -2*sqrt(-2*cos(x) + 2)*cot(1/2*x) Both are visually (on plot) and numerically correct ; both differentiate to expressions v

[sage-devel] Definite Integral wrong

2020-08-02 Thread Nico Guth
Hi, I discovered a bug, where a definite integral is calculated wrong! WolframAlpha result for comparison. Code: integrate(sqrt(2-2*cos(x)),x,0,2*pi) Also if I type show() instead of print() SageMathCell just doesn't show anything. Also the form in which the indefinite integral is given is not