matrix multiplication



As a patch, I created a cross function so that I don't have to load
vect.mac.  But I could use some help with it.  I actually found a
function in an online tutorial and I generalized it just a bit:

cross (v1, v2) :=block(M:matrix([[1, 0, 0], [0, 1, 0], [0, 0,1]]),
M:addrow(M, v1), M:addrow(M, v2), determinant(M))$

Basically, it evaluates the cross product as the determinant of a
matrix with i,j,k in the first row, v1 in the second row, and v2 in
the third row.  By using addrow, it can now take v1 and v2 either as
lists or matrices.  I would like to make it so that it can take row or
column vectors for inputs v1 and v2.  I think that would work by
checking the number of rows and columns of v1 and v2 (if they are
matrices) and transposing if numrows > numcols.  Alternatively, it
could work by decomposing a matrix input into a list.  But, I can't
find functions to tell me how many rows and columns a matrix has or to
convert a matrix to a list.

Can someone help me with this please.  (I am a lisp newbie).

Thanks,

Ryan

On 3/22/07, Richard Fateman <fateman at cs.berkeley.edu> wrote:
>
>
> > -----Original Message-----
> > From: maxima-bounces at math.utexas.edu
> > [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert Dodier
> >.
> >
> > On a slight tangent, I would like to make it possible to apply the
> > scalar product operator to other objects such as functions.
>
> Maxima does not really have any object which is a function. It has only
> expressions.
> Some expressions are atoms which are coincidentally the names of functions,
> like sin,cos,tan or "+".
> Some expressions are explicit representations of anonymous functions like
>   lambda([x],x+1)
>
> Operator calculus,  e.g. factoring the differential operator D^2-1, and such
> stuff becomes messy because people essentially are creating mathematical
> puns. Sometimes they happen to work. Sometimes they are nonsense.
>
> There was a paper
>
> http://portal.acm.org/citation.cfm?id=32488
>
> Which gives some ideas, thouhg.
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>