Integrate Dirichlet distribution



John Reid wrote:
> I've been trying to evaluate sage for integration and expression 
> manipulation in the context of probabilistic models. I understand it 
> uses Maxima for this. After posting on the sage mailing list I was 
> pointed here for further help/discussion.
>
> My problem is that Maxima can integrate a beta distribution but not a 
> Dirichlet distribution.
>
Adding indefinite integrals of special functions is reasonably easy to do.

You need to define an integral property (in lisp) for the function.  For 
example, in sin.lisp,  we define the integrals of some elementary functions:

(defprop %log  ((x) ((mplus) ((mtimes) x ((%log) x)) ((mtimes) -1 x))) 
integral)
(defprop %sin  ((x) ((mtimes) -1 ((%cos) x))) integral)
(defprop %cos  ((x) ((%sin) x)) integral)

If more logic is required, the property can be a lambda expression.  
Also in sin.lisp we define the integral of the exponent operator using

;; Integral of a^b == ((mexpt) a b)
(putprop 'mexpt
  `((a b)
  ;;integrate(a^b,a);
  ,(lambda (a b)
    (cond
      ((or (equal b -1)
       (and (not (mnump b))
        (freeof '$%i b)
        (eq (asksign (power (add b 1) 2)) '$zero)))
         (logmabs a))
      (t
       '((mtimes) ((mexpt) a ((mplus) b 1)) ((mexpt) ((mplus) b 1) -1)))))
  ;; integrate(a^b,b);
  ((mtimes) ((mexpt) a b) ((mexpt) ((%log) a) -1)))
  'integral)

There are numerous examples in airy.lisp, bessel.lisp, expintegral.lisp, 
gamma.lisp and elsewhere.  Just grep for "integral)".

I don't know much about definite integrals.