News for hackers. Stuff that matters.
Re:Maxima (Software) by pfortuny on Saturday November 20, 2021 @04:07PM (#29291852)
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.

Re:Maxima (Software) by thayne on Saturday November 20, 2021 @11:22PM (#29294168)
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.
Re:Maxima (Software) by bitwize on Saturday November 20, 2021 @05:49PM (#29292522)
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.
Re:Maxima (Software) by p_l on Saturday November 20, 2021 @05:55PM (#29292556)
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.

Re:Maxima (Software) by tzs on Sunday November 21, 2021 @01:20AM (#29294566)
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.
Re:Maxima (Software) by actually_a_dog on Saturday November 20, 2021 @06:35PM (#29292788)
That's hilarious, because the Wolfram Language is actually quite lispy. Or, at least you can write it in a very lispy style.
Re:Maxima (Software) by jordigh on Saturday November 20, 2021 @10:07PM (#29293838)
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

Re:Maxima (Software) by etaioinshrdlu on Saturday November 20, 2021 @11:47PM (#29294255)
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.
Re:Maxima (Software) by jeffparsons on Sunday November 21, 2021 @06:45AM (#29295668)
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/.
Re:Maxima (Software) by User23 on Saturday November 20, 2021 @07:44PM (#29293128)
Re:Maxima (Software) by djsbs on Saturday November 20, 2021 @09:23PM (#29293633)
Id say it is lisp, with a slight syntax difference
Re:Maxima (Software) by xvilka on Saturday November 20, 2021 @09:49PM (#29293760)
Now Wolfram Language uses LLVM framework for compilation. SBCL-compiled Maxima is also quite fast .
Re:Maxima (Software) by jhgb on Saturday November 20, 2021 @11:08PM (#29294121)
That's probably because Stephen Wolfram in the 80s knew little about Lisp. Chances are he still knows little about it today!
Re:Maxima (Software) by andi999 on Sunday November 21, 2021 @05:57AM (#29295413)
Which command do you use, and could you link an example?
Re:Maxima (Software) by pfortuny on Sunday November 21, 2021 @02:39PM (#29299018)
No examples (home). Maxima: plotdf, Mathematica: Streamplot.

Sorry.

Re:Maxima (Software) by andi999 on Monday November 22, 2021 @10:37AM (#29307495)
Thanks, that is enough info for me to proceed.
Re:Maxima (Software) by tubby12345 on Saturday November 20, 2021 @06:09PM (#29292626)
can you give an example instance? I'll test on both.
Re:Maxima (Software) by pfortuny on Sunday November 21, 2021 @03:28AM (#29294956)
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.

Re:Maxima (Software) by marcodiego on Saturday November 20, 2021 @04:35PM (#29292061)
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/

Re:Maxima (Software) by BeFlatXIII on Saturday November 20, 2021 @09:11PM (#29293574)
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.
Re:Maxima (Software) by dotancohen on Sunday November 21, 2021 @04:10AM (#29295085)

  > Luckily all you really need is rref.
Tell us more. Please. I'm going through linear right now.
Re:Maxima (Software) by marcianx on Sunday November 21, 2021 @09:01AM (#29296264)
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

Re:Maxima (Software) by dotancohen on Sunday November 21, 2021 @10:27AM (#29296822)
Terrific, thank you!
Re:Maxima (Software) by riedel on Saturday November 20, 2021 @04:41PM (#29292107)
SMath is a nice mathcad like interface with Maxima support
Re:Maxima (Software) by turlando on Sunday November 21, 2021 @10:54AM (#29297093)
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.

Re:Maxima (Software) by bruce343434 on Saturday November 20, 2021 @03:59PM (#29291790)
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.
Re:Maxima (Software) by tkuraku on Saturday November 20, 2021 @07:14PM (#29292990)
Sagemath provides a python interface to maxima and uses it for some operations behind the scenes.
Re:Maxima (Software) by williamstein on Saturday November 20, 2021 @11:25PM (#29294183)
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…
Re:Maxima (Software) by Qem on Saturday November 20, 2021 @08:33PM (#29293407)
I'm more familiar with SymPy. How does it compare with Maxima? Does anyone have experience with both?
Re:Maxima (Software) by mkl on Saturday November 20, 2021 @08:43PM (#29293454)
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/

Re:Maxima (Software) by jhgb on Saturday November 20, 2021 @11:13PM (#29294145)
Common Lisp is a nice modern programming language, too. Only SymPy yet has to be ported into it...
Re:Maxima (Software) by xvilka on Sunday November 21, 2021 @07:01AM (#29295750)
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/

Re:Maxima (Software) by jhgb on Sunday November 21, 2021 @02:43PM (#29299045)
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.
Re:Maxima (Software) by mkl on Sunday November 21, 2021 @12:58AM (#29294499)
Maxima is implemented in Lisp, but is itself a separate language. SymPy is an ordinary Python library.
Re:Maxima (Software) by jhgb on Sunday November 21, 2021 @01:18AM (#29294558)
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.
Re:Maxima (Software) by pfdietz on Sunday November 21, 2021 @03:57PM (#29299641)
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.

Re:Maxima (Software) by jhgb on Sunday November 21, 2021 @04:32PM (#29299952)
Uh, Macsyma was first written for Maclisp.
Re:Maxima (Software) by pfdietz on Sunday November 21, 2021 @04:44PM (#29300051)
Yes. Perhaps I was drawing too fine a line in distinguishing Macsyma from Maxima.
Re:Maxima (Software) by dietrichepp on Sunday November 21, 2021 @10:14AM (#29296707)
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.

Re:Maxima (Software) by iamcreasy on Sunday November 21, 2021 @07:29PM (#29301265)
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.
Re:Maxima (Software) by a0-prw on Saturday November 20, 2021 @11:47PM (#29294256)
There's a nice extension for MS Word that uses Maxima. WordMat https://github.com/Eduap-com/WordMat
Re:Maxima (Software) by pfdietz on Saturday November 20, 2021 @06:33PM (#29292770)
As I recall, the style of Lisp code in Maxima is very old fashioned. We wouldn't write Common Lisp like that today.
Re:Maxima (Software) by medo-bear on Saturday November 20, 2021 @08:24PM (#29293353)
i know common lisp can be called by a maxima program. can maxima be used as a library in common lisp ?
Re:Maxima (Software) by jhgb on Saturday November 20, 2021 @11:12PM (#29294137)
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.
Re:Maxima (Software) by medo-bear on Sunday November 21, 2021 @03:01AM (#29294859)
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
Re:Maxima (Software) by nbernard on Sunday November 21, 2021 @03:59AM (#29295054)
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

Re:Maxima (Software) by medo-bear on Sunday November 21, 2021 @04:05AM (#29295071)
cheers thank you
Re:Maxima (Software) by etaioinshrdlu on Saturday November 20, 2021 @04:15PM (#29291905)
It says that Maxima also has its own programming language (written in Lisp). Any opinions on it good or bad?
Re:Maxima (Software) by mkl on Saturday November 20, 2021 @05:52PM (#29292541)
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.
Re:Maxima (Software) by thayne on Saturday November 20, 2021 @11:31PM (#29294200)
> 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.

Re:Maxima (Software) by mkl on Sunday November 21, 2021 @12:53AM (#29294484)
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.
Re:Maxima (Software) by pfdietz on Sunday November 21, 2021 @03:59PM (#29299658)
I've seen := become standard in math to mean definition, not mutating assignment.
Re:Maxima (Software) by yjftsjthsd-h on Saturday November 20, 2021 @06:50PM (#29292882)
In fairness, "predates every other option you might compare it to" really is a good excuse.
Re:Maxima (Software) by reikonomusha on Saturday November 20, 2021 @04:34PM (#29292054)
It’s a rather plain language. Nothing too special about it. Has functions, variables, assignment, loops, and a few other rudiments.
Re:Maxima (Software) by rexpress on Saturday November 20, 2021 @04:57PM (#29292220)
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.