On Sun, Apr 19, 2009 at 3:25 PM, Ondrej Certik <ond...@certik.cz> wrote: > > On Sun, Apr 19, 2009 at 1:23 PM, Fredrik Johansson > <fredrik.johans...@gmail.com> wrote: >> >> On Sun, Apr 19, 2009 at 10:14 PM, William Stein <wst...@gmail.com> wrote: >>> Wikipedia also has a few interesting remarks, e.g., that the Risch >>> algorithm isn't an algorithm, because it depends on being able to >>> check equality of general elementary functions, which is evidently an >>> open problem in general (so in practice you just fake it by evaluating >>> numerically at lots of points to decide if something is probably equal >>> to something else). It's also evidently not implemented anywhere, >>> e.g., a nice example on the Wikipedia page, is that if you let >>> >>> f = (x^2 + 2*x + 1 + >>> (3*x+1)*sqrt(x+log(x)))/(x*sqrt(x+log(x))*(x+sqrt(x+log(x)))) >>> >>> then it has the antiderivative >>> >>> g = 2*(sqrt(x+log(x)) + log(x+sqrt(x+log(x)))) >>> >>> since >>> >>> sage: h = g.derivative() - f >>> sage: h.full_simplify() >>> 0 >>> >>> However, Sage, Maple, and Mathematica, all simply give "integral(f)" >>> back when asked to integrate f. (I just checked this with the latest >>> versions.) >> >> Curiously though, SymPy knows this particular integral. >> >>>>> from sympy import * >>>>> x=Symbol('x') >>>>> f=(x**2+2*x+1+(3*x+1)*sqrt(x+log(x)))/(x*sqrt(x+log(x))*(x+sqrt(x+log(x)))) >>>>> integrate(f,x) >> 2*log(x + (x + log(x))**(1/2)) + 2*(x + log(x))**(1/2) > > I was just about to point it out. It even works in Sage: > > In [2]: f = (x^2 + 2*x + 1 + > ...: (3*x+1)*sqrt(x+log(x)))/(x*sqrt(x+log(x))*(x+sqrt(x+log(x)))) > In [5]: import sympy > In [6]: sympy.integrate(f, x) > Out[6]: 2*log(x + (x + log(x))**(1/2)) + 2*(x + log(x))**(1/2) > > > So we have a good start to implement the Risch algorithm in sympy already. >
Ondrej, How does sympy compute the integral of (x^2 + 2*x + 1 + (3*x+1)*sqrt(x+log(x)))/(x*sqrt(x+log(x))*(x+sqrt(x+log(x))))? William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---