This example documents the displaytools extension for the IPython Notebook.
In [1]:
%load_ext displaytools
#%reload_ext displaytools
In [2]:
import sympy as sp
from sympy import sin, cos
from sympy.abc import t, pi
In [3]:
x = 2*pi*t
y1 = cos(x)
y2 = cos(x)*t
ydot1 = y1.diff(t) ##
ydot2 = y2.diff(t) ##
ydot1_obj = y1.diff(t, evaluate=False) ##
Note that the equation sign (i.e., =) must be enclosed by two spaces, i.e.: lhs = rhs.
If the variable name is also desired this can be triggered by ##:
In [4]:
ydot1 = y1.diff(t) ##:
ydot2 = y2.diff(t) ##:
ydot1_obj = y1.diff(t, evaluate=False) ##:
Printing can be combined with LaTeX rendering:
In [5]:
sp.interactive.printing.init_printing(1)
In [6]:
ydot1 = y1.diff(t) ##:
ydot2 = y2.diff(t) ##:
ydot1_obj = y1.diff(t, evaluate=False) ##:
If there is no assignment taking place, ## nevertheless causes the display of the respective result.
In [7]:
y1.diff(t,t) ##
y2.diff(t,t) ##
In [8]:
xx = sp.Matrix(sp.symbols('x1:11')) ##T
yy = sp.Matrix(sp.symbols('y1:11')) ##:T
xx + yy ##T