Book contents
- Frontmatter
- Contents
- Preface to the Second Edition
- Preface to the First Edition
- 1 Introduction
- 2 Getting Started with IPython
- 3 A Short Python Tutorial
- 4 NumPy
- 5 Two-Dimensional Graphics
- 6 Multi-Dimensional Graphics
- 7 SymPy: A Computer Algebra System
- 8 Ordinary Differential Equations
- 9 Partial Differential Equations: A Pseudospectral Approach
- 10 Case Study: Multigrid
- Appendix A Installing a Python Environment
- Appendix B Fortran77 Subroutines for Pseudospectral Methods
- References
- Hints for Using the Index
- Index
7 - SymPy: A Computer Algebra System
Published online by Cambridge University Press: 02 August 2017
- Frontmatter
- Contents
- Preface to the Second Edition
- Preface to the First Edition
- 1 Introduction
- 2 Getting Started with IPython
- 3 A Short Python Tutorial
- 4 NumPy
- 5 Two-Dimensional Graphics
- 6 Multi-Dimensional Graphics
- 7 SymPy: A Computer Algebra System
- 8 Ordinary Differential Equations
- 9 Partial Differential Equations: A Pseudospectral Approach
- 10 Case Study: Multigrid
- Appendix A Installing a Python Environment
- Appendix B Fortran77 Subroutines for Pseudospectral Methods
- References
- Hints for Using the Index
- Index
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 - 149Publisher: Cambridge University PressPrint publication year: 2017