[Maxima] common lisp complex numbers, also common lisp rational numbers
hbaker1 at pipeline.com
Thu Mar 1 13:07:30 CST 2012
While Maxima may be _written_ in Common Lisp, it is not an _extension_ of Common Lisp.
Now it might be a good idea to first _extend_ Common Lisp with Maxima data types, and only then interpret/compile the Maxima language in this extended language.
If you wanted to do this cleanly, you probably want to implement Maxima data types in CLOS (object-oriented language for Common Lisp). This is because CLOS has full generic functions, so it is easy to add new datatypes to an already existing function. In a compiled language like C++, this notion is called "overloading"; CLOS allows overloading for _any_ generic function, not just for +,-,*,/,^, etc.
At 10:20 AM 3/1/2012, Stavros Macrakis wrote:
>I wouldn't say that "the intermixing of Maxima rationals and CL rationals has bugs", but simply that "CL rationals and complexes are not supported as part of Maxima expressions". As far as I know, there has been no systematic effort to change this.
>On Thu, Mar 1, 2012 at 13:17, Richard Fateman <fateman at eecs.berkeley.edu> wrote:
>sometimes these may come up, from lisp routines. Or you can create them in maxima
> A: ?complex(1,2)
>Should numberp(A) return true? (it doesn't).
>It is certainly a tricky situation to deal with, generally... should
>a complex constant like 1+2*%i be stored in common lisp as #c(1 2)...
>which has various positive aspects, mostly having to do with numerics.
> but has the negative aspects that
>1. the re and im parts must be lisp number constants and that excludes bigfloats.
>2. it also excludes symbolic re and im parts.
>I think numberp(A) should return true if ?numberp(A) returns true [it does]..
>that is, every common lisp number should be a number to Maxima as well.
>Oh, CL rational numbers might also be allowed as Maxima numbers too.
>Here's a confusing situation...
>:lisp (setf $aa 1/2)
>So the intermixing of Maxima rationals and CL rationals has bugs.
>But we knew this.
More information about the Maxima