Robert,
This is very useful indeed. It solved my problem.
By the way, the more I use Maxima the more I learn how useful it is. The
only problem is that I couldn?t find yet a good place to learn how to make a
more advanced use of it. For instance, It took me a while to realize that
the commands `tellsimp? and `tellsimpafter? only work after `matchdeclare?.
I couldn?t find this info in Maxima?s manual or in any of the tutorials (I
might have overlooked it, though).
Could you suggest a place where I can get into Maxima details ?
One example of what I?m trying to do is after getting the E() function into
the implicit sum (and keeping the `n` generic) I would like to simplify it
based on what I know about the function E().
For instance in the following
E ('sum (h (k,j), k, 1, n));
=> 'sum (E (h (k,j)), k, 1, n)
I know that E(h(k,j)) = a for k=j and E(h(k,j))=b for k<>j, where `a` and
`b` are constants, and j in [1,n]
I would like to have
'sum (E (h (k,j)), k, 1, n) evaluated to
=> a+b*(n-1).
Is it possible to do that ?
Thanks.
Paulo Grahl
On Wed, May 21, 2008 at 12:57 AM, Robert Dodier <robert.dodier at gmail.com>
wrote:
> On 5/20/08, Paulo Grahl <pgrahl at gmail.com> wrote:
>
> > E(sum(f(i),i,1,n)) does not expand to sum(E(f(i)),i,1,n).
> > Any idea on how I implement such an expansion ?
>
> I may be overlooking something simpler, but the following might be useful.
>
> matchdeclare ([aa, bb, cc], all);
> matchdeclare (dd, lambda ([ee], ee < inf));
> simp : false;
> tellsimp (E ('sum (aa, bb, cc, dd)), apply (nounify (sum), [E (aa),
> bb, cc, dd]));
> simp : true;
>
> E ('sum (g (k), k, 1, 5));
> => 'sum (E (g (k)), k, 1, 5);
>
> E ('sum (h (k), k, 1, n));
> => 'sum (E (h (k)), k, 1, n)
>
> E ('sum (f (i), i, 1, inf));
> => E ('sum (f (i), i, 1, inf))
>
> There are some limitations. (1) This works only for E, not any other
> function (unless rules are made for them too).
> (2) Should check the lower limit of summation as well as the upper.
> (3) For an infinite sum, maybe there should be a test on the summand;
> but then the appropriate test depends on E, right?
> I don't know what to do in general.
>
> Anyway I hope this is helpful in some way.
>
> Robert Dodier
>
--
-----------------------------------------------
Paulo Gustavo Grahl, CFA
pgrahl at fgvmail.br
pgrahl at gmail.com
http://www.linkedin.com/in/pgrahl
+55 (21) 8809-9254
-----------------------------------------------