block() and local variables?



Hi Robert

On Mon, 2006-02-20 at 18:00 -0700, Robert Dodier wrote:
> Hello Neilen,
> 
> > (%i3) symvert:matrix(   [x1, y1, z1],
> >                         [x2, y2, z2],
> >                         [x3, y3, z3],
> >                         [x4, y4, z3])$
> 
> Does the last row want to be [x4, y4, z4] ?

Oh yes, *blush*, must have happened while indenting the pasted session
for readability :) WxMaxima for all it's nicety seems to abhor newlines
when you paste from it ;P

> lls (a so-called memoizing function).
> 
> If I'm not mistaken, the following version of tetmat
> seems to do what you want:
> 
> tetmat (el_nodes, verts) := block (local (coord_mat),
>   coord_mat [i,j] := verts [el_nodes [i]][j],
>   addcol (columnvector ([1,1,1,1]), genmatrix (coord_mat, 4, 3)));

It does indeed! Thanks so much. The extra stuff and typos were due to
the fact that it was late, and I was in the middle of trying to find out
what exactly was going on... Now I am enlightened :)

Thanks
Neilen