-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

IPython Interactive Computing and Visualization Cookbook
By :

In this recipe, we will give a brief introduction to symbolic computing with SymPy. We will see more advanced features of SymPy in the next recipes.
SymPy is a pure Python package with no other dependencies, and as such, it is very easy to install. With Anaconda, you can type conda install sympy
in a terminal. On Windows, you can use Chris Gohlke's package (www.lfd.uci.edu/~gohlke/pythonlibs/#sympy). Finally, you can use the pip install sympy
command.
SymPy can be used from a Python module, or interactively in IPython. In the notebook, all mathematical expressions are displayed with LaTeX, thanks to the MathJax JavaScript library.
Here is an introduction to SymPy:
First, we import SymPy and enable LaTeX printing in the IPython notebook:
In [1]: from sympy import * init_printing()
To deal with symbolic variables, we first need to declare them:
In [2]: var('x y') Out[2]: (x, y)
The var()
function creates symbols and injects...
Change the font size
Change margin width
Change background colour