How to properly assume a parameters is real

24 views
Skip to first unread message

qm

unread,
Nov 11, 2016, 6:11:35 PM11/11/16
to sympy
I'm trying to get the indefinite integral w.r.t. x of a very simple function depending on a single parameter G, namely G/(x**2+G**2). I want to assume the parameter G to be either one of three: general, positive, and real. This is what I did

x=sp.symbols('x')

G=sp.symbols('G')

c = lambda x: G/(x**2+G**2)

u1=sp.integrate(c(x),x)


G=sp.symbols('G',positive=True)

c = lambda x: G/(x**2+G**2)

u2=sp.integrate(c(x),x)


G=sp.symbols('G',real=True)

c = lambda x: G/(x**2+G**2)

u3=sp.integrate(c(x),x)


print u1,'\n',u2,'\n',u3


This is what I get

-I*log(-I*G + x)/2 + I*log(I*G + x)/2


atan(x/G)


0


The 1st two I can understand, that 3rd one is completely unclear to me. Should I expect this? Why?

Reply all
Reply to author
Forward
0 new messages