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 the real domain, but it would not be "wrong" to have a program that 
operates differently.  It is not "wrong" to work in the real domain and 
understand that "\sqrt{2}" means 1.414... (the "principal square root"), 
not -1.414...  Indeed, I think sage would need to be able to do to be 
really useful for most 1st semester calculus students.  In this situation, 
there is a unique correct answer, so returning two answers is "wrong".

On Wednesday, August 5, 2020 at 12:59:01 PM UTC-6, rjf wrote:
>
> 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 the integral.  Any 
> answer
> that supplies only one answer is wrong.
>
>
>
> On Tuesday, August 4, 2020 at 1:56:16 AM UTC-7, Emmanuel Charpentier wrote:
>>
>> 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 very hard to show equal to the original function.
>>
>> HTH,
>>
>> Le lundi 3 août 2020 10:50:12 UTC+2, Dima Pasechnik a écrit :
>>
>> This is a well-known bug in Sage. A workaround is to set the domain to 
>>> "real":
>>>
>>> sage: maxima_calculus.eval('domain: real');
>>> sage: integrate(sqrt(2-2*cos(x)),x,0,2*pi) # correct answer
>>> 8
>>>
>>> sage: maxima_calculus.eval('domain: complex'); # restore the state back
>>> sage: integrate(sqrt(2-2*cos(x)),x,0,2*pi) # now here the result is 
>>> again wrong, of course
>>> 0
>>>
>>>
>>> On Sun, Aug 2, 2020 at 5:26 PM Nico Guth <nico.j...@gmail.com> wrote:
>>>
>>>> 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 very 
>>>> pretty.
>>>> WolframAlpha does a much better job simplifying.
>>>>
>>>> [image: sage_wrong_integral.png][image: 
>>>> sage_wrong_integral_wolfram.png]
>>>> [image: sage_wrong_integral_wolfram_2.png]
>>>>
>>>> -- 
>>>> You received this message because you are subscribed to the Google 
>>>> Groups "sage-devel" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send 
>>>> an email to sage-...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/sage-devel/487d0db8-5711-41a8-a7d4-1548286b5573n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/sage-devel/487d0db8-5711-41a8-a7d4-1548286b5573n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> ​
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/34e4e9bb-cf9a-4276-8c9b-34bb78c0fd6bo%40googlegroups.com.

Reply via email to