On Wed, May 10, 2023 at 6:46 AM Pong <wypon...@gmail.com> wrote:
>
> Thanks for the investigation.
>
> I dig around a little and find another simple, and I would say even more 
> troubling, example:
>
> https://groups.google.com/g/sage-support/c/UIbQuoKLdKY/m/nYfF8UtHAgAJ
>
> Essential, the integral of a positive continuous function on a closed bounded 
> interval
>
> integral(sqrt(cos(x)-cos(x)^3),x,0,pi/2)
>
> returns a negative number, in this case -2/3.
>
> Somehow SAGE chooses the negative root. Integrate the absolute value of the 
> integrand produces another error.
> The command still returns a negative number even one slims down the interval 
> a bit.
>
> I will go ahead a file a bug report.

more Maxima bugs, yes.

> --Pong
>
>
> On Monday, May 1, 2023 at 7:29:32 AM UTC-7 Emmanuel Briand wrote:
>>
>> This is not an answer but I have tried to reproduce this bug with a simpler 
>> example and I obtained this:
>>
>> u(x) = sqrt((1-tan(x)^2))
>> f(x) = pi/2-arccos(u(x));
>> r(x) = f(x)*cos(x)
>> integral(r(x), (x, 0, pi/4))
>>
>> 1.11072073453959
>>
>> But
>>
>>
>> numerical_integral(r(x), 0, pi/4)
>>
>> (0.785398166410623, 6.110348980000323e-07)
>>
>> (Again an error of a factor sqrt(2)).
>>
>>
>> Strangely if you change f(x) into simply arccos(x) instead of 
>> pi/2-arccos(x), a test seems to be peformed.
>> A warning is issued  and no answer is given (the output after the warning is 
>> again
>> integrate(arccos(sqrt(-tan(x)^2 + 1))*cos(x), x, 0, 1/4*pi)
>> )
>>
>> u(x) = sqrt((1-tan(x)^2))
>> f(x) = arccos(u(x));
>> r(x) = f(x)*cos(x)
>> integral(r(x), (x, 0, pi/4))
>>
>> Warning, integration of abs or sign assumes constant sign by intervals 
>> (correct if the argument is real):
>> Check [abs(t_nostep)]
>> Warning, integration of abs or sign assumes constant sign by intervals 
>> (correct if the argument is real):
>> Check [abs(t_nostep^2-1)]
>> Warning, integration of abs or sign assumes constant sign by intervals 
>> (correct if the argument is real):
>> Check [abs(t_nostep^2-1)]
>> Warning, choosing root of 
>> [1,0,%%%{4,[2,4]%%%}+%%%{-6,[2,2]%%%}+%%%{2,[2,0]%%%}+%%%{-6,[0,4]%%%}+%%%{10,[0,2]%%%}+%%%{-4,[0,0]%%%},0,%%%{4,[4,8]%%%}+%%%{-12,[4,6]%%%}+%%%{13,[4,4]%%%}+%%%{-6,[4,2]%%%}+%%%{1,[4,0]%%%}+%%%{4,[2,8]%%%}+%%%{-10,[2,6]%%%}+%%%{8,[2,4]%%%}+%%%{-2,[2,2]%%%}+%%%{1,[0,8]%%%}+%%%{-2,[0,6]%%%}+%%%{1,[0,4]%%%}]
>>  at parameters values [49,-6]
>> Warning, choosing root of 
>> [1,0,%%%{4,[2,4]%%%}+%%%{-6,[2,2]%%%}+%%%{2,[2,0]%%%}+%%%{-6,[0,4]%%%}+%%%{10,[0,2]%%%}+%%%{-4,[0,0]%%%},0,%%%{4,[4,8]%%%}+%%%{-12,[4,6]%%%}+%%%{13,[4,4]%%%}+%%%{-6,[4,2]%%%}+%%%{1,[4,0]%%%}+%%%{4,[2,8]%%%}+%%%{-10,[2,6]%%%}+%%%{8,[2,4]%%%}+%%%{-2,[2,2]%%%}+%%%{1,[0,8]%%%}+%%%{-2,[0,6]%%%}+%%%{1,[0,4]%%%}]
>>  at parameters values [0,81]
>> Discontinuities at zeroes of t_nostep^2-1 were not checked
>> Discontinuities at zeroes of t_nostep^2-1 were not checked
>> Warning, integration of abs or sign assumes constant sign by intervals 
>> (correct if the argument is real):
>> Check [abs(t_nostep)]
>> Error while checking exact value with approximate value, returning both!
>>
>> integrate(arccos(sqrt(-tan(x)^2 + 1))*cos(x), x, 0, 1/4*pi)
>>
>> Emmanuel
>>
>>
>> El dom, 30 abr 2023 a las 9:35, Pong (<wypo...@gmail.com>) escribió:
>>>
>>> The codes
>>>
>>> x,y = var('x,y');
>>> f(x) = acos(sqrt((1-tan(x)^2)/2));
>>> g(x) = integral(sin(y)^4,(y,f(x),pi-f(x)));
>>> h(x) = sin(x)^2*cos(x)*g(x);
>>> integral(h(x),(x,-pi/4,pi/4)), numerical_integral(h(x),-pi/4,pi/4)
>>>
>>> produce
>>>
>>> (1/16*sqrt(2)*pi, (0.1963495451106892, 9.705160370278192e-07))
>>>
>>> SageMath version: 9.8 on Ubuntu 22.04 (SAGE was complied from source)
>>>
>>> We believe the numerical answer is correct (that should be 
>>> pi/16=0.1963....) since we got that answer by computing the integral in 
>>> another way by hand.
>>>
>>> We were surprised that 'integral' can give us an answer and even more 
>>> surprised by the fact that it is off by a factor of sqrt(2) from the answer 
>>> given by 'numerical_integral'.
>>>
>>> Any insight of what's happening here?
>>>
>>> --Pong
>>>
>>> --
>>> 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+...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/sage-devel/f1b3157d-20b5-4e7f-aa72-8046f84d5183n%40googlegroups.com.
>
> --
> 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/0dbc7e0d-4619-461a-aca1-ec16a2379e72n%40googlegroups.com.

-- 
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/CAAWYfq3ch8zSGG1TvjVKVgRhB3YZ6QvGkM5mMHRMYPbXof5Cpg%40mail.gmail.com.

Reply via email to