Embeddable Maxima

Download

Tarball

or

git clone https://filonenko-mikhail@github.com/filonenko-mikhail/embeddable-maxima.git
git checkout -b quicklisp --track origin/quicklisp

or

mkdir embeddable-maxima
cd embeddable-maxima
git init
git remote add origin https://filonenko-mikhail@github.com/filonenko-mikhail/embeddable-maxima.git
git fetch --depth 1 origin quicklisp:refs/remotes/quicklisp
git checkout -b quicklisp --track origin/quicklisp

Usage

emacs
M+x slime
  (pushnew "/path/to/maxima/" asdf:*central-registry*)
  (ql:quickload :embeddable-maxima)
  (cl-user::run)
    run_testsuite();
    quit();

Example

Solve linear equations in common lisp:

Example

[2*x + y - z = 8, -3*x - y + 2*z = -11, -2*x + y + 2*z = -3]

Maxima provides cl macroreader #$expr$ to expand maxima language expressions.

#$[2*x + y - z = 8, -3*x - y + 2*z = -11, -2*x + y + 2*z = -3]$

((MLIST SIMP)
 ((MEQUAL SIMP) ((MPLUS SIMP) ((MTIMES SIMP) 2 $X) $Y ((MTIMES SIMP) -1 $Z)) 8)
 ((MEQUAL SIMP)
  ((MPLUS SIMP) ((MTIMES SIMP) -3 $X) ((MTIMES SIMP) -1 $Y)
   ((MTIMES SIMP) 2 $Z))
  -11)
 ((MEQUAL SIMP) ((MPLUS SIMP) ((MTIMES SIMP) -2 $X) $Y ((MTIMES SIMP) 2 $Z))
  -3))

We should use function solve. It has name $solve in cl environment.

($solve #$[2*x + y - z = 8, -3*x - y + 2*z = -11, -2*x + y + 2*z = -3]$)

((MLIST) ((MLIST) ((MEQUAL) $Z -1) ((MEQUAL) $Y 3) ((MEQUAL) $X 2)))

Let's translate given AST to maxima expression (1d, 2d or latex, it depends on display2d option):

(displa '((MLIST) ((MLIST) ((MEQUAL) $Z -1) ((MEQUAL) $Y 3) ((MEQUAL) $X 2))))

[ [z = - 1, y = 3, x = 2] ]

Maxima and Common Lisp

Maxima documentation