Interested In Implementing Integration Algorithm so that sympy can Integrate anything that is Integrable

32 views
Skip to first unread message

Raman Garg

unread,
Mar 11, 2012, 11:51:46 PM3/11/12
to sympy
Hi,
I am a second year student of Netaji Subhas Institue of
Technology(under Delhi University),India.My major is Instrumentation
and Control engineering.I am good in "Data Structures and
Algorithms",as for the current project.Besides this I am good in
Linux,CSS etc..

I am programming for the past five years and have experience in C/C+
+.In my day to day life I spend a lot of time in cracking computing
puzzles and won various awards in my college.

Idea for the GSOC:
I liked "SYMBOLIC COMPUTATION OF INTEGRALS BY RECURRENCE" ,and am
interested in implementing the same.I first saw this idea on project
ideas page.

I have gone through the concept of the above idea,but don't know how
much of it is implemented before.Okay coming to the point ,how should
I start writing codes for it and what to study next as I have studied
its algorithm.

thanks
Raman Gupta

Aaron Meurer

unread,
Mar 12, 2012, 2:01:23 AM3/12/12
to sy...@googlegroups.com
I worked on the Risch algorithm for GSoC over the summer of 2010. The
work hasn't been merged yet, but you can find it at
https://github.com/asmeurer/sympy/tree/integration3, and details of
what was done are at
https://github.com/sympy/sympy/wiki/GSoC-2010-Risch-Integration-Report,
and in blog posts I made throughout the summer at my blog
(http://asmeurersympy.wordpress.com/). Let me know if you have any
questions.

Aaron Meurer

> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>

Raman Garg

unread,
Mar 12, 2012, 11:07:16 PM3/12/12
to sy...@googlegroups.com
Thanks for your guidance.
I have gone through what is Risch algorithm and how you tried to implement by reading your blog.I also skimmed through the risch function.Is skimming  enough or I need to study in detail.Also please guide me on what should I do next.

Saptarshi Mandal

unread,
Mar 13, 2012, 4:54:29 PM3/13/12
to sympy
How can you do anything useful with it if you don't have a detailed
idea about how the Risch algorithm works? What you should do next is
find out something (on your own or use the issues page) that is
broken, fix it and send a patch. The community will then review the
patch and provide you feedback that you can then act upon.

john.hoebing

unread,
Mar 14, 2012, 5:23:00 PM3/14/12
to sympy
Wow! You really made some progress and I can't believe it hasn't been
merged into the main code. I had given up on sympy for a lot of my
work because the integration starts to break on really simple
integrals, for instance from the latest 0.7.1.rc1:

In [1]: c=symbols('c')

In [2]: integrate(1/sqrt(1+x*x),x)
Out[2]: asinh(x)

In [3]: integrate(1/sqrt(1+x*x/(c*c)),x)
Out[3]:

⎮ 1
⎮ ────────────── dx
⎮ ⎽⎽⎽⎽⎽⎽⎽⎽
⎮ ╱ 2
⎮ ╱ x
⎮ ╱ 1 + ──
⎮ ╱ 2
⎮ ╲╱ c


In [4]:

where I've just tried to divide the function 'x*x' by a constant
'c*c'. That should have been easy!

Here's the output from your (2 year old!) Risch'd tree:

In [1]: c=symbols('c')

In [2]: integrate(1/sqrt(1+x*x),x)
Out[2]: asinh(x)

In [3]: integrate(1/sqrt(1+x*x/(c*c)),x)
Out[3]:
⎛x⎞
c⋅asinh⎜─⎟
⎝c⎠

In [4]:


Much better! A merge of this code should be a very high priority, and
I'm willing to help out.

John Hoebing



On Mar 11, 11:01 pm, Aaron Meurer <asmeu...@gmail.com> wrote:
> I worked on the Risch algorithm for GSoC over the summer of 2010.  The
> work hasn't been merged yet, but you can find it athttps://github.com/asmeurer/sympy/tree/integration3, and details of
> what was done are athttps://github.com/sympy/sympy/wiki/GSoC-2010-Risch-Integration-Report,

Aaron Meurer

unread,
Mar 14, 2012, 10:50:44 PM3/14/12
to sy...@googlegroups.com
Actually, this has nothing to do with the algorithm I implemented.
The Risch algorithm is accessible in my branch through the
risch_integrate() function, and it only works with a limited class of
functions that does not include this one.

By the way, this integral works in master:

In [70]: integrate(1/sqrt(1+x*x/(c*c)),x)
Out[70]:
⎛x⎞
c⋅asinh⎜─⎟
⎝c⎠

This is because of the new integration algorithm that was implemented
last summer using Meijer G-Functions. Unlike the Risch algorithm,
this is a heuristic, and works with a much broader class of functions
(also unlike Risch, the Meijer G algorithm works particularly well on
definite integrals). The power of the Risch algorithm over this one
is that it works on more complex functions, so long as they are within
the acceptable class, since it's an actual algorithm and not a
heuristic.

And yes, I should merge my branch already, even what you tried wasn't
really demonstrating the power of it. Play around with
risch_integrate() with functions with exp() and log(), and you'll see
it's power. integrate() in that branch is just the normal old
integrate() from 0.7.0 (which is less powerful than integrate in
master, but you can still see the difference if you compare there
too). Hopefully I'll have time this summer along with managing GSoC
and getting a 0.7.2 release out.

Aaron Meurer

john.hoebing

unread,
Mar 15, 2012, 2:24:56 AM3/15/12
to sympy


On Mar 14, 7:50 pm, Aaron Meurer <asmeu...@gmail.com> wrote:
> Actually, this has nothing to do with the algorithm I implemented.
> The Risch algorithm is accessible in my branch through the
> risch_integrate() function, and it only works with a limited class of
> functions that does not include this one.
>
> By the way, this integral works in master:
>
> In [70]: integrate(1/sqrt(1+x*x/(c*c)),x)
> Out[70]:
>        ⎛x⎞
> c⋅asinh⎜─⎟
>        ⎝c⎠
>

You are completely correct. Its funny that the default Ubuntu sympy
doesn't work; it runs on Ubuntu 12.04 beta and installs through the
generic 'sudo apt-get install python-sympy', and as you can see above,
its a 'SymPy 0.7.1.rc0' release. But I tried the master from github
and it works just like you say, so I'll work with the master until the
Ubuntu distro catches up.

John Hoebing

Sergiu Ivanov

unread,
Mar 15, 2012, 12:36:56 PM3/15/12
to sy...@googlegroups.com
Hello,

On Thu, Mar 15, 2012 at 8:24 AM, john.hoebing <jlh...@gmail.com> wrote:
>
> You are completely correct.  Its funny that the default Ubuntu sympy
> doesn't work; it runs on Ubuntu 12.04 beta and installs through the
> generic 'sudo apt-get install python-sympy', and as you can see above,
> its a 'SymPy 0.7.1.rc0' release.  But I tried the master from github
> and it works just like you say, so I'll work with the master until the
> Ubuntu distro catches up.

The problem with the Ubuntu package is that it is quite far from
corresponding to the latest version. According to this page
https://github.com/sympy/sympy/tags , the version 0.7.1.rc1 was
released about 8 months ago.

Sergiu

Aaron Meurer

unread,
Mar 15, 2012, 9:42:01 PM3/15/12
to sy...@googlegroups.com
SymPy 0.7.1 is the latest released version. We just haven't released
in a while.

I just checked, and this integral has not ever worked in master. It
didn't work in integration3 either. These things can depend on things
like assumptions or even architecture, though.

Aaron Meurer

Reply all
Reply to author
Forward
0 new messages