Skip to main content Accessibility help
×
Hostname: page-component-76fb5796d-45l2p Total loading time: 0 Render date: 2024-04-28T04:31:47.477Z Has data issue: false hasContentIssue false

7 - SymPy: A Computer Algebra System

Published online by Cambridge University Press:  02 August 2017

John M. Stewart
Affiliation:
University of Cambridge
Get access

Summary

Computer Algebra Systems

A computer algebra system (CAS) is a computer program designed to manipulate mathematical expressions in symbolic rather than numeric form, a task carried out routinely by theoretical scientists. There are a number of specialist programs, and some general purpose systems applicable to a wide range of problems, and it is the latter which we consider here. It is perhaps remarkable that two of the very oldest, Reduce and Maxima, which originated in the 1960s are still available as open source software. Subsequently various proprietary packages appeared. Perhaps the best known are Maple and Mathematica, which originated in the 1980s. Two more recent entries this century are Sage and SymPy. Both are open source projects. Besides symbolic manipulation, they all offer the ability to do numerics and create graphical output. Also, just like Python, they consist of a relatively small core and an extensive set of libraries which can be added as needed for specialist tasks. So which of these four open source systems should one use?

The most striking feature about SymPy is that it is written entirely in Python, and indeed is just an add-on module. It is small, and works in any Python system. It interfaces well to NumPy for numerics and to Matplotlib for graphics. The standard terminal mode has unsophisticated output, but naturally it can be used within the Jupyter notebook, and there it offers perhaps the best formatting currently available of complicated symbolic output. In comparison with the others it is incredibly slow, and many of the features are still in beta form, needing further development. I recommend it unreservedly for (a) learning about CASs and (b) for lightweight tasks.

But what of the other open source alternatives? Since 2008 Reduce has been available as open source software. The users' manual is a mere 1006 pages, but the core language is covered in the first 184 pages. It was developed at a time when fancy output displays did not exist, and this shows in terminal mode, which interfaces well with advanced editors such as emacs. However, recent incarnations offer an enhanced terminal mode which, if LATEX is available, offers fancy output up to the standard of the opposition.

Type
Chapter
Information
Python for Scientists , pp. 129 - 149
Publisher: Cambridge University Press
Print publication year: 2017

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

Available formats
×