For some reason, this lispcode does not work on my system. I
was using maxima 5.13 with sbcl, the lisp below failed to
load.
I just upgraded to the latest debian package.
maxima 5.15.0, GCL 2.6.7
Now the code loads silently, but calls to conj_to_abs fail
(%i1) load("conj_to_abs.lisp");
(\%o1) \verb|conj_to_abs.lisp|
(%i2) declare([x,y,z],complex)$
(%i3) conj_to_abs(x * conjugate(5*x));
Maxima encountered a Lisp error:
Error in LISP:LAMBDA-CLOSURE [or a callee]: The variable ? is unbound.
---------------
> ;; start of file conjugate_to_abs.lisp ------------
>
> (mfuncall '$declare 'non-simp-conjugate '$additive)
> (mfuncall '$declare 'non-simp-conjugate '$multiplicative)
>
> (defmspec $conj_to_abs (e)
> (setq e ($substitute 'non-simp-conjugate '$conjugate (cadr e)))
> ($substitute '$conjugate 'non-simp-conjugate (conj-to-abs e e)))
>
> (defun conj-to-abs (e p)
> (cond ((or ($mapatom e) ($mapatom p)) e)
>
> ((and (not ($mapatom p)) (eq (mop p) 'non-simp-conjugate))
> (setq p (cadr p))
> ($ratsubst (power (take '($cabs) p) 2) (mul p (take '(non-simp-conjugate)
> p)) e))
>
> (t
> (mapcar #'(lambda (s) (setq e (conj-to-abs e s))) (cdr p))
> e)))
>
> ;; end of file conjugate_to_abs.lisp ------------