Sympy

Jérémie Decock (www.jdhp.org)

In [1]:
import sympy as sp

# See: http://docs.sympy.org/latest/tutorial/printing.html
sp.init_printing()

Live shell

Make symbols

Make one symbol:

In [2]:
x = sp.symbols("x")

Make several symbols at once:

In [3]:
x, y, z = sp.symbols("x y z")

Main symbols

In [4]:
sp.pi
Out[4]:
$$\pi$$
In [5]:
sp.I
Out[5]:
$$i$$
In [6]:
sp.oo
Out[6]:
$$\infty$$

Main functions

In [7]:
sp.sqrt(x)
Out[7]:
$$\sqrt{x}$$
In [8]:
x**2
Out[8]:
$$x^{2}$$

The natural logarithm function ln:

In [9]:
sp.log(x)
Out[9]:
$$\log{\left (x \right )}$$
In [10]:
sp.exp(x)
Out[10]:
$$e^{x}$$

Trigonometric functions

In [11]:
sp.cos(x)
Out[11]:
$$\cos{\left (x \right )}$$
In [12]:
sp.sin(x)
Out[12]:
$$\sin{\left (x \right )}$$
In [13]:
sp.tan(x)
Out[13]:
$$\tan{\left (x \right )}$$
In [14]:
sp.cosh(x)
Out[14]:
$$\cosh{\left (x \right )}$$
In [15]:
sp.sinh(x)
Out[15]:
$$\sinh{\left (x \right )}$$
In [16]:
sp.tanh(x)
Out[16]:
$$\tanh{\left (x \right )}$$
In [17]:
sp.acos(x)
Out[17]:
$$\operatorname{acos}{\left (x \right )}$$
In [18]:
sp.asin(x)
Out[18]:
$$\operatorname{asin}{\left (x \right )}$$
In [19]:
sp.atan(x)
Out[19]:
$$\operatorname{atan}{\left (x \right )}$$
In [20]:
sp.acosh(x)
Out[20]:
$$\operatorname{acosh}{\left (x \right )}$$
In [21]:
sp.asinh(x)
Out[21]:
$$\operatorname{asinh}{\left (x \right )}$$
In [22]:
sp.atanh(x)
Out[22]:
$$\operatorname{atanh}{\left (x \right )}$$
In [23]: