Re: beginner’s question with Maxi ma

Robert Dodier <[email protected]>
Newsgroups gmane.comp.mathematics.maxima.general
Message-ID <CAAsY_sSLOCPrqcdAAzQGw=8qSjXjgt7kqk13EmBFD4+Gmj64ww@mail.gmail.com>
On Tue, Aug 25, 2026 at 6:21 PM <[email protected]> wrote:

> I’d used backslashes because they seemed to be necessary when entering a multi-line function interactively; I didn’t know that they wouldn’t be needed in a .mac file.

Well, backslash isn't needed for Maxima code, whether it's at the
interactive prompt or in a file; the parser just keeps reading until
it find a terminator (semicolon or dollar sign). Perhaps you were
working with Lisp code as prefixed by :lisp ? If so, the input needs
to be all on one line, so I guess backslash would be necessary for
multi-line input. For multi-line Lisp inputs, consider the function
to_lisp() which opens a prompt at which the user can type in
multi-line Lisp programs. (to-maxima) returns to the usual Maxima
prompt.

> Have you used, or tried to use, both the ezunits package and the unit package? Perhaps I’m missing something regarding the unit package, but judging from the Maxima manual, its main purpose seems to be in providing unit conversion factors rather than to perform calculations with units.

unit and ezunits have somewhat different philosophies. unit has a
notion of a preferred unit system (such as meter-kilogram-second or
centimeter-gram-second) and all units are converted to that system
automatically. unit represents dimensional expressions as ordinary
multiplicative expressions and has some machinery invoked by the 2-d
pretty printer to pull symbols representing units to the right and
everything else to the left.

On the other hand, ezunits does not have a preferred system, and does
not automatically convert units. That is intended to make it
convenient to work with non-standard unit systems which are prevalent
in at least one country. Also, dimensional expressions are represented
by an operator (back tick, `) with two arguments, quantity and units.
That makes internal operations a lot simpler, and also accommodates
otherwise-unknown and undeclared units, e.g. 100 ` cow, 10 ` horse, 2
` goat.

Whether one or other is preferable depends on what one wants to do. If
one is working strictly in mks or cgs, it would make sense to prefer
unit. I myself use ezunits a lot because I'm often working in other
measurement systems. Disclaimer: I wrote the ezunits package.

unit is a little bit out of date because it defines modified versions
of a few built-in Lisp functions; there isn't a really good way to
simply extend a Lisp function, short of redefining it. The base
versions of the modified functions are pretty old, it would be great
to bring them up to date.

There is still another package, named units (in contrast to unit).
units just defines a number of conversion constants to get mks from
various other units.

Hope this helps,

Robert


_______________________________________________
Maxima-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maxima-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.