Hi Ronan,

Thanks you much for clearing this up: my assumption about Assume() was
incorrect!

What is the expected output without using Symbol('kT', positive=True)?
Should I report this as a bug?

Best regards,

Dan

On May 20, 10:32 am, Ronan Lamy <[email protected]> wrote:
> Le jeudi 20 mai 2010 à 01:48 -0700, Dan a écrit :
>
>
>
>
>
> > Hi folks,
>
> > I'm trying to integrate a function but I can't understand why sympy is
> > producing the wrong output.
>
> > The equation is,
>
> > var('C E kT xmin')
> > Assume(kT > 0)
> > Assume(xmin >=0)
> > integrate(C * x**2 * exp(-x/kT), (x, xmin, oo))
>
> > which gives,
> > -oo - C*(-2*kT**3*exp(-xmin/kT) - kT*xmin**2*exp(-xmin/kT) -
> > 2*xmin*kT**2*exp(-xmin/kT))
>
> > This is correct apart from negative infinity the appears at the
> > beginning. Am I doing something wrong?
>
> > When I tried this with Maxima is asked what the sign of kT is (hence
> > the use of Assume above), but it then goes on to give the correct
> > answer. Help very much appreciated.
>
> Despite the name, Assume doesn't do anything, it's just an inert object.
> To do what you want, you need:
>
> kT = Symbol('kT', positive=True)
>
> With that, it works:
>
> In [11]: print integrate(C * x**2 * exp(-x/kT), (x, xmin, oo))
> -C*(-2*kT**3*exp(-xmin/kT) - kT*xmin**2*exp(-xmin/kT) -
> 2*xmin*kT**2*exp(-xmin/kT))
>
> The fact that you get a result containing oo is, obviously, a bug.
>
> Ronan
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sympy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group 
> athttp://groups.google.com/group/sympy?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to