I would like to move from Mathematica to Sympy. Unfortunately, I couldn't 
calculate several integrals on Sympy, which Mathematica calculates easily. For 
example, Mathematica analytically integrate the Green function (gf) over X 
and Y


norm=sqrt(X**2+Y**2); gf=1/ norm


giving simple expression


expr=Y*log(X+ norm) + X*log(Y+ norm).


I was lucky enough to prove this result on Sympy, using differentiation and 
simplifications:


import sympy

X,  Y = sympy.symbols("X, Y",  real=True)

from sympy import  log, sqrt, diff

norm=sqrt(X**2+Y**2)

expr=Y*log(X+ norm) + X*log(Y+ norm)

sympy.radsimp(sympy.simplify(diff(expr, X, Y)))-1/norm =0


My naïve attempt to calculate the integral


sympy.integrate(1/norm, X, Y)


failed, since Sympy return the following expression


X*Integral(Abs(Y)*asinh(Abs(X)/Abs(Y))/Y, Y)/Abs(X)


Then I tried to simplify calculation of the integral,   subdividing it to 
two following integrals


Int1= sympy.integrate(1/norm, X)

Int2= sympy.integrate(Int1, Y).


Sympy calculated Int1 as

X*Abs(Y)*asinh(Abs(X)/Abs(Y))/(Y*Abs(X))

 

And Int2 returned unevaluated in the form

X*Integral(Abs(Y)*asinh(Abs(X)/Abs(Y))/Y, Y)/Abs(X)

 

I recalculate Int1 by Mathematica and have got results expressed in terms 
of logarithmic function Int1=log(X+ norm) 

(rather than asinh as Sympy does). And, finally, I have calculated


sympy.integrate(log(X+ norm), Y)


and have got results in the form


Y*log(X + sqrt(X**2 + Y**2)) + Y*Abs(X)*asinh(Abs(Y)/Abs(X))/Abs(Y) - Y


I feel that this result is equal to the Mathematica result Y*log(X+ norm) + 
X*log(Y+ norm), but failed to prove it.

May be somebody knows, how to calculate integrals  


sympy.integrate(1/norm, X), sympy.integrate(1/norm, X, Y)


in terms of logarithmic functions?

-- 
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 https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/67b5a4d7-1bc4-49db-9c2f-4e1e2634241b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to