integration problem

30 views
Skip to first unread message

Erin Hodgess

unread,
Nov 11, 2013, 4:05:07 PM11/11/13
to sy...@googlegroups.com
Hello!

I'm having a little trouble with some integration.

My goal is to set up a cumulative distribution for some functions.  The one below is my attempt at the gamma distribution.  However, it does not like the integrate statement.




>>> x, y, t = symbols('x y t')
>>> shape = float(4.0)
>>> scale = float(1.5)
>>> z2 = (scale**shape)*gamma(shape)
>>> y = ((x*(shape-1))*exp(-x/scale))/z2
>>> y
0.0987654320987654*x*exp(-0.666666666666667*x)
>>> integrate(y,(x,0,t))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/sympy/utilities/decorator.py", line 30, in threaded_func
    return func(expr, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/sympy/integrals/integrals.py", line 1626, in integrate
    risch=risch, manual=manual)

Has anyone run into this before, please?

Thanks in advance for any help.

Sincerely,
Erin


Aaron Meurer

unread,
Nov 11, 2013, 6:01:35 PM11/11/13
to sy...@googlegroups.com
This was a bug and has been fixed in the development version. It will
work in the next version.

Aaron Meurer
> --
> 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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sympy.
> For more options, visit https://groups.google.com/groups/opt_out.

Erin Hodgess

unread,
Nov 11, 2013, 7:50:05 PM11/11/13
to sy...@googlegroups.com
Thank you!

mario

unread,
Nov 12, 2013, 4:29:34 AM11/12/13
to sy...@googlegroups.com
I get the same error message, using the development version; putting instead

shape = 4
scale = 2

(not float) it does not give an error.

Erin Hodgess

unread,
Nov 12, 2013, 9:13:06 AM11/12/13
to sy...@googlegroups.com
Mario....that's it.  The gamma function only wants integers.

Thanks!


--
You received this message because you are subscribed to a topic in the Google Groups "sympy" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sympy/OF_TB9PZJYw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sympy+un...@googlegroups.com.

To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
For more options, visit https://groups.google.com/groups/opt_out.



--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm....@gmail.com
Reply all
Reply to author
Forward
0 new messages