# [Maxima] A slight issue with a series in WxMaxima

Tue Mar 17 06:15:58 CDT 2009

```Hello again

Many thanks for your replies Barton and Robert...They both helped in
different ways :-)

@Barton Willis:
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
distribution.

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
general.

@Robert Dodier:
Recommendation #1 was OK, but i lost you in #2 :-D

"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
Athanasios

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,
> LL));
> simp:true;
> 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
> practice
> > when dealing with a series? Are there any mathematical "identities" for
> the
> > 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...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20090317/6d40805e/attachment.htm
```