Hi, I'm new to sage and am trying to work out how to use it to do some calculus on various probability distributions I have. It seems to integrate a beta distribution well but I can't get it to manage a Dirichlet distribution. Am I missing something or is this beyond its scope?

Here's my code:

a, b, c = var('a b c')
assume(a > 0)
assume(b > 0)
assume(c > 0)

#
# Beta
#
x = var('x')
beta_dist = x**(a-1) * (1 - x)**(b-1)
c = integral(beta_dist, x, 0, 1)

#
# Dirichlet
#
x_1, x_2, x_3 = var('x_1, x_2, x_3')
dirichlet_dist = x_1**(a-1) * x_2**(b-1) * (1-x_2-x_1)**(c-1)
e = integral(dirichlet_dist, x_1, 0, 1)
f = integral(e, x_2, 0, 1)


Then in my sage session I attach this and get:
----------------------------------------------------------------------
| Sage Version 4.4.2, Release Date: 2010-05-19                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: attach('hdpm.py')
sage: c
beta(a, b)
sage: f
integrate(x_2^(b - 1)*integrate((-x_1 - x_2 + 1)^(beta(a, b) - 1)*x_1^(a - 1), x_1, 0, 1), x_2, 0, 1)

Presumably it left the integrals alone because it couldn't do them. Is there any way to help it along?

Thanks,
John.

--
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/sage-support
URL: http://www.sagemath.org

Reply via email to