# [Maxima] How to do matrix operation programatically in lisp

Robert Gloeckner Robert.Gloeckner at gmx.net
Fri Nov 23 09:56:57 CST 2007

```Hello,

thanks for your infos how to run maxima under lisp :)

On 23.11.2007 04:45, Kun Lin wrote:
> and then do (maxima-load) in sbcl.  I can run maxima from the lisp
> environment by
> doing (cl-user::run).   So this mean i should have all the functions
> available to me in maxima in lisp.
>
> Is there way for me to get the equivalent  result of matrix([1 2]) by
> doing something like
> (setf result (function args))?
>

> Is there a general way of doing something like this.  Meaning is there a
> calling convention i can follow if i know the maxima input form i can
> deduce its equivalent lisp function call and arguments.
info files):
"Lisp and Maxima symbols are distinguished by a naming convention.  A
Lisp symbol which begins with a dollar sign `\$' corresponds to a Maxima
symbol without the dollar sign.  A Maxima symbol which begins with a
question mark `?' corresponds to a Lisp symbol without the question mark.
[...]
Lisp code may be executed from within a Maxima session.  A single
line of Lisp (containing one or more forms) may be executed by the
special command `:lisp'. For example,
(%i1) :lisp (foo \$x \$y)
[...]
The `#\$' Lisp macro allows the use of Maxima expressions in Lisp
code.  `#\$<expr>\$' expands to a Lisp expression equivalent to the
Maxima expression <expr>.

(msetq \$foo #\$[x, y]\$)

This has the same effect as entering

(%i1) foo: [x, y];"

You can also translate() your maxima-code to see the equivalent lisp
code (& function calls).

> My ultimate goal is to use maxima as the backbone of all my
> mathematical  computing needs (symbolic, matrices ...) in writing lisp
> programs.  Can maxima do this?   Another idea is maybe my lisp code can
> call a .mac file.  I am just not sure what would be the best approach.

This is the same i would like to do, too ;)

HTH
Robert
```