On Tue, Feb 23, 2010 at 4:40 PM, Assad Ebrahim
<assad.ebrahim at alum.swarthmore.edu> wrote:
> ? solution(p):= (
> ? ? kill(a), kill(eq), ? ? ? ? ? ? ? ? ? ? ? /* clear namespace */
better to write block([a, eq], ...) since then an existing value
of a and eq is restored after the function returns.
> ? ? a: makelist(concat(a,i),i,1,p+1),
Pretty sure you're better off with a list of subscripted variables,
e.g. v : makelist(a[i], i, 0, p)
> ? for i:1 thru p+1 do (
> ? ? ? ?/* list of equations */
> ? ? ? ? ? eq[i]: sum(binom(j,i-1)*a[j],j,i,p+1) = binom(p,i-1)
> ? ? ),
instead of a for loop, try makelist instead.
eq : makelist (sum(binom(j,i-1)*a[j],j,i,p+1) = binom(p,i-1), i, 0, p)
> ? ? ? ? ? ? ? ? ? ? ? ? linsolve(listarray(eq),a)
At this point I think just linsolve(eq, v) (with v defined above) is enough.
Just some advice to make it more "naturally" Maxima-like.
Robert Dodier