It seems that sympy cannot properly break apart functions for integration.

Python 2.7.6 |Anaconda 1.9.1 (x86_64)| (default, Jan 10 2014, 11:23:15) 
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
%guiref   -> A brief reference about the graphical user interface.

In [1]: from sympy import *

In [2]: init_session()
IPython console for SymPy 0.7.5 (Python 2.7.6-64-bit) (ground types: python)

These commands were executed:
>>> from __future__ import division
>>> from sympy import *
>>> x, y, z, t = symbols('x y z t')
>>> k, m, n = symbols('k m n', integer=True)
>>> f, g, h = symbols('f g h', cls=Function)

Documentation can be found at http://www.sympy.org
WARNING: Hook shutdown_hook is deprecated. Use the atexit module instead.

 

In [5]: print integrate(expand((x-2)/sqrt(x)),(x,1,4))
2/3

In [6]: print integrate((x-2)/sqrt(x),(x,1,4))
-6

The former is correct based on other calculations.

Also:

print integrate(expand((x-2)/sqrt(x)),x)
2*x**(3/2)/3 - 4*sqrt(x)

print integrate((x-2)/sqrt(x),x)
2*sqrt(1 + 2/(x - 2))*(x - 2)**(7/2)/(6*x + 3*(x - 2)**2 - 12) - 4*sqrt(1 + 
2/(x - 2))*(x - 2)**(5/2)/(6*x + 3*(x - 2)**2 - 12) - 16*sqrt(1 + 2/(x - 
2))*(x - 2)**(3/2)/(6*x + 3*(x - 2)**2 - 12) + 8*sqrt(2)*(x - 2)**2/(6*x + 
3*(x - 2)**2 - 12) + 16*sqrt(2)*(x - 2)/(6*x + 3*(x - 2)**2 - 12)

Again, the former is correct.

Thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/63e4d240-59d5-422f-b265-0b2b1895142f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to