In [1]:
from cutiepy import *

Symbolic expressions without numerical data behind them


In [2]:
x,y,z = xyz()
k = Ket('k', 10)
b = Bra('b', 10)
O = Operator('O', 10)
S = Superoperator('S', 10)
t = Scalar('t')

In [3]:
b*S*O*k


Out[3]:
$${{\langle {b}_{} |}{\mathcal{{S}_{}}}{\hat{O}_{}}{| {k}_{} \rangle}}$$

In [4]:
b*S*O*t**2*k


Out[4]:
$${{{\langle {b}_{} |}{\mathcal{{S}_{}}}{\hat{O}_{}}{| {k}_{} \rangle}}\tiny\times\normalsize{{ \left( {t} \right) }^{{2}}}}$$

In [5]:
b


Out[5]:
$$\text{Bra }{\langle {b}_{} |} \text{ on the space }\mathbb{C}^{10}\text{ without an attached numerical content.}$$

Expressions containing numerical data


In [6]:
k1 = coherent(11, 1.5)
k1


Out[6]:
$$\text{Ket }{| {{\tiny\alpha\normalsize 1.50}}_{{\tiny N\normalsize 11}} \rangle} \text{ on the space }\mathbb{C}^{11}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}0.325\\0.487\\0.517\\0.447\\0.335\\\vdots\\0.138\\0.078\\0.041\\0.021\\0.010\\\end{array}\right)\end{equation*}$$

In [7]:
k2 = basis(5,3)
k2


Out[7]:
$$\text{Ket }{| {{3}}_{{\tiny N\normalsize 5}} \rangle} \text{ on the space }\mathbb{C}^{5}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}0.0\\0.0\\0.0\\1.0\\0.0\\\end{array}\right)\end{equation*}$$

In [8]:
evalf(k2*2)


Out[8]:
$$\text{Anonymous }\text{Ket }{| {\tiny\boxed{{K}_{c8371c8e...}}\normalsize}_{} \rangle} \text{ on the space }\mathbb{C}^{5}\text{ with numerical content: }$$ $$\begin{equation*}\left(\begin{array}{*{11}c}0.0\\0.0\\0.0\\2.0\\0.0\\\end{array}\right)\end{equation*}$$

Substitutions


In [9]:
expr = b*S*O*k
expr


Out[9]:
$${{\langle {b}_{} |}{\mathcal{{S}_{}}}{\hat{O}_{}}{| {k}_{} \rangle}}$$

In [10]:
bb = Bra(r'another\ one', 10)
subs(expr, b, bb)


Out[10]:
$${{\langle {another\ one}_{} |}{\mathcal{{S}_{}}}{\hat{O}_{}}{| {k}_{} \rangle}}$$