Is that a Maxima bug or a chair-keyboard interface problem ?
Subject: Is that a Maxima bug or a chair-keyboard interface problem ?
From: Emmanuel Charpentier
Date: Wed, 14 Dec 2011 21:17:02 +0000 (UTC)
Dear list,
I'm trying to use Maxima as a way to check my (poor) algebraic abilities.
I wanted to check my derivation of Poisson's density in the specil case
where \lambda = e^{\beta_0 + \beta \cdot X)}
Here follows a commented transcript (thanks to emcs and imaxima) :
Maxima 5.24.0 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) block(load(("/usr/share/emacs23/site-lisp/maxima/imaxima.lisp")),
linenum:0)$
/* This transcript must be postable */
(%i1) display2d:true;
(%o1) true
/* We'll need this */
(%i2) load("simplify_sum");
(%o2) /usr/share/maxima/5.24.0/share/contrib/solve_rec/simplify_sum.mac
/* Probability of interest */
(%i3) dpois(k,l):=%e^-l*l^k/k!;
- l k
%e l
(%o3) dpois(k, l) := --------
/* A *generalization* of the expression of interest */
k!
(%i4) e1:dpois(k,C^(b0+X.b));
X . b + b0
X . b + b0 k - C
(C ) %e
(%o4) ------------------------------
k!
/* So far so good. A few sanity checks : */
(%i5) simplify_sum(sum(e1,k,0,inf));
(%o5) 1
/* It is indeed a probability. What is its mean ? */
(%i6) simplify_sum(sum(k*e1,k,0,inf));
X . b + b0
(%o6) C
/* As expected. Ditto for the variance : */
(%i7) simplify_sum(sum((k-%)^2*e1,k,0,inf));
X . b + b0
(%o7) C
/* As expected indeed. Value in the special case C:%e ? */
(%i8) e12:ev(%,C:%e);
X . b + b0
(%o8) %e
/* So far so good. But I first tried to compute this *directly* */
(%i9) e2:dpois(k,%e^(b0+X.b));
X . b + b0
k (X . b + b0) - %e
%e
(%o9) -------------------------------
k!
/* Okay. Check or the sum : */
(%i10) simplify_sum(sum(e2,k,0,inf));
(%o10) 1
/* Okay Ditto for the mean : */
(%i11) simplify_sum(sum(k*e2,k,0,inf));
X . b + b0
(%o11) %e
/* Ditto for the Variance : */
(%i12) simplify_sum(sum((k-%)^2*e2,k,0,inf));
/* *LONG* xait. Then : */
`quotient' by `zero'
#0: to_hypergeometric(expr=(%e^(2*X . b+b0*k+2*b0)-2*k*%e^(X . b+b0*k+b0)
+k^2*%e^(b0*k))*%e^(k*X . b-%e^(X . b+b0))/k!,var=k,lo=0,hi=inf)
#1: simplify_sum(expr='sum((k-%e^(X . b+b0))^2*%e^(k*(X . b+b0)-%e^(X . b
+b0))/k!,k,0,inf))(simplify_sum.mac line 281)
-- an error. To debug this try: debugmode(true);
(%i13)
/* Aauuugh ! */
Is that a problem with my thinking ? Or with Maxima ? Should this be
reported as a bug ? If so, where ?
Sincerely
Emmanuel Charpentier, DDS (yes !), MSc.