[Maxima] A slight issue with a series in WxMaxima
athanastasiou at googlemail.com
Tue Mar 17 06:15:58 CDT 2009
Many thanks for your replies Barton and Robert...They both helped in
different ways :-)
Indeed, this worked and i even reached the point where by solving the system
of two equations i was able to arrive at the MLE estimates of the mean and
standard deviation for the (conveniently simple) case of a Gaussian
As i said before, i am taking my first steps in Maxima, so i can not help it
not to ask if the trick was done by the '' or the parentheses :-D . I
thought it was because of the parentheses which would "force" the expression
in them to be evaluated first, but the two accents ('') seem to be required
as well. (?)
Since i tried the result with a couple of vectors with normally distributed
numbers and they were correct, i think that the expressions are properly
set, although, it is defined as the sum of diffs and not the diff of the
sums. It probably does not make any difference but as in my original email,
i was wondering if there is a good reference for working with series in
Recommendation #1 was OK, but i lost you in #2 :-D
I need to do a bit more reading about simplification rules.
"Not sure what you mean, but maybe "logexpand" is useful."
The example i had in mind is from:
http://en.wikipedia.org/wiki/Maximum_likelihood and specifically the section
"Continuous distribution, continuous parameter space". It starts by the
product of the pdf values for each X[i] (This is alright) but it ends up
with a sum in the exponent of %e (???). So this is why i asked if there are
any identities when dealing with series. In this case i would expect the sum
to be on the %e terms and not its exponent (You can then remove the
log(exp("blah")) and just have a sum of "blah" but in this case they keep
%e). In the majority of cases, wikipedia examples are reproduced off some
printed book or article so i assume that this derivation is correct.
Logexpand might come handy, thanks.
I will most probably give it a try today and tell you how it went. In the
meantime i welcome any comments on the above (if any) :-)
All the best
On Mon, Mar 16, 2009 at 6:15 PM, Robert Dodier <robert.dodier at gmail.com>wrote:
> 2009/3/16 Athanasios Anastasiou <athanastasiou at googlemail.com>:
> > Is there something additional i should be doing to get the full symbolic
> > expression for diff(L(X,m,s),m) in maxima?
> diff doesn't seem to know that it can distribute over lsum;
> this is just an oversight. A couple of ideas:
> (1) use sum instead of lsum; 'sum prevents expansion into a literal sum
> (2) devise a simplification rule:
> matchdeclare ([xx, yy, LL], symbolp, aa, all);
> simp : false;
> tellsimp ('diff ('lsum (aa, yy, LL), xx, 1), 'lsum ('diff (aa, xx, 1), yy,
> diff (lsum (f(x, y), y, L), x);
> => 'lsum('diff(f(x,y),x,1),y,L)
> > In trying to solve this, i had a look around in the internet and noticed
> > that sometimes the series that the likelihood function L introduces goes
> > directly to the exponent of e in the gaussian pdf. Is this common
> > when dealing with a series? Are there any mathematical "identities" for
> > treatment of series in cases like these?
> Not sure what you mean, but maybe "logexpand" is useful.
> log ('product (exp (x [i]), i, 1, n));
> => log('product(%e^x[i],i,1,n))
> log ('product (exp (x [i]), i, 1, n)), logexpand=all;
> => 'sum(x[i],i,1,n)
> Let me know when you are ready to try the full problem.
> Actually I found Maxima when I was working on a statistical problem myself
> that was just about 6 years ago. How time flies.
> Robert Dodier
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Maxima