#

狄拉克状态符号。

class sympy.physics.quantum.state.Bra(*args, **kwargs)[源代码]#

量子力学中与时间无关的一般文胸。

Inherits from State and BraBase. A Bra is the dual of a Ket [R769]. This class and its subclasses will be the main classes that users will use for expressing Bras in Dirac notation.

参数:

args :元组

唯一指定ket的数字或参数的列表。这通常是它的符号或量子数。对于依赖时间的状态,这将包括时间。

实例

制作一个简单的胸罩,看看它的属性:

>>> from sympy.physics.quantum import Bra
>>> from sympy import symbols, I
>>> b = Bra('psi')
>>> b
<psi|
>>> b.hilbert_space
H
>>> b.is_commutative
False

Bra知道他们的双重身份:

>>> b.dual
|psi>
>>> b.dual_class()
<class 'sympy.physics.quantum.state.Ket'>

像Kets一样,胸罩可以有复合标签,并且可以用类似的方式操作:

>>> n, m = symbols('n,m')
>>> b = Bra(n,m) - I*Bra(m,n)
>>> b
-I*<mn| + <nm|

胸罩上的符号可以用 .subs ::

>>> b.subs(n,m)
<mm| - I*<mm|

工具书类

class sympy.physics.quantum.state.BraBase(*args, **kwargs)[源代码]#

胸罩的基类。

此类定义用于打印的双重属性和括号。这是一个抽象基类,您不应该直接实例化它,而应该使用Bra。

class sympy.physics.quantum.state.Ket(*args, **kwargs)[源代码]#

量子力学中与时间无关的广义Ket。

Inherits from State and KetBase. This class should be used as the base class for all physical, time-independent Kets in a system. This class and its subclasses will be the main classes that users will use for expressing Kets in Dirac notation [R770].

参数:

args :元组

唯一指定ket的数字或参数的列表。这通常是它的符号或量子数。对于依赖时间的状态,这将包括时间。

实例

创建一个简单的Ket并查看其属性:

>>> from sympy.physics.quantum import Ket
>>> from sympy import symbols, I
>>> k = Ket('psi')
>>> k
|psi>
>>> k.hilbert_space
H
>>> k.is_commutative
False
>>> k.label
(psi,)

Ket知道他们的胸罩:

>>> k.dual
<psi|
>>> k.dual_class()
<class 'sympy.physics.quantum.state.Bra'>

取两个ket的线性组合:

>>> k0 = Ket(0)
>>> k1 = Ket(1)
>>> 2*I*k0 - 4*k1
2*I*|0> - 4*|1>

复合标签作为元组传递:

>>> n, m = symbols('n,m')
>>> k = Ket(n,m)
>>> k
|nm>

工具书类

class sympy.physics.quantum.state.KetBase(*args, **kwargs)[源代码]#

Kets的基类。

此类定义用于打印的双重属性和括号。这是一个抽象基类,您不应该直接实例化它,而应该使用Ket。

class sympy.physics.quantum.state.OrthogonalBra(*args, **kwargs)[源代码]#

量子力学中的正交胸罩。

class sympy.physics.quantum.state.OrthogonalKet(*args, **kwargs)[源代码]#

量子力学中的正交Ket。

标签不同的两个状态的内积为零,标签相同的状态的内积为1。

>>> from sympy.physics.quantum import OrthogonalBra, OrthogonalKet
>>> from sympy.abc import m, n
>>> (OrthogonalBra(n)*OrthogonalKet(n)).doit()
1
>>> (OrthogonalBra(n)*OrthogonalKet(n+1)).doit()
0
>>> (OrthogonalBra(n)*OrthogonalKet(m)).doit()
<n|m>
class sympy.physics.quantum.state.OrthogonalState(*args, **kwargs)[源代码]#

作为Ket和Bra基类的通用抽象量子态。

class sympy.physics.quantum.state.State(*args, **kwargs)[源代码]#

作为Ket和Bra基类的通用抽象量子态。

class sympy.physics.quantum.state.StateBase(*args, **kwargs)[源代码]#

量子力学中一般抽象态的抽象基类。

定义的所有其他状态类都需要从该类继承。它承载了所有其他状态的基本结构,如对偶、求值伴随和标号。

这是一个抽象基类,您不应该直接实例化它,而应该使用State。

property dual#

返回这个的双重状态。

classmethod dual_class()[源代码]#

返回用于构造dual的类。

property operators#

返回此状态是其本征状态的运算符

class sympy.physics.quantum.state.TimeDepBra(*args, **kwargs)[源代码]#

量子力学中的一般含时Bra。

这继承了timedeptate和BraBase,是应该用于随时间变化的Bras的主要类。它的双功能是计时器。

参数:

args :元组

唯一指定ket的数字或参数的列表。这通常是它的符号或量子数。对于依赖时间的状态,这将包括时间作为最终参数。

实例

>>> from sympy.physics.quantum import TimeDepBra
>>> b = TimeDepBra('psi', 't')
>>> b
<psi;t|
>>> b.time
t
>>> b.label
(psi,)
>>> b.hilbert_space
H
>>> b.dual
|psi;t>
class sympy.physics.quantum.state.TimeDepKet(*args, **kwargs)[源代码]#

量子力学中的一般含时Ket。

它继承自 TimeDepStateKetBase 是应用于随时间变化的Ket的主类。它的双重身份是 TimeDepBra .

参数:

args :元组

唯一指定ket的数字或参数的列表。这通常是它的符号或量子数。对于依赖时间的状态,这将包括时间作为最终参数。

实例

创建TimeDepKet并查看其属性:

>>> from sympy.physics.quantum import TimeDepKet
>>> k = TimeDepKet('psi', 't')
>>> k
|psi;t>
>>> k.time
t
>>> k.label
(psi,)
>>> k.hilbert_space
H

TimeDepKets知道他们的双胸罩:

>>> k.dual
<psi;t|
>>> k.dual_class()
<class 'sympy.physics.quantum.state.TimeDepBra'>
class sympy.physics.quantum.state.TimeDepState(*args, **kwargs)[源代码]#

一般的基态量子态。

此类用作任何依赖时间的状态的基类。这个类和独立于时间的状态之间的主要区别是,除了通常的label参数之外,这个类还接受第二个参数time。

参数:

args :元组

唯一指定ket的数字或参数的列表。这通常是它的符号或量子数。对于依赖时间的状态,这将包括时间作为最终参数。

property label#

国家的标签。

property time#

国家的时间。

class sympy.physics.quantum.state.Wavefunction(*args)[源代码]#

连续基表示类

此类接受表达式并在其构造函数中进行坐标。它可以很容易地计算规范化和概率。

参数:

expr :表达式

表示函数形式的表达式。

坐标 :符号或元组

要积分的坐标及其边界

实例

粒子,以更原始的方式逐段指定边界:

>>> from sympy import Symbol, Piecewise, pi, N
>>> from sympy.functions import sqrt, sin
>>> from sympy.physics.quantum.state import Wavefunction
>>> x = Symbol('x', real=True)
>>> n = 1
>>> L = 1
>>> g = Piecewise((0, x < 0), (0, x > L), (sqrt(2//L)*sin(n*pi*x/L), True))
>>> f = Wavefunction(g, x)
>>> f.norm
1
>>> f.is_normalized
True
>>> p = f.prob()
>>> p(0)
0
>>> p(L)
0
>>> p(0.5)
2
>>> p(0.85*L)
2*sin(0.85*pi)**2
>>> N(p(0.85*L))
0.412214747707527

此外,还可以以更简洁的方式指定函数和索引的边界:

>>> from sympy import symbols, pi, diff
>>> from sympy.functions import sqrt, sin
>>> from sympy.physics.quantum.state import Wavefunction
>>> x, L = symbols('x,L', positive=True)
>>> n = symbols('n', integer=True, positive=True)
>>> g = sqrt(2/L)*sin(n*pi*x/L)
>>> f = Wavefunction(g, (x, 0, L))
>>> f.norm
1
>>> f(L+1)
0
>>> f(L-1)
sqrt(2)*sin(pi*n*(L - 1)/L)/sqrt(L)
>>> f(-1)
0
>>> f(0.85)
sqrt(2)*sin(0.85*pi*n/L)/sqrt(L)
>>> f(0.85, n=1, L=1)
sqrt(2)*sin(0.85*pi)
>>> f.is_commutative
False

所有参数都会自动进行联合,因此可以将变量定义为字符串而不是符号:

>>> expr = x**2
>>> f = Wavefunction(expr, 'x')
>>> type(f.variables[0])
<class 'sympy.core.symbol.Symbol'>

波函数的导数将返回波函数:

>>> diff(f, x)
Wavefunction(2*x, x)
property expr#

返回波函数的函数形式表达式

实例

>>> from sympy.physics.quantum.state import Wavefunction
>>> from sympy import symbols
>>> x, y = symbols('x, y')
>>> f = Wavefunction(x**2, x)
>>> f.expr
x**2
property is_commutative#

重写函数是可交换的,因此在表示表达式中保持顺序

property is_normalized#

如果波函数正确规范化,则返回true

实例

>>> from sympy import symbols, pi
>>> from sympy.functions import sqrt, sin
>>> from sympy.physics.quantum.state import Wavefunction
>>> x, L = symbols('x,L', positive=True)
>>> n = symbols('n', integer=True, positive=True)
>>> g = sqrt(2/L)*sin(n*pi*x/L)
>>> f = Wavefunction(g, (x, 0, L))
>>> f.is_normalized
True
property limits#

返回w.f.所依赖的坐标限制如果没有指定限制,则默认为 (-oo, oo) .

实例

>>> from sympy.physics.quantum.state import Wavefunction
>>> from sympy import symbols
>>> x, y = symbols('x, y')
>>> f = Wavefunction(x**2, (x, 0, 1))
>>> f.limits
{x: (0, 1)}
>>> f = Wavefunction(x**2, x)
>>> f.limits
{x: (-oo, oo)}
>>> f = Wavefunction(x**2 + y**2, x, (y, -1, 2))
>>> f.limits
{x: (-oo, oo), y: (-1, 2)}
property norm#

返回指定函数形式的规范化。

这个函数在波函数的坐标上积分,有指定的界限。

实例

>>> from sympy import symbols, pi
>>> from sympy.functions import sqrt, sin
>>> from sympy.physics.quantum.state import Wavefunction
>>> x, L = symbols('x,L', positive=True)
>>> n = symbols('n', integer=True, positive=True)
>>> g = sqrt(2/L)*sin(n*pi*x/L)
>>> f = Wavefunction(g, (x, 0, L))
>>> f.norm
1
>>> g = sin(n*pi*x/L)
>>> f = Wavefunction(g, (x, 0, L))
>>> f.norm
sqrt(2)*sqrt(L)/2
normalize()[源代码]#

返回波函数的规范化版本

实例

>>> from sympy import symbols, pi
>>> from sympy.functions import sin
>>> from sympy.physics.quantum.state import Wavefunction
>>> x = symbols('x', real=True)
>>> L = symbols('L', positive=True)
>>> n = symbols('n', integer=True, positive=True)
>>> g = sin(n*pi*x/L)
>>> f = Wavefunction(g, (x, 0, L))
>>> f.normalize()
Wavefunction(sqrt(2)*sin(pi*n*x/L)/sqrt(L), (x, 0, L))
prob()[源代码]#

返回w.f.的绝对大小。, \(|\psi(x)|^2\)

实例

>>> from sympy import symbols, pi
>>> from sympy.functions import sin
>>> from sympy.physics.quantum.state import Wavefunction
>>> x, L = symbols('x,L', real=True)
>>> n = symbols('n', integer=True)
>>> g = sin(n*pi*x/L)
>>> f = Wavefunction(g, (x, 0, L))
>>> f.prob()
Wavefunction(sin(pi*n*x/L)**2, x)
property variables#

返回波函数所依赖的坐标

实例

>>> from sympy.physics.quantum.state import Wavefunction
>>> from sympy import symbols
>>> x,y = symbols('x,y')
>>> f = Wavefunction(x*y, x, y)
>>> f.variables
(x, y)
>>> g = Wavefunction(x*y, x)
>>> g.variables
(x,)