SymPy Tutorial

Python Installation

apt-get install python3

Sympy Installation

pip install sympy

Importing SymPy

from sympy import symbols, Symbol, init_printing

Sympy Symbols vs Variables

A SymPy variable acts the same way as variable in anyother programming language with the exception that by default it points to itself.

Normally if variable is called before it is defined NameError is raised.

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> x
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'x' is not defined
>>>

This declares x as a <sympy.Symbol> object

x = Symbol('x')