Noticing when SageMath is using IPython, instead of Maxima.

One of the subjects of my recent postings, has been a Computer Algebra System called “SageMath”, which I was able to install on my Debian / Stretch (Debian 9) computer named ‘Plato’. One of the distinctions which I left slightly blurred about this, is the distinction between Computer Algebra, and Numerical Tools. The former refers to the ability of a computer to manipulate symbols, in the way Algebra manipulates them, but to solve equations which Humans might just find tedious or too time-consuming to solve. This can lead to answers that are theoretically exact, but which can sometimes be useless because the numerical equivalent is only available indirectly.

Numerical Tools are more numerous under Linux, and offer theoretically inexact solutions to equations, simply because the numerical answers have a limited number of decimal places after the point or comma. Yet, the numerical answers can sometimes be much more useful than Algebraic answers, for reasons that I think are self-explanatory.

SageMath offers both. In order to do Algebra, SageMath uses “Maxima” as its back-end. And under Debian Linux, installing SageMath actually installs a separate version of Maxima, which users are not supposed to use directly.

So how can a user tell, that SageMath is performing work for him or her, which was not already provided by Maxima? Well, whenever a solution to a problem is being invoked using the ‘solve()’ function, SageMath is invoking Maxima in the background. OTOH, if the expression which SageMath is supposed to evaluate has the ‘Object.function()’ format, SageMath is using its specialized Python-based numerical tools. Two examples I recently used were:

F1(x).roots(x, ring=CC, multiplicities=False)


Further, Maxima is a separate object available in SageMath, called ‘maxima’. Hence, the following is an explicit command to SageMath, to tell Maxima to evaluate a Sage Object:


So these examples answer the question posed in the title of this posting.



I have an additional observation to offer about invoking Maxima from within SageMath. Sometimes Maxima can only solve certain types of problems, when explicitly told to load optional modules. Thus, within a Maxima, or within a “wxMaxima” session, the following command will first load a module:


After which to give the command ‘solve();’ will use that module. This has sometimes actually struck me as impractical. ‘to_poly_solve’ is supposed to allow certain convoluted equations to be solved, that are not default, and which include the (Algebraic) ‘LambertW()’ function. Within Maxima, in some cases I find that the command must be preceded by an underscore actually to work, and if it is, it doesn’t produce output that can be reused elsewhere within the same session:

_solve(x^x == 7, x);

When trying to accomplish the same goal within SageMath, this module can be used to solve one equation, like this:

solve(x^x == 7, x, to_poly_solve=True)

Similarly, the ‘Groebner Basis’ Module can be loaded in the same way because modern Maxima distributions offer it, with either:


Or with:

solve(… , grobner=True)




Print Friendly, PDF & Email

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>