> That is, we would like to write programs, load them and make the
> functions we have written, like det and crossprod available from within
> Maxima.
Are you interested in actually performing those calculations? If so, some
functionality is already available:
[a,b,c] . [-a,b,1/c] => b^2-a^2+1 (dot product)
The Vect package defines the "~" as the vector cross-product, but for some
reason does not work on concrete vectors:
a~a => 0 Correct simplification
[a,b,c] ~ [c,d,e] => unmodified
The Vect package appears to know about various vector simplifications, but
I'm afraid I don't know how to convince it to apply them (can anyone on the
list help?):
expand(a~(b+c)) => unmodified
a~(b+c),expandcross => unmodified
The easiest way to add a concrete crossproduct yourself is to write it in
the Maxima programming language:
crossproduct(v1,v2):=
if listp(v1) and length(v1)=3
and
listp(v2) and length(v2)=3
then
[ v1[2]*v2[3]-v1[3]*v2[2],
v1[3]*v2[1]-v1[1]*v2[3],
v1[1]*v2[2]-v1[2]*v2[1] ]
/* Alternate version ---------------------- */
then
determinant(
matrix(
[[1,0,0],[0,1,0],[0,0,1]],
v1 ,
v2
) )
/* end of alternate version --------------- */
else
v1 ~ v2;
Now
crossproduct([a,0,0],[0,b,0]) => [0,0,a*b]
You can also define your own simplifications and so on using the Maxima
language. Look at the matching package (MatchDeclare, TellSimp, etc.).
--------------------
It is also possible to write your code in the underlying Lisp system. This
is messier than writing in the Maxima language. For one thing, you need to
learn more about Maxima's internal conventions and representations. For
example, the mathematical expression sqrt(1+1/y) is represented internally
as
((MEXPT SIMP) ((MPLUS SIMP) 1 ((MEXPT SIMP) $Y -1)) ((RAT SIMP) 1 2))
To construct this in Lisp, you could write (using some handy predefined
functions/macros):
(pow (add 1 (div 1 '$y)) (div 1 2))
but why bother when in the Maxima language it is so much easier?
-s