1

This integral cannot be evaluated.

>>> from sympy import integrate, sin, cos,sqrt, Symbol
>>> x = Symbol('x')
>>> integrate(1/sqrt(1+sin(x)**2),x)
Integral(1/sqrt(sin(x)**2 + 1), x)

Does sympy not support decomposing integrals into elliptic integrals as mathematica, wolfram alpha, or maple do? (wolfram answer)

I tried looking in the sympy buglist under the integration label, but nothing jumped out at me (there was something on recognizing elliptic integrals, but the bug description wasn't clear to me).

Thanks!

Grant
  • 13
  • 4
  • As far as I am aware they are not supported. Currently, sympy uses the Risch (http://en.wikipedia.org/wiki/Risch_algorithm) algorithm as well as handling a some, but not all, non-elemtary cases, e.g. it handles integrals of gaussians. See http://docs.sympy.org/dev/modules/integrals/integrals.html – Lucas Jun 08 '13 at 03:35
  • @Lucas SymPy also has a very powerful algorithm that uses Meijer G-functions to evaluate integrals in terms of special functions. – asmeurer Jun 09 '13 at 19:13
  • @asmeurer Not knowing things like that is why I thought I'd leave it to you to give a more detailed answer ;) – Lucas Jun 09 '13 at 19:29

1 Answers1

1

SymPy's integrators are always improving, but there are still several classes of integrals that they cannot do yet. This is apparently one of them. Feel free to open new issues in the bug tracker for things like this. It's definitely something that we want to be able to do.

asmeurer
  • 86,894
  • 26
  • 169
  • 240
  • Thanks for clearing that up! I'll open an issue. I ended up finding a solution to my symbolic needs using this post: http://stackoverflow.com/questions/2053231/grabbing-the-output-of-maple-via-python – Grant Jun 10 '13 at 16:47
  • We discussed the things that need to be done for this to work at http://colabti.org/irclogger/irclogger_log/sympy?date=2013-06-09#l151. Already it lead to a [pull request](https://github.com/sympy/sympy/pull/2165) to make things work with complete elliptic integrals. – asmeurer Jun 10 '13 at 20:34
  • I noticed recently that the pull request was completed. Does having the functions in the Meijer-G table mean that integrals that can be expressed as complete elliptic ints are now possible? I tried the latest copy from github on a definite integral, but no luck. – Grant Jul 02 '13 at 16:10
  • No, unfortunately, that was only for complete elliptic integrals, but your integral needs incomplete ones, which are not as easy to do with the Meijer G-function (according to the author of that pull request). See the IRC log I linked to above. – asmeurer Jul 02 '13 at 19:40
  • Oh, no no, I get that. I did try it on something that is expressible in terms of complete integrals (particularly, if you integrate the above from 0 to Pi: http://www.wolframalpha.com/input/?i=integrate+1%2Fsqrt%281%2Bsin%28x%29**2%29+from+0+to+Pi ) – Grant Jul 02 '13 at 21:25
  • Or does the integral need to fulfill this requirement in its indefinite form? – Grant Jul 02 '13 at 21:30
  • @Grant I don't know the answer to your question. Can you ask at https://github.com/sympy/sympy/pull/2165 ? – asmeurer Jul 02 '13 at 21:46
  • I think I answered my own question actually. According to the sympy docs, meijer-G integration only applies in the definite case to [0,inf]. So yes, the definite version of the integral above is not possible either. – Grant Jul 02 '13 at 22:15
  • Sure, but it can also apply to the indefinite case, and I think there might be some cases in the code where it changes to `0, oo` by a change of variable. – asmeurer Jul 03 '13 at 02:05
  • Obviously not for this one, but I'm just saying that sometimes it does work. – asmeurer Jul 03 '13 at 02:20
  • OK, the correct answer is at https://code.google.com/p/sympy/issues/detail?id=2063#c9. That pull request only handles integrands that contain K(z) or E(z), not those that produce them. – asmeurer Jul 06 '13 at 02:19
  • Ok, thanks for letting me know. Should I be tuned into this issue for future updates? --> https://code.google.com/p/sympy/issues/detail?id=1393 – Grant Jul 08 '13 at 16:25
  • Sure. Also feel free to open an issue for just this particular integral (I don't think we have one yet). – asmeurer Jul 08 '13 at 18:56