[HN Gopher] Maxima: A computer algebra system written in Common ...
       ___________________________________________________________________
        
       Maxima: A computer algebra system written in Common Lisp
        
       Author : ducktective
       Score  : 246 points
       Date   : 2023-02-06 08:26 UTC (14 hours ago)
        
 (HTM) web link (maxima.sourceforge.io)
 (TXT) w3m dump (maxima.sourceforge.io)
        
       | 2b3a51 wrote:
       | Reduce is another lisp based computer algebra system from the
       | prehistoric times, now open sourced.
       | 
       | https://en.wikipedia.org/wiki/Reduce_(computer_algebra_syste...
       | 
       | https://reduce-algebra.sourceforge.io/
       | 
       | I paid money for a Reduce release for RISCOS back in the last ice
       | age. I recollect having to register my licence with the Rand
       | Corporation for some reason.
        
       | donkeybeer wrote:
       | Plus points:
       | 
       | Does not suffer from the time limits of free wolfram and the nlp
       | parsing issues in general with wolfram
       | 
       | Negative points:
       | 
       | Somewhat more limited repertoire, and things sometimes need to be
       | rephrased or rearranged to trick an answer out of it.
        
         | pfortuny wrote:
         | Surprisingly, the command to plot solutions of odes is much
         | better and more interactive than Mathematica's despite the
         | interface being "uglier".
        
           | donkeybeer wrote:
           | It uses gnuplot I think as its frontend. Gnuplot is quite
           | powerful if you understand it and can trick it correctly.
           | 
           | Regarding the interface being ugly it kinda also depends on
           | which graphical frontend gnuplot is using, there are
           | multiple. I like the Qt one.
        
             | srott2 wrote:
             | nothing beats emacs & maxima-mode
             | 
             | https://community.linuxmint.com/img/screenshots/maxima-
             | emacs...
        
               | luispauloml wrote:
               | Except when it doesn't work. I tried using it a few
               | months ago on both Windows and WSL, but I had to give up
               | and resort to run a Maxima kernel on EIN.1
               | 
               | I was going to try again before commenting, but I broke
               | my WSL setup last week and didn't have time to fix it
               | yet, but I sure will try it again next month.
               | 
               | 1 http://millejoh.github.io/emacs-ipython-notebook/
        
         | bmitc wrote:
         | Interesting. I just downloaded Maxima on Android and also
         | WolframAlpha. Three latter is light years ahead.
        
           | japanman425 wrote:
           | Well there's a surprise
        
           | phkahler wrote:
           | Does it even run locally?
        
       | bar94 wrote:
       | How does Maxima compare to something like Xcas[1]?
       | 
       | [1]: https://www-fourier.ujf-grenoble.fr/~parisse/giac.html
        
         | bloaf wrote:
         | https://www.12000.org/my_notes/CAS_integration_tests/reports...
         | 
         | Giac/Xcas is slightly worse at symbolic integration than
         | Maxima, and both are _dramatically_ worse than Mathematica.
         | 
         | FriCAS, an Axiom fork, is the best open source CAS on those
         | benchmarks.
        
       | college_physics wrote:
       | Ahh, the macsyma days. You could do _real_ tensor calculus with
       | it.
        
         | immmmmm wrote:
         | Cadabra does that extremely well:
         | 
         | https://cadabra.science/notebooks/tensor_monomials.html
         | 
         | did publish an article with a Lagrangian of order 40 in the
         | fields with it. 10k pages of calculations.
        
           | college_physics wrote:
           | ahh, yes indeed, it can do GR tensors too [0]
           | 
           | can't believe somebody wrote this in C/C++!
           | 
           | [0] https://arxiv.org/abs/1912.08839
        
             | kpeeters wrote:
             | Cadabra author here. The choice for C++ was intentional and
             | is part of the design to separate the maths language
             | (LaTeX), programming language (python) and implementation
             | language (C++). This has advantages (eg. notation looks
             | natural for mathematicians/physicists, programming the
             | system uses a language already familiar to many, and it can
             | still run algorithms at C++ speeds) and disadvantages (eg.
             | some things become much more involved to implement). As
             | always, it depends a lot on what you do with the system
             | whether this is good or bad. Cadabra is not for everyone,
             | but it does some things much nicer (IMHO) than other CAS
             | systems.
        
               | college_physics wrote:
               | its an intriguing combination of languages and maybe one
               | that would serve well other projects. Combining python
               | and C++ is clearly common, but expressing algorithms /
               | expressions as latex hits another sweet spot.
               | 
               | Makes sense to have a performant "backend". My experience
               | with macsyma is, ahem, _quite_ a bit dated, but I still
               | remember it would choke on large calculations and needed
               | careful massaging of intermediate steps.
        
       | Qem wrote:
       | How does it compare to SymPy?
        
         | heisig wrote:
         | Maxima is a surprisingly good alternative to SymPy. We had to
         | learn that the hard way at my job. Both systems offer similar
         | functionality, but it turns out Maxima is typically 50-200x as
         | fast as SymPy for many tasks (I guess because it was written at
         | a time when computers were slow and expensive). For our
         | application, switching from SymPy to Maxima shortened the time-
         | to-solution from hours to minutes.
         | 
         | Also, it shows that Maxima has been in use for a very long
         | time, and maintained by very bright people. I have yet to
         | encounter a bug in Maxima. And I have already encountered
         | plenty of bugs and inconsistent behavior in SymPy.
        
           | defrost wrote:
           | Maxima sees serious 'more free' versions of computational
           | algorithms that migrate out from less free acedemic systems.
           | 
           | On the computational real actual algebra side (ie. a bit past
           | computing a quadractic at 'x') a number of things that appear
           | in Magma follow into Maxima (but not all the things, although
           | with time they will come).
           | 
           | https://en.wikipedia.org/wiki/Hidden_Field_Equations
           | 
           | https://en.wikipedia.org/wiki/Gr%C3%B6bner_basis
           | The first HFE cryptosystem challenge of J. Patarin is solved
           | by Magma in 82.5 seconds, using 1.3GB memory; with 4 threads
           | the time taken is just 29.0 seconds. This involves solving a
           | system of 80 quadratic equations in 80 variables over GF(2)
           | (each input polynomial has about 1600 terms). The challenge
           | was first solved by J.-C. Faugere in 52 hours on an 1GHz
           | Alpha in 2002 using his unpublished F5/2 algorithm. At the
           | time of writing, there is apparently still no publically-
           | available software besides Magma which can solve the
           | challenge.
           | 
           | http://magma.maths.usyd.edu.au/magma/overview/2/27/13/#subsu.
           | ..
           | 
           | https://maxima.sourceforge.io/docs/manual/maxima_257.html
           | Notes on the grobner package: The code is a little bit out of
           | date now. Modern implementation use the fast F4 algorithm
           | described in "A new efficient algorithm for computing Grobner
           | bases (F4)" Jean-Charles Faugere
           | 
           | ( *NB a somewhat old example, I'm not keeping up on the
           | comp.algebra lists and I'm assuming here the online manuals
           | are up to date )
        
         | mkl wrote:
         | If you need programmability or interoperability, Sympy is way
         | nicer. If you just want an interactive symbolic calculator,
         | Maxima is fine but sometimes quirky (has odd conventions due
         | mainly to its age). As heisig points out, Maxima can be quite a
         | bit faster (but I run into slow things with it too). Using
         | Maxima via Sage is in some ways the best of both worlds.
         | 
         | You may also be interested in SymEngine:
         | https://github.com/symengine/symengine
        
         | forgotpwd16 wrote:
         | Can check: https://github.com/sympy/sympy/wiki/SymPy-vs.-Maxima
        
         | bloaf wrote:
         | It is better at symbolic integration:
         | 
         | https://www.12000.org/my_notes/CAS_integration_tests/reports...
        
       | bakhy wrote:
       | It's also available as an Android app, MaximaOnAndroid. I love
       | having it on my phone, even though I rarely actually use it :)
        
         | thaumasiotes wrote:
         | > I love having it on my phone, even though I rarely actually
         | use it
         | 
         | I understand.
        
       | tgv wrote:
       | Quick note to avoid disappointment: maxima itself is a text
       | application. wxMaxima is a graphical front-end with conventional
       | math notation. Output only. You'll frequently encounter
       | text/command-line options, though. E.g., when you pick a command
       | like differentiate from the menu, and you want to apply it to the
       | previous result, you'll have to enter something like %o10 (no
       | need to guess; you'll see the reference in the output). Idk if
       | there's a better GUI.
        
         | zem wrote:
         | there's a texmacs frontend too:
         | http://www.texmacs.org/tmweb/documents/tutorials/maxima-tuto...
        
           | pxc wrote:
           | In college, I used to use Maxima with KDE's Cantor as a
           | frontend.
           | 
           | https://cantor.kde.org/
        
           | goosedragons wrote:
           | There's also imaxima a mode for Emacs that will format the
           | output as rendered LaTeX.
        
             | sbaiddn wrote:
             | Does that still work or is it abandoned? Do you know how to
             | install it on doomemacs (I'm not an emacs or doomacs guru)
        
               | sasanidas wrote:
               | There is also maxima.el in MELPA
               | https://melpa.org/#/maxima
        
               | goosedragons wrote:
               | It does still work! Not sure if actively maintained
               | though...
               | 
               | I think the process is a bit different depending on your
               | OS. On Linux it's often bundled as a package for example
               | on Ubuntu it's called maxima-emacs. I only use pretty
               | vanilla Emacs so I'm not sure how that would interact
               | with Doomemacs. You could try the manual install
               | directions from the page perhaps [0].
               | 
               | [0] https://sites.google.com/site/imaximaimath/tutorial-
               | of-imaxi...
        
         | anthk wrote:
         | rlwrap maxima. Use your Emacs keybindings from the shell
         | (actually, readline) into it.
        
           | msla wrote:
           | imaxima is a Maxima mode for Emacs which renders equations in
           | the Emacs buffer:
           | 
           | https://sites.google.com/site/imaximaimath/
           | 
           | > Imaxima provides a graphical user interface front-end for
           | the computer algebra system Maxima in an Emacs buffer.
           | Imaxima processes the output from Maxima with LaTeX to
           | beautifully render the mathematical formula. It inserts the
           | rendered math formula image in the buffer.
        
         | curling_grad wrote:
         | Sagemath uses maxima internally, so Jupyter notebook backed by
         | Sagemath kernel might be useful?
        
           | chongli wrote:
           | What is Sagemath then? I have used it many times and I
           | assumed it was a CAS alternative to Maxima. Is it actually
           | just a big library built on top of Maxima? Sort of like how
           | LaTeX is a library on top of TeX?
        
             | meltyness wrote:
             | In this case, Sagemath contains a domain that interfaces
             | heavily with Maxima.
             | 
             | By default Symbolic Calculus, which is a pretty common use-
             | case since the space of integral-tables is huge and
             | complicated, makes pretty heavy use of calls to Maxima as a
             | backend, but it can slip over to SymPy, and some others
             | pretty easily.
             | 
             | Sagemath is, a little rough to use as a novice-y math guy,
             | really quirky especially since Python isn't as up-front
             | with typing as I would like, and I've run into some lazy-
             | evaluation confusion as well, but if your time is
             | worthless, use-case restricted it can be an alternative to
             | paying out the nose for Mathematica.
        
               | chongli wrote:
               | _Sagemath is, a little rough to use as a novice-y math
               | guy_
               | 
               | Yeah I mainly used it in my real analysis, complex
               | analysis, and differential geometry classes. Also used it
               | a bit in an intro cryptography class to play around with
               | some rings and solve assignment problems.
               | 
               | I'm using Python right now in a neural networks class and
               | I hate it. It's absolutely horrible to debug. You press
               | run and then your neural network starts training and then
               | craps out with divide-by-0 after a long time and no clue
               | as to where the offending code might be.
        
               | curling_grad wrote:
               | While I generally agree with you, but I'd like to point
               | out that Sagemath is more than a "Mathematica
               | alternative". It seems like Sagemath is a better fit for
               | some fields like cryptography, given its strong support
               | for operations related to abstract algebra.
        
             | soegaard wrote:
             | Sagemath used a collection of libraries.
             | 
             | From the front page:
             | 
             | > SageMath is a free open-source mathematics software
             | system licensed under the GPL. It builds on top of many
             | existing open-source packages: NumPy, SciPy, matplotlib,
             | Sympy, Maxima, GAP, FLINT, R and many more. Access their
             | combined power through a common, Python-based language or
             | directly via interfaces or wrappers.
             | 
             | For once "many more" really means "many more".
        
         | japanuspus wrote:
         | An alternative is to run maxima from jupyter:
         | https://github.com/robert-dodier/maxima-jupyter.
        
           | saboot wrote:
           | Wow! This is fantastic! I got really frustrated with maxima
           | frontends and just ended up sticking with Mathematica, but
           | I'm going to give this a shot
        
       | medo-bear wrote:
       | with a bit of elbow greece you can also integrate it with your
       | common lisp application. and i mean this entirely, not just in an
       | api sense
        
         | gjvc wrote:
         | GREASE
        
           | medo-bear wrote:
           | ela re
        
         | nbernard wrote:
         | Do you have any reference/tutorial on how to do this?
        
           | medo-bear wrote:
           | https://github.com/jmbr/maxima-interface
        
       | pdonis wrote:
       | I use Maxima's GRTensor package for GR computations, such as
       | computing the Einstein tensor of a metric. This only involves
       | differential equations with real-valued functions, so it would
       | not trigger the complex number issues that are described in the
       | article.
        
       | anthk wrote:
       | If Maxima doesn't suit you, Yacas has a both a cli and QT
       | interfaces akin to Maxima's design, and both output to Gnuplot.
        
       | kbk wrote:
       | I like maxima and used to use it (through the interface wxmaxima
       | or KDE Cantor) for solving my physics problem. I am no expert in
       | CAS, just use them for simple problem solving.
       | 
       | However, since I stumbled upon this blog post by Thingwy
       | https://thingwy.blogspot.com/2015/07/maxima-versus-mathemati...,
       | I find myself uneasy when using maxima. I quote Thingwy:
       | "Maxima gets elementary math wrong, it knows very little about
       | integration, it is weak on simplifying expressions, it fails on
       | trivial equations, it is slow, Maxima usage is discouraged by CAS
       | power users. In summary: do not go and waist your time or wreck
       | your nerves using Maxima. JUST DON'T DO IT"
       | 
       | Since this was in 2015, I want to know the situation now, and the
       | comments of experts on the issues raised by the blog poste.
       | 
       | (Excuse my bad English)
        
         | camel-cdr wrote:
         | > it knows very little about integration
         | 
         | Somewhat related: I've read before that the FOSS CAS Axiom has
         | the only kinda complete implementation of the Risch algorithm
         | for integration. Axiom looks harder to use, but maybe it's an
         | option.
         | 
         | (I don't know anything about the topic)
        
           | AlotOfReading wrote:
           | The axiom implementation isn't complete either and doesn't
           | handle mixed algebraic transcendental functions like
           | sqrt(atan(x)), from what I understand.
           | 
           | The Sympy implementation handles the purely transcendental
           | case and does best effort on the algebraic extensions. It's a
           | lot more ergonomic than fricas/axiom though.
        
         | fiddlerwoaroof wrote:
         | I'm a bit suspicious of the section saying "Maxima is slow"
         | blaming linked lists. Maxima is built on Common Lisp which
         | definitely has arrays and vectors, so the claims made there
         | seem a bit uninformed. I don't really know enough math to judge
         | the rest, though.
        
           | [deleted]
        
           | gus_massa wrote:
           | I'm extremely suspicious of that explanation. It would be
           | nice to see a few benchmarks.
           | 
           | Anectote time: I used Mathematica many years ago. One
           | surprising thing was that when you update the content of a
           | vector, Mathematica creates a new vector and copies the
           | content of the old vector. If you just copy an algorithm from
           | C to Mathematica, it may be N times slower because it's
           | creating a lot of intermediate vectors. So you must rewrite
           | your code using "fold", or something like that. It was a long
           | time ago, so I'm not sure if they have already added some
           | trick to optimize code from people like me that don't know
           | what they are doing. If Mathematica or Maxima has this trick
           | but the other doesn't, it may cause a huge difference of time
           | between algorithm that look very similar. Anyway, this is
           | totally unrelated to lists.
        
         | forgotpwd16 wrote:
         | Checked the examples and Maxima still fails. It's even more
         | disheartening that author mentions towards the end that had
         | reported those issues years before they wrote the article. I
         | had also used Maxima before and, though unsurprisingly found it
         | less polished than Mathematica, got the job done without
         | issues. But will probably refrain from recommending it. Would
         | also like to see how other systems tackle those examples.
        
           | j_mo wrote:
           | My university course uses Maxima for optimization modules and
           | essentially none of the examples from the textbook work as
           | they should. Official documentation is sparse and often
           | unhelpful too. The functions output Lisp stacktraces if you
           | do something wrong, rather than actually catching errors and
           | printing some human-friendly message that describes the
           | problem and which particular argument caused it without
           | having to dig into Maxima source code. It would be great CAS
           | software if it was a bit more polished, but unfortunately
           | that is unlikely to ever change - it hasn't in the last 4
           | years that I've used it at least.
        
           | extremeadin wrote:
           | I checked the failing limt one and it worked fine. Maybe it
           | was fixed recently?                 ;;; Loading
           | #P"/usr/lib/ecl-21.2.1/sb-bsd-sockets.fas"       ;;; Loading
           | #P"/usr/lib/ecl-21.2.1/sockets.fas"       Maxima 5.46.0
           | https://maxima.sourceforge.io       using Lisp ECL 21.2.1
           | Distributed under the GNU Public License. See the file
           | COPYING.       Dedicated to the memory of William Schelter.
           | The function bug_report() provides bug reporting information.
           | (%i1) declare(a,real);       (%o1)
           | done       (%i2) declare(b,real);       (%o2)
           | done       (%i3) assume(a>b,b>0);       (%o3)
           | [a > b, b > 0]       (%i4) limit(log(b-a+%i*eta),eta,0,plus);
           | (%o4)                         log(a - b) + %i %pi       (%i5)
           | limit(log(b-a+%i*eta),eta,0,minus);       (%o5)
           | log(a - b) - %i %pi
        
             | forgotpwd16 wrote:
             | Version I've installed is 5.45.1 and gets "log(b - a) + %i
             | %pi" and "log(b - a) - %i %pi", so should be. Gave
             | changelog for 5.46.0 a look but not sure whether it had a
             | direct fix for this or was indirectly fixed due to one of
             | the other closed bugs.
        
         | [deleted]
        
       | boronine wrote:
       | Maxima enabled me to make my color space
       | [HSLuv](https://www.hsluv.org/). I encoded CIELUV <-> RGB
       | transformation functions into Maxima, ran `solve` and converted
       | the output back into code. It's great to be able to commit
       | [Maxima code](https://github.com/hsluv/hsluv/tree/master/math)
       | into your repository and not leave the math as an "exercise to
       | the reader".
        
         | db48x wrote:
         | That's a really nice way to do it. Also, I really like HSVLuv;
         | it's a really nice idea.
        
       ___________________________________________________________________
       (page generated 2023-02-06 23:01 UTC)