ratsimp and many terms to collect



I think Leo was suggesting something like:

(%i5) Lx: flatten( makelist([x(l+3-i,p+1), x(l+3-i,p), x(l+3-i,p-1)], i,1,3))$

(%i6) e1: (a*x(l,p-1)-b*x(l-1,p-1))*C3+(a*x(l+1,p-1)-b*x(l,p-1))*C2
    +(a*x(l+2,p-1)-b*x(l+1,p-1))*C1+(a*x(l,p)-b*x(l-1,p))*B3
    +(a*x(l+1,p)-b*x(l,p))*B2+(a*x(l+2,p)-b*x(l+1,p))*B1
    +(a*x(l,p+1)-b*x(l-1,p+1))*A3+(a*x(l+1,p+1)-b*x(l,p+1))*A2
    +(a*x(l+2,p+1)-b*x(l+1,p+1))*A1$

(%i7) apply(ratsimp, cons(e1,Lx));
(%o7) x(l,p-1)*(a*C3-b*C2)-b*x(l-1,p-1)*C3+x(l+1,p-1)*(a*C2-b*C1)+ ... 

Barton

________________________________________
From: maxima-bounces at math.utexas.edu [maxima-bounces at math.utexas.edu] on behalf of Zbigniew Komarnicki [cblasius at gmail.com]
Sent: Wednesday, May 15, 2013 12:43
To: Leo Butler
Cc: maxima at math.utexas.edu
Subject: Re: [Maxima] ratsimp and many terms to collect

On Wednesday 15 of May 2013 15:47:06 you wrote:
> You seem to want to use `apply'. This lets you build up the argument
> list to a function, then apply the function to the argument list:
>
> apply(function, arglist);

Thank you for the tip, but I have no idea how to make such function, what it should do.
I try this way, but this did not work.

collect(expr, Lx):= ratsimp(expr, Lx)$

This did not work
apply('collect, [e1, Lx]);

also error here
apply('collect, e1, Lx);

I completely have no idea. Could someone help or point me to some similar examples.
I found about matrix and apply (somewhere in net), but what abut function, which have one argument
or more fixed arguments and the rest need to be given as sequence, i.e.: arg1, arg2,..., argn, but not as a list?
How is the general approaches to such situations.

DataL : [[1, 2], [2, 4], [3, 6], [4, 8]];
DataM : apply('matrix, DataL);

but what to do when we need to use:
- ratsimp(fixed_expr, arg1, arg2, ..., argn)
- collectterms(fixed_expr, arg1, arg2, ..., argn )
etc.

How I can make or transform these functions to pass to it list as a second argument

the list
arglist: [arg1, arg2, ..., argn];

and call it as e.g.:
- ratsimp2(fixed_expr, arglist)
- collectterms2(fixed_expr, arglist)
etc.


Thank you in advance.

> Leo

Zbigniew

_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima