The results of some integration test.

107 views
Skip to first unread message

Peter Luschny

unread,
Sep 4, 2013, 1:01:07 PM9/4/13
to sage-s...@googlegroups.com
Recently two integration test suites were discussed at sci.math.symbolic [1], [2].

I executed the tests with Sage and put the results on my webpage [3].
Not all results are favorable for Sage. Maybe this is worth to be
noted by some Sage developers.

Peter

[1] https://groups.google.com/d/msg/sci.math.symbolic/UB0udwILOSw/msxc57stRM8J
[2] https://groups.google.com/d/msg/sci.math.symbolic/D9W45zQTY3U/nIxsBZ-4RasJ
[3] http://luschny.de/math/quad/IntegralTestsSage.html

kcrisman

unread,
Sep 4, 2013, 1:28:05 PM9/4/13
to sage-s...@googlegroups.com


On Wednesday, September 4, 2013 1:01:07 PM UTC-4, Peter Luschny wrote:
Recently two integration test suites were discussed at sci.math.symbolic [1], [2].

I executed the tests with Sage and put the results on my webpage [3].
Not all results are favorable for Sage. Maybe this is worth to be
noted by some Sage developers.

This is interesting, but especially because of your comment:

A good answer gives FriCAS 1.2.1. It is a pitty that there is no option 'fricas' in the selection box of Sage's integration algorithm. 

That is not a bad idea; in fact, it is http://trac.sagemath.org/ticket/9427.   That's bitrotted quite a bit, but probably someone (you?) could bring it up to speed. 

Also note http://trac.sagemath.org/ticket/9465 for upgrading Fricas.

Also, as to these tests, I can see this fitting in sage/tests/ or perhaps by analogy with the wester.py file.  

Burcin Erocal

unread,
Sep 5, 2013, 4:57:35 AM9/5/13
to sage-s...@googlegroups.com
On Wed, 4 Sep 2013 10:28:05 -0700 (PDT)
kcrisman <kcri...@gmail.com> wrote:

> On Wednesday, September 4, 2013 1:01:07 PM UTC-4, Peter Luschny wrote:
> >
> > Recently two integration test suites were discussed at
> > sci.math.symbolic [1], [2].
> >
> > I executed the tests with Sage and put the results on my webpage
> > [3]. Not all results are favorable for Sage. Maybe this is worth to
> > be noted by some Sage developers.

Peter, many thanks for converting these to Sage syntax.

> This is interesting, but especially because of your comment:
>
> A good answer gives FriCAS 1.2.1. It is a pitty that there is no
> option 'fricas' in the selection box of Sage's integration algorithm.
>
> That is not a bad idea; in fact, it is
> http://trac.sagemath.org/ticket/9427. That's bitrotted quite a bit,
> but probably someone (you?) could bring it up to speed.
>
> Also note http://trac.sagemath.org/ticket/9465 for upgrading Fricas.
>
> Also, as to these tests, I can see this fitting in sage/tests/ or
> perhaps by analogy with the wester.py file.

It would be great to have them in a file similar to wester.py. Can you
open a ticket?


Cheers,
Burcin

kcrisman

unread,
Sep 6, 2013, 10:45:16 AM9/6/13
to sage-s...@googlegroups.com
> This is interesting, but especially because of your comment:
>
> A good answer gives FriCAS 1.2.1. It is a pitty that there is no
> option 'fricas' in the selection box of Sage's integration algorithm.
>
> That is not a bad idea; in fact, it is
> http://trac.sagemath.org/ticket/9427.   That's bitrotted quite a bit,
> but probably someone (you?) could bring it up to speed.
>
> Also note http://trac.sagemath.org/ticket/9465 for upgrading Fricas.
>
> Also, as to these tests, I can see this fitting in sage/tests/ or
> perhaps by analogy with the wester.py file.  

It would be great to have them in a file similar to wester.py. Can you
open a ticket?


Peter Luschny

unread,
Sep 6, 2013, 1:17:13 PM9/6/13
to sage-s...@googlegroups.com
> It would be great to have them in a file similar to wester.py. Can you
> open a ticket?

I have put the test suite in a Sage worksheet and added some comments.
Perhaps this is useful?

http://www.luschny.de/math/quad/CharlwoodIntegrationTest.sws

Peter

Peter Luschny

unread,
Sep 7, 2013, 7:22:01 AM9/7/13
to sage-s...@googlegroups.com

I have put the test suite in a Sage worksheet and added some comments.
 
I have moved the worksheet. It is now the public project 'CharlwoodFifty'
at https://cloud.sagemath.com/

Unfortunately I do not know how to give a link to this project.

Peter

Georgi Guninski

unread,
Sep 7, 2013, 8:25:26 AM9/7/13
to sage-s...@googlegroups.com
Interesting experiment.

Your methodology for "diffs back" assumes
correctly computing the derivative and correctly
comparing symbolic expressions and for the latter
counterexamples are known [1]

bool( sqrt((a+b)^2) == sqrt(a^2) + sqrt(b^2) )
True

btw, I get:
'sage.rings.complex_interval.ComplexIntervalFieldElement' object has no attribute 'cot'

when trying your |check| on this:

-arctan(cot(pi*x))/pi + 1/2 #fractional part of x

[1] http://comments.gmane.org/gmane.comp.mathematics.sage.support/32115
> --
> 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/groups/opt_out.

Peter Luschny

unread,
Sep 7, 2013, 9:18:42 AM9/7/13
to sage-s...@googlegroups.com, guni...@guninski.com
>Your methodology for "diffs back" assumes
>correctly computing the derivative and correctly
>comparing symbolic expressions and for the latter
>counterexamples are known

Yes. This is just an indicator of possible problems, nothing more.
"diffs back" checks f == 0 which is incorrect a priori, it should
be f == c for some constant. (See for example problem(24).)
But as a warning lamp for the reviewer it works quite well.


> 'sage.rings.complex_interval.ComplexIntervalFieldElement'
> object has no attribute 'cot'

There are many similar errors of this kind. I have been told that
they reflect some other Sage bug not related to integration.

The most weird thing I observed occurs in connection with Charlwood's
problem 8. Sometimes Sage quits with an RuntimeError and sometimes
Sage returns a monster solution. Indefinite integration by a Monte
Carlo method? Something for the Journal of Irreproducible Results ;-)

Peter

Burcin Erocal

unread,
Sep 9, 2013, 1:59:57 AM9/9/13
to sage-s...@googlegroups.com
On Sat, 7 Sep 2013 15:25:26 +0300
Georgi Guninski <guni...@guninski.com> wrote:

<snip>
> btw, I get:
> 'sage.rings.complex_interval.ComplexIntervalFieldElement' object has
> no attribute 'cot'
>
> when trying your |check| on this:
>
> -arctan(cot(pi*x))/pi + 1/2 #fractional part of x

This is now #15179:

http://trac.sagemath.org/ticket/15179


Cheers,
Burcin

Georgi Guninski

unread,
Sep 10, 2013, 10:15:21 AM9/10/13
to Peter Luschny, sage-s...@googlegroups.com
Appears to me diffs back: False not necessarily
means wrong result.

For:
[23] diffs back: False
integrand: x*log(x + sqrt(x^2 + 1))*arctan(x)/sqrt(x^2 + 1)
antideriv: sqrt(x^2 + 1)*log(x + sqrt(x^2 + 1))*arctan(x) - x*arctan(x) - 1/2*log(x + sqrt(x^2 + 1))^2 + 1/2*log(x^2 + 1)
maxima : (sqrt(x^2 + 1)*log(x + sqrt(x^2 + 1)) - x)*arctan(x) + 1/2*log(x + sqrt(x^2 + 1))^2 - log(x + sqrt(x^2 + 1))*arcsinh(x) + 1/2*log(x^2 + 1)

Test:

sage: ex=x*log(x + sqrt(x^2 + 1))*arctan(x)/sqrt(x^2 + 1);inte=integrate(ex,x);back=inte.derivative(x)
sage: t1=(ex-back).full_simplify()
sage: t1
((2*x^2 + 1)*arcsinh(x) - (2*x^2 + 1)*log(x + sqrt(x^2 + 1)) + 2*sqrt(x^2 + 1)*(x*arcsinh(x) - x*log(x + sqrt(x^2 + 1))))/(2*x^3 + (2*x^2 + 1)*sqrt(x^2 + 1) + 2*x)

sage: CC(t1(x=5))
-1.09303758073658e-16
sage: CC(t1(x=14.13))
0.000000000000000

According to Wolfram Alpha |t1| simplifies to 0:

http://www.wolframalpha.com/input/?i=%28%282*x^2+%2B+1%29*arcsinh%28x%29+-+%282*x^2+%2B+1%29*log%28x+%2B+sqrt%28x^2+%2B+1%29%29+%2B+2*sqrt%28x^2+%2B+1%29*%28x*arcsinh%28x%29+-+x*log%28x+%2B+sqrt%28x^2+%2B+1%29%29%29%29%2F%282*x^3+%2B+%282*x^2+%2B+1%29*sqrt%28x^2+%2B+1%29+%2B+2*x%29

Result: 0

This is modulo bugs in .full_simplify().


On Wed, Sep 04, 2013 at 10:01:07AM -0700, Peter Luschny wrote:
Reply all
Reply to author
Forward
0 new messages