blatantly wrong symbolic integral (via maxima) - bug report

2,486 views
Skip to first unread message

William Stein

unread,
Feb 12, 2015, 3:26:28 PM2/12/15
to sage-support, Rodrigo Sambade Saá
Hi,

In Sage, this gives a totally wrong answer:

sage: f(x) = sqrt(2+sqrt(2+sqrt(2+2*cos(5*sqrt(x)+4))))*x^(-1/2)
sage: integral(f, x)

It takes about 10 seconds, and plotting f.derivative(x) - f makes it
clear the answer is wrong.

I tried sympy, but after several minutes it didn't return a result.

Here's a public worksheet that illustrates things:

https://cloud.sagemath.com/projects/4a5f0542-5873-4eed-a85c-a18c706e8bcd/files/support/2015-02-12-121421-integral.sagews

--
William (http://wstein.org)

R. Andrew Ohana

unread,
Feb 12, 2015, 3:55:40 PM2/12/15
to sage-support, Rodrigo Sambade Saá

It is wrong, but not as wrong as you make it out to be. Your function is f = abs(h), where h = 2*cos(5/8*sqrt(x)+1/2)/sqrt(x). Rather that integrating f, it seems to have integrated h.

William Stein

unread,
Feb 12, 2015, 3:57:12 PM2/12/15
to sage-support, Rodrigo Sambade Saá
Andrew -- very good point! That's not nearly as bad as I made it out.
Thanks,

-- William

>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support...@googlegroups.com.
> To post to this group, send email to sage-s...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.



--
William (http://wstein.org)

Rodrigo Sambade Saá

unread,
Aug 24, 2019, 8:17:48 AM8/24/19
to William Stein, sage-support
Dear William,


Best wishes,

Rodrigo 

Emmanuel Charpentier

unread,
Aug 25, 2019, 10:30:13 AM8/25/19
to sage-support
Indeed. But no need for Mathematica :

sage: f(x)= sqrt(2+sqrt(2+sqrt(2+2*cos(5*sqrt(x)+4))))*x^(-1/2)
sage: h(x)= 2*cos(5/8*sqrt(x)+1/2)/sqrt(x)
sage: P1=plot(f(x),(x,0,120),ymin=-0.5, ymax=0.85)
sage: P2=plot(h(x),(x,0,120),ymin=-0.5, ymax=0.85)
sage: P1+P2

tmp_a7yhgbnu.png


BTW: How did you came to exhume a 4-years old thread ? 


Le samedi 24 août 2019 14:17:48 UTC+2, Rodrigo Sambade Saá a écrit :
Dear William,


Best wishes,

Rodrigo 

El jue., 12 feb. 2015 a las 21:57, William Stein (<wst...@gmail.com>) escribió:
On Thu, Feb 12, 2015 at 12:55 PM, R. Andrew Ohana
<andre...@gmail.com> wrote:
> It is wrong, but not as wrong as you make it out to be. Your function is f =
> abs(h), where h = 2*cos(5/8*sqrt(x)+1/2)/sqrt(x). Rather that integrating f,
> it seems to have integrated h.

Andrew -- very good point!  That's not nearly as bad as I made it out.
  Thanks,

 -- William

>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an

Emmanuel Charpentier

unread,
Aug 25, 2019, 11:31:10 AM8/25/19
to sage-support
BTW, both Fricas and Mathematica give expressions whose derivatives numerically coincide with f(x) on the range (0..120), up to numerical noise. But I haven't been able to prove that those expressions (or their derivatives) are equal, nor than these derivattives are equal to f(x).

HTH,
Message has been deleted

Rodrigo Sambade Saá

unread,
Feb 9, 2022, 2:56:03 PM2/9/22
to William Stein, sage-support

I swear now it's worth reviving this.

A user on Math StackExchange found the steps to integrate the function. Now it's as simple as implementing it in Sage.

Best wishes,

Rodrigo
Let's take care of the environment. Think at least twice before printing this e-mail: The environment is everyone's responsibility.



El mié, 9 feb 2022 a las 20:52, Rodrigo Sambade Saá (<rodrigos...@gmail.com>) escribió:
On Wed, Feb 9 2022 at 20:49, Rodrigo Sambade Saá (<rodrigos...@gmail.com>) wrote:
I swear now it's worth reviving this.

A user on Math StackExchange found the steps to integrate the function. Now it's as simple as implementing it in Sage.

Best wishes,

Rodrigo
Rodrigo Sambade
rodrigos...@gmail.com
Let's take care of the environment. Think at least twice before printing this e-mail: The environment is everyone's responsibility.

El sáb, 24 ago 2019 a las 12:53, Rodrigo Sambade Saá (<rodrigos...@gmail.com>) escribió:
Dear William,

Sorry 🙏, the link is wrong. This is the correct one: |2*cos(5/8*sqrt(x)+1/2)/sqrt(x)| = sqrt(2+sqrt(2+sqrt(2+2*cos(5*sqrt(x)+4))))*x^(-1/2): https://www.wolframalpha.com/input/?i=%7C2*cos%285%2F8*sqrt%28x%29%2B1%2F2%29%2Fsqrt%28x%29%7C+%3D+sqrt%282%2Bsqrt%282%2Bsqrt%282%2B2*cos%285*sqrt%28x%29%2B4%29%29%29%29*x%5E%28-1%2F2%29

Best wishes, 

Rodrigo
Reply all
Reply to author
Forward
0 new messages