Hacker News new | past | comments | ask | show | jobs | submit login
Maxima (Software) (wikipedia.org)
126 points by Tomte on Nov 20, 2021 | hide | past | favorite | 55 comments



I use this frequently for plotting planar vector fields: it is much better than Mathematica’s StreamPlot (which I am forced to use from time to time).

Also another colleague found out the hard way that maxima can happen to solve symbolic/arithmetic linear equations much faster (2 orders of magnitude) than Mathematica.

A great tool. A pity it is underestimated.


As a physics student, I often used maxima for assignments, because while I did have access to Mathematica on lab computers, having a CAS on my laptop was often more convenient. In general, it was able to do what I needed just as well as Mathematica, though with different syntax.


Ironic, considering that Stephen Wolfram insisted in the 80s that Lisp was 100x slower than C, and so a fast mathematics package could not be written in it.


He was wrong then and now, but the crucial speedup of Mathematica vs Maxima was difference in modeling of data and how Mathematica could piggy back on fortran libraries for numerical solving, while Maxima focused on symbolic solving.

This meant that for many cases where numerical method was beneficial, Mathematica easily won on speed.


The predecessor of Mathematica, Wolfram and Cole's SMP, was 10-100x faster than the best Lisp based symbolic math programs at the time on what Wolfram and Cole considered to be small to medium research physics problems. On large problems they were unable to compare because the Lisp based programs needed more memory than the VAX 11/780 at Caltech High Energy Physics had.


That's hilarious, because the Wolfram Language is actually quite lispy. Or, at least you can write it in a very lispy style.


It kind of literally is lisp. It's about the only implementation of M-expressions instead of S-expressions.

https://en.wikipedia.org/wiki/M-expression#Implementations


The way the whole language is implemented in terms of pattern matching and term rewriting is unlike any other language that I’ve seen. It does not seem quite like Lisp in that way.


Transforming patterns into other patterns is kind of Stephen Wolfram's _thing_. See his long term interest in cellular automata, and now even an attempt to discover the secrets of the universe through a theory of physics based (as far as I can tell from what I've read of it) entirely on pattern matching and rewriting: https://www.wolframphysics.org/.



Id say it is lisp, with a slight syntax difference


Now Wolfram Language uses LLVM framework for compilation. SBCL-compiled Maxima is also quite fast .


That's probably because Stephen Wolfram in the 80s knew little about Lisp. Chances are he still knows little about it today!


Which command do you use, and could you link an example?


No examples (home). Maxima: plotdf, Mathematica: Streamplot.

Sorry.


Thanks, that is enough info for me to proceed.


can you give an example instance? I'll test on both.


For the vector fields just anyone with a couple of singularities would work. The moment you set unequal axes Mathematica blows up.

Sorry but am home. If you mail me during the week I shall find examples for you.

The matrix was something I saw happen, I do not have the example handy, sorry.


The wx-maxima[1] is a good GUI for maxima. A very nice mature FLOSS symbolic math package. For derivatives, integrals, simplification and many other uses I don't think it is nowhere weaker than proprietary alternatives.

[1] https://wxmaxima-developers.github.io/wxmaxima/


WxMaxima (+Igor Pro) is what got me through my P Chem and QM courses in college. The joy of teaching yourself linear algebra because they forgot to list it as a course requirement. Luckily all you really need is rref.


  > Luckily all you really need is rref.
Tell us more. Please. I'm going through linear right now.


Transforming a linear matrix equation to Reduced Row Echelon Form (rref) [1] allows solving it very easily or writing a minimal set of variables in terms of others if you don't have enough independent equations or discovering that the set of equations is contradictory. You naturally arrive at this form if you were to do manual Gaussian Elimination, but linear algebra libraries have additional efficient ways to arrive at this depending on the structure of the matrix. So it's common to just ask the algebra system to get it there and then use the matrix either programmatically or by hand depending on what you're trying to do.

[1]: See https://en.wikipedia.org/wiki/Row_echelon_form


Terrific, thank you!


SMath is a nice mathcad like interface with Maxima support


Unfortunately my experience is that Maxima is unable to get even simple integrations right.

If I remember correctly the state of the documentation was subpar too.


I actually use maxima as a faster wolframalpha alternative. It doesn't look as polished but it gets the job done when solving or simplifying most equations.


Sagemath provides a python interface to maxima and uses it for some operations behind the scenes.


The Python interface with Maxima in Sage is pretty sophisticated in that it uses ECL (Embedded Common Lisp) to provide a high performance C level interface. The conversion code (for special functions, constants, etc.), is also nontrivial. Over the years we have tried to reduce the reliance on Maxima (eg for portability reasons) by instead seeing if we could use SymEngine or sympy or something else, but Maxima is pretty deep, eg it’s symbolic integration is still not easy to beat with sympy…


I'm more familiar with SymPy. How does it compare with Maxima? Does anyone have experience with both?


Being embedded in a nice modern programming language like Python, SymPy is definitely much easier to use, and I'd recommend that for most people. Maxima probably has some more advanced esoteric features I haven't needed, and may be faster for some things (but so might SymPy). I use Maxima in one situation: making online maths quiz questions in STACK [1], because Maxima is the CAS underlying it. I'd rather it used SymPy!

If you need more advanced stuff than SymPy, probably SageMath is the way to go - stay in ~Python, but use it as an interface to other systems (which include Maxima). I used to use Sage before SymPy was around and good.

[1] https://www.ed.ac.uk/maths/stack/


Common Lisp is a nice modern programming language, too. Only SymPy yet has to be ported into it...


If anything, Julia language would be a better fit[1] for the new mathematical system. Its syntax is friendlier to the mathematical constructs than of Python. Not to speak about the speed.

[1] https://juliasymbolics.org/


Maybe. Maybe not. From what I understand, experience shows that when conceptualizing knowledge in this domain, at some point you may run into the need for a MOP, which Julia to my knowledge doesn't have.


Maxima is implemented in Lisp, but is itself a separate language. SymPy is an ordinary Python library.


Yes, and it's a library that could be conceivably ported to Lisp. As Scmutils have shown, "lispy" languages with multimethods/generic functions are really suitable for building symbolic manipulation systems. So chances are that functional port to Lisp could provide a really nice interface to SymPy's functionality.


And Maxima was created before Common Lisp even existed. Steele first presented Common Lisp at a conference in 1982, and CLTL1 wasn't published until 1984.

As I recall, Maxima was first written for Franz Lisp. Older lisps like that used dynamic binding for all variables.


Uh, Macsyma was first written for Maclisp.


Yes. Perhaps I was drawing too fine a line in distinguishing Macsyma from Maxima.


I used Maxima for creating statistical models of hardware failure at work a while back.

I’d take the statistical models, use Maxima to symbolically find equations for estimators, and then write out the formulas in Python using NumPy / SciPy to solve the equations numerically. Without Maxima, the whole process would have involved more error-prone, tedious work on my part.

I like to pitch the model by saying it successfully predicted a data loss event before it happened, predicted where that data loss event would happen (which configuration would lose data), and gave us insight into how the system could be changed to prevent similar data loss events from happening. Maxima was a key tool in making the model.


Wow, sounds cool! Could you please share more details. What statistical model, and what estimators had to find? I have some theoretical statistical training, and I am under the assuming you can use MLE or some other estimator to find the parameter of a model.


There's a nice extension for MS Word that uses Maxima. WordMat https://github.com/Eduap-com/WordMat


As I recall, the style of Lisp code in Maxima is very old fashioned. We wouldn't write Common Lisp like that today.


i know common lisp can be called by a maxima program. can maxima be used as a library in common lisp ?


That's rather complicated because of its internal architecture. Also because Maxima is skewed towards interactive usage. Some of the routines need to ask you questions about the problem in the middle of the solution (things like "is a zero or non-zero?" and such). Perhaps such questions could be turned into conditions, though.


it would be cool if maxima could be used in such a way. similar to how sympy is used in python. i have a feeling it is definitely possible. maybe someone knows if any work on it has been done by some third party


There is this project, but it seems inactive and I'm not sure if it is usable or not: https://github.com/bld/embeddable-maxima

This blog post also shows how to call Maxima from CL: https://niitsuma.hatenadiary.org/entry/20080328/1226706399


cheers thank you


It says that Maxima also has its own programming language (written in Lisp). Any opinions on it good or bad?


It's more like Maxima is a programming language. Its syntax is weird, archaic, and clunky, and different from anything else you've ever used for no reason except that it dates back to 1968, before C, before Pascal. Assignment uses ":", blocks of statements use "(" and ")", etc. Aside from the syntax, its features are mostly pretty basic and standard, and apart from mathematics quite limited.


> Its syntax is weird, archaic, and clunky,

Maybe if you come from a CS background. From a math background, it's syntax is actually more natural than most contemporary programming languages. For example, : is used for assignment, because = has the normal mathematical meaning. Blocks use parentheses because that's how you group stuff in math.

Maxima is very much a domain specific language, where the domain is mathematics.


I come from a maths background, and I disagree. Maths would more likely use ":=" for mutating assignment, not ":", which I've never seen. I also don't think I've ever seen a sequence of steps in maths denoted by parentheses. More commonly they're in a numbered list. 1960's ALGOL-60 used ":=" for assignment and "begin" and "end" for blocks.


I've seen := become standard in math to mean definition, not mutating assignment.


In fairness, "predates every other option you might compare it to" really is a good excuse.


It’s a rather plain language. Nothing too special about it. Has functions, variables, assignment, loops, and a few other rudiments.


It's been a few years since I used Maxima, which was at university but without much introduction to the language. The dynamic scoping was a particularly unpleasant surprise, lexical scoping was not available which lead to buggy behaviour. I returned to the warm embrace of Mathematica fairly quickly.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: