Sage Beginner’s Guide: Code and Errata

Sage is a free open-source mathematics software system.  It’s a GPL alternative to commercial software such as Magma, Maple, Mathematica and MATLAB.  Sage is a research-grade tool, cited in nearly 100 academic research articles (with dozens more in press).
I’ve written a book to help engineers, scientists, and students get started with Sage.  It’s available in print and e-book formats.  Please check it out!


I am aware that there are a number of issues with the code bundle that is available on the Packt site, but I have not been able to get the publisher to replace it.


Since the book was published, a number of minor errors have been discovered. Sage has also evolved, which in some cases has changed the functionality of the examples. If you have specific problems to report, please email them to me, and I will add errata to this page.

4 thoughts on “Sage Beginner’s Guide: Code and Errata”

  1. I have your book – was a big help.
    Enjoyed using Sage, but have problem. Downloaded an upgraded version and now find myself locked out of notebook. It does not recognize my ‘username’ or ‘password’. I have tried available support suggestions but none work. Any suggestions? Am going nuts.

    1. Thanks, I’m glad the book helped! Have you tried setting up the notebook server on the new version? Perhaps the users and passwords are over-written when Sage is upgraded. This guide has some information about that:

      The first time you run the server, it should prompt you to set an administrator password. Once you have admin privileges, you may be able to set up a user to access your old notebooks.

  2. Thank you for this excellent book. I’m working through the following code on p 18:
    f=desolve(x^2 * diff(y,x,2) + x * diff(y,x) + (x^2 – v^2) * y == 0, y, ivar=x)

    I’ve encountered two errors – the first, which I was able to fix, was simply to change what was in the book in the following way: y=function(‘y’,x) to y=function(‘y,x’). The second issue is with the f=desolve… line and is likely related to v being assumed as an integer. As written, I receive the following error:

    Cell In [35], line 4
    2 y=function(‘y,x’)
    3 assume(v,’integer’)
    —-> 4 f=desolve(x**Integer(2) * diff(y,x,Integer(2)) + x * diff(y,x) + (x**Integer(2) – v**Integer(2)) * y == Integer(0), y, ivar=x)
    5 show(f)

    File /private/var/tmp/sage-9.8-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/rings/integer.pyx:2192, in sage.rings.integer.Integer.__pow__ (build/cythonized/sage/rings/integer.c:14851)()
    2190 return coercion_model.bin_op(left, right, operator.pow)
    2191 # left is a non-Element: do the powering with a Python int
    -> 2192 return left ** int(right)
    2194 cpdef _pow_(self, other):

    TypeError: unsupported operand type(s) for ** or pow(): ‘NewSymbolicFunction’ and ‘int’

    Can you help me to understand this error? Thank you in advance.

  3. I’ve found my answer – the errata in the book (y=function(‘y’,x)) should have been corrected as (y=function(‘y’)(x)).

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.