Maple & MapleSim分享 http://blog.sciencenet.cn/u/maplesim

博文

Maple计算物理函数包介绍

已有 11710 次阅读 2012-8-7 12:50 |个人分类:Maple基础学习|系统分类:科研笔记| 量子力学, 力学, 电动力学, maple, 计算物理

 

概述

Maple 11 引入了 Physics 函数包,经过多年的持续开发,Maple的计算物理功能已经非常强大。Maple 允许你研究和处理计算物理领域中的广泛问题,包括经典力学、量子力学、相对论理论。同时它也提供研究生水平的场论使用资源。

Physics package提供计算物理中计算对象的表示和相关的操作,包括时空矩阵 g[`μν`],Kronecker delta[`μν`] 和 Levi-Civita epsilon[`μνρσ`] 对称和反对称符号,Pauli sigma[mu] 和 Dirac gamma[mu] 矩阵,微分算子 ,以及d'Alembertian时空坐标上的微分算子 ☐,n 维 Dirac 函数 diff(delta(x), [`$`(x, n)]),量子算子,交换子和交换子代数,等等...

Physics package扩展了标准的计算领域,提供了关于反交换和交换变量和函数的操作,以及相关的乘积和幂次操作;时空的张量指数, spinor和/或gauge类型,泛函微分,关于反交换变量的微分,张量表达式的微分和简化使用爱因斯坦求和约定。通过这种方式,用户可以利用Maple强大的计算引擎,相比传统使用纸笔计算的方式,更直观和方便。

作为计算领域的延伸,该函数包包含了一个Vectors子函数包,用于实现抽象向量微积分。该函数包提供非投影三维向量的表示,非投影倒三角微分算子、梯度、散度、旋度、拉普拉斯算子的惰性和活动表示对象,以及笛卡尔、柱面、球面向量基下的投影三维向量的代数表示(非矩阵)。然后可以使用无坐标向量公式完成计算任务,探索其中向量和向量操作的无坐标属性,使用与教科书中相同的符号输入和操作向量表达式。

计算中的所有约定可以通过一个简单灵活的交互式助手设置。为了完成该计算领域,需要建立约定区别交换、反交换和非换变量、三维向量、张量等不同的对象。当用户在Maple工作表中加载Physics函数包时,会调入默认的约定设置,用户也可以使用设置助手修改这些约定。

教科书式的数学符号:反交换和非交换变量显示为不同的颜色,非投影向量和单位向量分别显示为箭头和在顶部显示符号、向量微分算子(倒三角算子)和拉普拉斯算子分别显示为 ∇ 和 ∆、Bras〈ψ⎢和 Kets⎢ψ〉等显示为与教科书相同的格式。

每一个 Physics 命令提供大量的示例和说明, 提供示例说明如何使用函数包中的命令解决解析几何力学电动力学量子力学中的问题。

微分几何函数包提供了完整的计算工具处理高级广义相对论。Maple 15新增加了十七个新的命令。

Maple 在求常微分方程和偏微分方程符号解领域处于世界领先地位,包括物理中的许多领域。Maple 15提供了新的算法进一步增强领先地位。

特殊函数,用于表示计算物理的解,也是 Maple 的一个强项,同样在 Maple 15中得到增强。一组新的特殊函数,Bell 多项式,已经被加入到Maple 15中。

物理计算示例

力学:拉格朗日单摆

问题

求平面单摆的拉格朗日方程,端点处的质量为 m,假设条件为:

a) 以恒定频率 omega 沿圆周均匀移动移动。

b) 单摆相对于 x = cos(`*`(omega, `*`(t))) 在平面上水面振荡。

a) 问题的原理图如下:

Image

拉格朗日方程定义为:

> with(Physics[Vectors]); -1Setup(mathematicalnotation = true)
[mathematicalnotation = true] (2.1.1)
> L := `+`(T, `-`(U))
Typesetting:-mprintslash([L := `+`(T, `-`(U))], [`+`(T, `-`(U))]) (2.1.2)

其中 TU 分别是系统的动能和势能,这里主要由质量点 m 产生。势能 U 是重力势能。

> U := `+`(`-`(`*`(m, `*`(g, `*`(y)))))
Typesetting:-mprintslash([U := `+`(`-`(`*`(m, `*`(g, `*`(y)))))], [`+`(`-`(`*`(m, `*`(g, `*`(y)))))]) (2.1.3)

其中 g重力常数 ,我们选择沿着 y 轴方向,因此重力为 F_[g] = `*`(mg, `*`(_j))。动能为:

> T := `+`(`*`(`/`(1, 2), `*`(m, `*`(Typesetting:-delayDotProduct(v_, v_)))))
Typesetting:-mprintslash([T := `+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(Physics:-Vectors:-Norm(v_), 2)))))], [`+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(Physics:-Vectors:-Norm(v_), 2)))))]) (2.1.4)

为了计算速度,单摆质量点的位置向量 r_ 为:

> r_ := `+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)))
Typesetting:-mprintslash([r_ := `+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)))], [`+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)))]) (2.1.5)

选择水平 x 轴和参考坐标系的原点(圆圈的中心位置),得到 x 和 y 的坐标:

> parametric_equations := [x = `+`(`*`(a, `*`(cos(`*`(omega, `*`(t))))), `*`(l, `*`(sin(phi(t))))), y = `+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t)))))), `*`(l, `*`(cos(phi(t)))))]
Typesetting:-mprintslash([parametric_equations := [x = `+`(`*`(a, `*`(cos(`*`(omega, `*`(t))))), `*`(l, `*`(sin(phi(t))))), y = `+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t)))))), `*`(l, `*`(cos(phi(t)))))... (2.1.6)
> r_ := .(r_, parametric_equations)
Typesetting:-mprintslash([r_ := `+`(`*`(`+`(`*`(a, `*`(cos(`*`(omega, `*`(t))))), `*`(l, `*`(sin(phi(t))))), `*`(_i)), `*`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t)))))), `*`(l, `*`(cos(phi(t))))), `*`... (2.1.7)
> v_ := diff(r_, t)
Typesetting:-mprintslash([v_ := `+`(`*`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t))), `*`(omega)))), `*`(l, `*`(cos(phi(t)), `*`(diff(phi(t), t))))), `*`(_i)), `*`(`+`(`-`(`*`(a, `*`(cos(`*`(omega, `*`(... (2.1.8)
> T

Typesetting:-mprintslash([`+`(`*`(`/`(1, 2), `*`(m, `*`(`+`(`*`(`^`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t))), `*`(omega)))), `*`(l, `*`(cos(phi(t)), `*`(diff(phi(t), t))))), 2)), `*`(`^`(`+`(`-`(`*`... (2.1.9)

该表达式含有三角函数的乘积,所以可以使用Maple中的三角简化技术简化方程:

> combine(T, trig)
Typesetting:-mprintslash([`+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2))))), `-`(`*`(m, `*`(a, `*`(omega, `*`(l, `*`(diff(phi(t), t), `*`(sin(`+`(`*`(omega, `*`(t)), `-`(phi(t))))))))))),... (2.1.10)

对于重力势能,表示为质量点 m 的参数方程的形式。得到:

> U := .(U, parametric_equations)
Typesetting:-mprintslash([U := `+`(`-`(`*`(m, `*`(g, `*`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t)))))), `*`(l, `*`(cos(phi(t))))))))))], [`+`(`-`(`*`(m, `*`(g, `*`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*... (2.1.11)

从而得到期望的拉格朗日方程:

> L := combine(L, trig); 1
Typesetting:-mprintslash([L := `+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2))))), `-`(`*`(m, `*`(a, `*`(omega, `*`(l, `*`(diff(phi(t), t), `*`(sin(`+`(`*`(omega, `*`(t)), `-`(phi(t)))))))... (2.1.12)

考虑到拉格朗日系统的定义在建立关于时间 t 的微分之上,因此我们可以消除其中的两项`+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2))))))`*`(m, `*`(g, `*`(a, `*`(sin(`*`(omega, `*`(t))))))),从而得到:

> select(has, L, [`*`(`^`(omega, 2)), sin(`*`(omega, `*`(t)))])
`+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2))))), `-`(`*`(m, `*`(g, `*`(a, `*`(sin(`*`(omega, `*`(t))))))))) (2.1.13)
> L := `+`(L, `+`(`-`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2)))))), `*`(m, `*`(g, `*`(a, `*`(sin(`*`(omega, `*`(t)))))))))
Typesetting:-mprintslash([L := `+`(`-`(`*`(m, `*`(a, `*`(omega, `*`(l, `*`(diff(phi(t), t), `*`(sin(`+`(`*`(omega, `*`(t)), `-`(phi(t))))))))))), `*`(`/`(1, 2), `*`(m, `*`(`^`(l, 2), `*`(`^`(diff(phi(... (2.1.14)

__________________________________________________________

b) 步骤与 a 部分相同:

> L := `+`(T, `-`(U))
Typesetting:-mprintslash([L := `+`(`*`(`/`(1, 2), `*`(m, `*`(`+`(`*`(`^`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t))), `*`(omega)))), `*`(l, `*`(cos(phi(t)), `*`(diff(phi(t), t))))), 2)), `*`(`^`(`+`(`-...
Typesetting:-mprintslash([L := `+`(`*`(`/`(1, 2), `*`(m, `*`(`+`(`*`(`^`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t))), `*`(omega)))), `*`(l, `*`(cos(phi(t)), `*`(diff(phi(t), t))))), 2)), `*`(`^`(`+`(`-...
(2.1.15)
> U := `+`(`-`(`*`(m, `*`(g, `*`(y)))))
Typesetting:-mprintslash([U := `+`(`-`(`*`(m, `*`(g, `*`(y)))))], [`+`(`-`(`*`(m, `*`(g, `*`(y)))))]) (2.1.16)
> T := `+`(`*`(`/`(1, 2), `*`(m, `*`(Typesetting:-delayDotProduct(v_, v_)))))
Typesetting:-mprintslash([T := `+`(`*`(`/`(1, 2), `*`(m, `*`(`+`(`*`(`^`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t))), `*`(omega)))), `*`(l, `*`(cos(phi(t)), `*`(diff(phi(t), t))))), 2)), `*`(`^`(`+`(`-... (2.1.17)
> r_ := `+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)))
Typesetting:-mprintslash([r_ := `+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)))], [`+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)))]) (2.1.18)

现在,相对于 a 部分,唯一的不同是表达式使用 y 坐标,得到:

> y = `+`(1, `*`(l, `*`(cos(phi(t)))))
y = `+`(1, `*`(l, `*`(cos(phi(t))))) (2.1.19)

这种情况下的参数化方程是:

> parametric_equations := [x = `+`(`*`(a, `*`(cos(`*`(omega, `*`(t))))), `*`(l, `*`(sin(phi(t))))), y = `+`(1, `*`(l, `*`(cos(phi(t)))))]
Typesetting:-mprintslash([parametric_equations := [x = `+`(`*`(a, `*`(cos(`*`(omega, `*`(t))))), `*`(l, `*`(sin(phi(t))))), y = `+`(1, `*`(l, `*`(cos(phi(t)))))]], [[x = `+`(`*`(a, `*`(cos(`*`(omega, ... (2.1.20)
> r_ := .(r_, parametric_equations)
Typesetting:-mprintslash([r_ := `+`(`*`(`+`(`*`(a, `*`(cos(`*`(omega, `*`(t))))), `*`(l, `*`(sin(phi(t))))), `*`(_i)), `*`(`+`(1, `*`(l, `*`(cos(phi(t))))), `*`(_j)))], [`+`(`*`(`+`(`*`(a, `*`(cos(`*`... (2.1.21)
> v_ := diff(r_, t)
Typesetting:-mprintslash([v_ := `+`(`*`(`+`(`-`(`*`(a, `*`(sin(`*`(omega, `*`(t))), `*`(omega)))), `*`(l, `*`(cos(phi(t)), `*`(diff(phi(t), t))))), `*`(_i)), `-`(`*`(_j, `*`(l, `*`(sin(phi(t)), `*`(di... (2.1.22)

对于重力势能,表示为质量点 m 的参数化方程形式,得到:

> U := .(U, parametric_equations)
Typesetting:-mprintslash([U := `+`(`-`(`*`(m, `*`(g, `*`(`+`(1, `*`(l, `*`(cos(phi(t))))))))))], [`+`(`-`(`*`(m, `*`(g, `*`(`+`(1, `*`(l, `*`(cos(phi(t))))))))))]) (2.1.23)

从而得到拉格朗日方程:

> L
Typesetting:-mprintslash([`+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2))))), `-`(`*`(m, `*`(a, `*`(omega, `*`(l, `*`(diff(phi(t), t), `*`(sin(`+`(`*`(omega, `*`(t)), `-`(phi(t))))))))))),... (2.1.24)
> L := combine(L, trig)
Typesetting:-mprintslash([L := `+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2))))), `-`(`*`(m, `*`(a, `*`(omega, `*`(l, `*`(diff(phi(t), t), `*`(sin(`+`(`*`(omega, `*`(t)), `-`(phi(t)))))))... (2.1.25)

获取 L 中的不可微分项:

> select(has, L, [`*`(`^`(omega, 2)), cos(`+`(`*`(2, `*`(omega, `*`(t)))))])
`+`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2)))))) (2.1.26)

从而得到拉格朗日方程:

> L := `+`(L, `-`(`*`(`/`(1, 2), `*`(m, `*`(`^`(a, 2), `*`(`^`(omega, 2)))))))
Typesetting:-mprintslash([L := `+`(`-`(`*`(m, `*`(a, `*`(omega, `*`(l, `*`(diff(phi(t), t), `*`(sin(`+`(`*`(omega, `*`(t)), `-`(phi(t))))))))))), `*`(`/`(1, 2), `*`(m, `*`(`^`(l, 2), `*`(`^`(diff(phi(... (2.1.27)

电动力学:旋转带电圆盘的磁场 H_

问题

圆盘的半径为 a,均匀带电电荷的表面密度是 以恒定角速度 围绕轴线旋转,其中 phi 是圆柱坐标(极角)。计算圆盘轴上的磁场。

磁场 H_(r_)的表达式,依赖于电荷的电流 J_(R_)

这里 r_ 是空间中任一点的位置向量,R_ 是存在电流的任一点的位置向量,在这种情况下圆盘直径是 a, ds 是面积单元。Sigma 表示积分域,上面的表达式是一个曲面积分。

> restart; -1; with(Physics[Vectors]); -1Setup(mathematicalnotation = true)
[mathematicalnotation = true] (2.2.1)

H_ 的表达式可以输入为圆柱坐标系下的二重积分 (rho, phi, z); 该坐标系下圆盘的面积表示为 `*`(rho, `*`(`dρ`, `*`(`dϕ`))), 其中 rho 变换范围是 0 到 aphi 的范围是 0 到 `+`(`*`(2, `*`(Pi)))

> H_ := Int(Int(`/`(`*`(`&x`(J_, `+`(r_, `-`(R_))), `*`(rho)), `*`(c, `*`(`^`(Norm(`+`(r_, `-`(R_))), 3)))), rho = 0 .. a), phi = 0 .. `+`(`*`(2, `*`(Pi))))
Typesetting:-mprintslash([H_ := Int(Int(`/`(`*`(Physics:-Vectors:-`&x`(J_, `+`(r_, `-`(R_))), `*`(rho)), `*`(c, `*`(`^`(Physics:-Vectors:-Norm(`+`(r_, `-`(R_))), 3)))), rho = 0 .. a), phi = 0 .. `+`(`... (2.2.2)

我们选择与前一个问题相同的参考系统,原点在圆盘的中心,z 轴的方向垂直于圆盘。z 轴上一点的位置向量是:

> r_ := `*`(z, `*`(_k))
Typesetting:-mprintslash([r_ := `*`(z, `*`(_k))], [`*`(z, `*`(_k))]) (2.2.3)

圆盘上一点的位置向量是:

> R_ := `*`(rho, `*`(_rho))
Typesetting:-mprintslash([R_ := `*`(rho, `*`(_rho))], [`*`(rho, `*`(_rho))]) (2.2.4)

根据定义,一点 R_ 上的电流 J_ 等于电荷密度乘以电荷速度,也就是:

> J_ := `*`(sigma, `*`(V_))
Typesetting:-mprintslash([J_ := `*`(sigma, `*`(V_))], [`*`(sigma, `*`(V_))]) (2.2.5)

最后,圆盘上一点 R_ 上的速度 V_ 可以通过计算 R_ 相对于时间 t 的导数得到,同时我们需要考虑单位向量 _rho 随时间的变化因素,这是因为它依赖于角度`ϕ`,圆盘是旋转的。

R_ 的导数计算有两种不同的方法。一种方法是改变 R_ 从圆柱坐标系到笛卡尔坐标系的投影转换,明确 _rhophi 的依赖关系。

> ChangeBasis(R_, 1)
`+`(`*`(rho, `*`(cos(phi), `*`(_i))), `*`(rho, `*`(sin(phi), `*`(_j)))) (2.2.6)

现在让 phi 依赖于 时间 t, 然后求微分。

> subs(phi = phi(t), `+`(`*`(rho, `*`(cos(phi), `*`(_i))), `*`(rho, `*`(sin(phi), `*`(_j)))))
`+`(`*`(rho, `*`(cos(phi(t)), `*`(_i))), `*`(rho, `*`(sin(phi(t)), `*`(_j)))) (2.2.7)
> diff(`+`(`*`(rho, `*`(cos(phi(t)), `*`(_i))), `*`(rho, `*`(sin(phi(t)), `*`(_j)))), t)
Typesetting:-mprintslash([`+`(`-`(`*`(rho, `*`(sin(phi(t)), `*`(diff(phi(t), t), `*`(_i))))), `*`(rho, `*`(cos(phi(t)), `*`(diff(phi(t), t), `*`(_j)))))], [`+`(`-`(`*`(rho, `*`(sin(phi(t)), `*`(diff(p... (2.2.8)

diff(phi(t), t) = omega, 然后移除 phit 的显式依赖关系,得到 V_ 的表达式。

> factor(subs([diff(phi(t), t) = omega, phi(t) = phi], `+`(`-`(`*`(rho, `*`(sin(phi(t)), `*`(diff(phi(t), t), `*`(_i))))), `*`(rho, `*`(cos(phi(t)), `*`(diff(phi(t), t), `*`(_j)))))))
`*`(rho, `*`(omega, `*`(`+`(`-`(`*`(sin(phi), `*`(_i))), `*`(cos(phi), `*`(_j)))))) (2.2.9)

或者使用更简单的方法,知道 _rho 因此 `#mover(mi( _rho 通过 `ϕ` 依赖于时间,用户可以计算 diff(R_(t), t) = diff(R_(phi), phi) = `*`(omega, `*`(diff(R_(phi), phi)))。为此目的,使用 VectorDiff 命令,自动考虑 _rho 依赖于 phi

> V_ := `*`(omega, `*`(VectorDiff(R_, phi)))
Typesetting:-mprintslash([V_ := `*`(omega, `*`(rho, `*`(_phi)))], [`*`(omega, `*`(rho, `*`(_phi)))]) (2.2.10)

此时,我们已经定义在选定坐标系上的所有量,表示为恒定角速度 omega,圆盘半径为 a。磁场的表达式如下:

> H_
Typesetting:-mprintslash([Int(Int(`/`(`*`(`+`(`*`(sigma, `*`(omega, `*`(rho, `*`(z, `*`(_rho))))), `*`(sigma, `*`(omega, `*`(`^`(rho, 2), `*`(_k))))), `*`(rho)), `*`(c, `*`(`^`(`+`(`*`(`^`(rho, 2)), `... (2.2.11)

但是为了完成积分,我们仍需要将 _rho 表示为积分变量 phi 的函数。出于该目的,需要将R_V_ 改变为笛卡尔基下的形式。

> R_ := ChangeBasis(R_, 1)
Typesetting:-mprintslash([R_ := `+`(`*`(rho, `*`(cos(phi), `*`(_i))), `*`(rho, `*`(sin(phi), `*`(_j))))], [`+`(`*`(rho, `*`(cos(phi), `*`(_i))), `*`(rho, `*`(sin(phi), `*`(_j))))]) (2.2.12)
> V_ := ChangeBasis(V_, 1)
Typesetting:-mprintslash([V_ := `+`(`-`(`*`(omega, `*`(rho, `*`(sin(phi), `*`(_i))))), `*`(omega, `*`(rho, `*`(cos(phi), `*`(_j)))))], [`+`(`-`(`*`(omega, `*`(rho, `*`(sin(phi), `*`(_i))))), `*`(omega... (2.2.13)

改变后的 H_ 如下:

> H_
Typesetting:-mprintslash([Int(Int(`/`(`*`(`+`(`*`(sigma, `*`(omega, `*`(rho, `*`(cos(phi), `*`(z, `*`(_i)))))), `*`(sigma, `*`(omega, `*`(rho, `*`(sin(phi), `*`(z, `*`(_j)))))), `*`(sigma, `*`(omega, ... (2.2.14)

现在可以完成积分计算,得到磁场 H_ 的值。

> <img border="0" alt="H_ := `assuming`([value(H_)], [`<`(0, a), `
Typesetting:-mprintslash([H_ := `+`(`-`(`/`(`*`(2, `*`(omega, `*`(sigma, `*`(_k, `*`(Pi, `*`(`+`(`*`(2, `*`(`^`(`+`(`*`(`^`(z, 2)), `*`(`^`(a, 2))), `/`(1, 2)), `*`(z))), `-`(`*`(`^`(a, 2))), `-`(`*`(... (2.2.15)

量子力学:角动量:

1.考虑量子动力学中的角动量算子 `*`(`^`(Physics:-Vectors:-Norm(L_), 2)), L[x], L[y], 和 L[z] 。我们需要验证 `*`(`^`(Physics:-Vectors:-Norm(L_), 2))对易(Commutator) , 使得 L_ 中的任意 components 为 0 (例如见 Chapter VI of Cohen-Tannoudji)。出于此目的,L_ 的三维向量量子算子可通过 Vectors 函数包构建 ( vectorpostfix identifier 是 '_'), 以及 L[x], L[y], L[z] 以及 r_p_ 和它们的元素可以设置为量子算子。

> restart; -1; with(Physics); -1with(Physics[Vectors]); -1Setup(mathematicalnotation = true); -1

想要设置 L[i]p[j] 为量子算子,只需要设置 Lp

> Setup(quantumoperators = {L, L_, p, p_, r_, x, y, z})
[quantumoperators = {L, L_, p, p_, r_, x, y, z}] (2.3.1)

因此对于 `*`(`^`(Physics:-Vectors:-Norm(L_), 2)) 以及 L_ 自身表示为向量算子r_p_ 的形式。

> LL := Typesetting:-delayDotProduct(L_, L_)
Typesetting:-mprintslash([LL := `*`(`^`(Physics:-Vectors:-Norm(L_), 2))], [Physics:-`^`(Physics:-Vectors:-Norm(L_), 2)]) (2.3.2)
> L_ := `&x`(r_, p_)
Typesetting:-mprintslash([L_ := Physics:-Vectors:-`&x`(r_, p_)], [Physics:-Vectors:-`&x`(r_, p_)]) (2.3.3)

其中,

> r_ := `+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)), `*`(z, `*`(_k)))
Typesetting:-mprintslash([r_ := `+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)), `*`(z, `*`(_k)))], [`+`(`*`(x, `*`(_i)), `*`(y, `*`(_j)), `*`(z, `*`(_k)))]) (2.3.4)
> p_ := `+`(`*`(p[x], `*`(_i)), `*`(p[y], `*`(_j)), `*`(p[z], `*`(_k)))
Typesetting:-mprintslash([p_ := `+`(`*`(p[x], `*`(_i)), `*`(p[y], `*`(_j)), `*`(p[z], `*`(_k)))], [`+`(`*`(p[x], `*`(_i)), `*`(p[y], `*`(_j)), `*`(p[z], `*`(_k)))]) (2.3.5)

L_ 的对易规则是关于 r_p_ 元素对易规则的子序列。这些规则可以通过使用 Setup 命令设置。这里需要输入许多交换子,一个方便的替代方法是使用索引(张量)符号(见下面的问题2)或者创建一个 Matrix 的索引过程。例如:

> algebra := proc (i, j) options operator, arrow; %Commutator(Component(r_, i), Component(p_, j)) = `*`(I, `*`(KroneckerDelta[i, j])), %Commutator(Component(r_, i), Component(r_, j)) = 0, %Commutator(Co...
algebra := proc (i, j) options operator, arrow; %Commutator(Component(r_, i), Component(p_, j)) = `*`(I, `*`(KroneckerDelta[i, j])), %Commutator(Component(r_, i), Component(r_, j)) = 0, %Commutator(Co...
algebra := proc (i, j) options operator, arrow; %Commutator(Component(r_, i), Component(p_, j)) = `*`(I, `*`(KroneckerDelta[i, j])), %Commutator(Component(r_, i), Component(r_, j)) = 0, %Commutator(Co...
algebra := proc (i, j) options operator, arrow; %Commutator(Component(r_, i), Component(p_, j)) = `*`(I, `*`(KroneckerDelta[i, j])), %Commutator(Component(r_, i), Component(r_, j)) = 0, %Commutator(Co...
algebra := proc (i, j) options operator, arrow; %Commutator(Component(r_, i), Component(p_, j)) = `*`(I, `*`(KroneckerDelta[i, j])), %Commutator(Component(r_, i), Component(r_, j)) = 0, %Commutator(Co...
Typesetting:-mprintslash([algebra := proc (i, j) options operator, arrow; %Commutator(Physics:-Vectors:-Component(r_, i), Physics:-Vectors:-Component(p_, j)) = Physics:-`*`(I, Physics:-KroneckerDelta[... (2.3.6)

现在可以使用 Matrix 构造器生成交换子,整个矩阵可以传递给 Setup

> Matrix(3, 3, algebra)
Typesetting:-mprintslash([Matrix([[Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([Matrix([[Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([Matrix([[Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([Matrix([[Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([Matrix([[Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([Matrix([[Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
(2.3.7)
> Setup(%)
Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
(2.3.8)

L_ 中的元素是:

> L[x] := Component(L_, 1)
Typesetting:-mprintslash([L[x] := `+`(Physics:-`*`(y, p[z]), `-`(Physics:-`*`(z, p[y])))], [`+`(Physics:-`*`(y, p[z]), `-`(Physics:-`*`(z, p[y])))]) (2.3.9)
> L[y] := Component(L_, 2)
Typesetting:-mprintslash([L[y] := `+`(Physics:-`*`(z, p[x]), `-`(Physics:-`*`(x, p[z])))], [`+`(Physics:-`*`(z, p[x]), `-`(Physics:-`*`(x, p[z])))]) (2.3.10)
> L[z] := Component(L_, 3)
Typesetting:-mprintslash([L[z] := `+`(Physics:-`*`(x, p[y]), `-`(Physics:-`*`(y, p[x])))], [`+`(Physics:-`*`(x, p[y]), `-`(Physics:-`*`(y, p[x])))]) (2.3.11)

使用 expansion 展开交换子:

> %Commutator(LL, L[x]); 1
Typesetting:-mprintslash([Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msup(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typese... (2.3.12)
> value(%)
Typesetting:-mprintslash([`+`(Physics:-`*`(y, `+`(`-`(`*`(`+`(I), `*`(Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([`+`(Physics:-`*`(y, `+`(`-`(`*`(`+`(I), `*`(Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([`+`(Physics:-`*`(y, `+`(`-`(`*`(`+`(I), `*`(Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
(2.3.13)
> zero := expand(%)
Typesetting:-mprintslash([zero := `+`(`-`(`*`(`+`(I), `*`(Physics:-`*`(z, p[y], y, p[y])))), `*`(I, `*`(Physics:-`*`(p[z], `*`(`^`(y, 2)), p[y]))), `-`(`*`(`+`(I), `*`(Physics:-`*`(y, p[z], p[y], y)))... (2.3.14)

为了验证上面的表达式确实等于0,需要考虑下面的交换子规则:

> Setup(alg)

`* Partial match of  'alg' against keyword 'algebrarules'`

Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mi(
(2.3.15)

使用 Simplify

> Simplify(zero)
0 (2.3.16)
> %Commutator(LL, Ly); 1
Typesetting:-mprintslash([Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msup(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typese... (2.3.17)
> Simplify(%)
0 (2.3.18)
> Simplify(Commutator(LL, Lz))
0 (2.3.19)

______________________________________________________________

2. 使用张量符号表示量子算子元件 L_, 显示为 (请参考Chap VI in Cohen-Tannoudji练习部分)。

设置时空张量为 3、欧几里德三维空间,因此“时空”张量实际上是三维空间张量。为了使用教科书式的符号,使用 lowercaselatin 张量索引(见帮助 Setup )。

> Setup(dimension = 3, signature = `+`, spacetimeindices = lowercaselatin, quiet)
[dimension = 3, signature = `+`, spacetimeindices = lowercaselatin] (2.3.20)

使用张量符号设置rpCommutator 规则,使用 Simplify 命令应用爱因斯坦求和约定求积, Define rp 为三维欧几里德空间的张量。

> Define(r, p)

`Defined objects with tensor properties`

{p, r, Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu... (2.3.21)

现在可以使用张量符号设置相关的交换子规则;消除前面关于量子算子的设置和代数规则(通过使用 Setup 中的 redo 参数项消除前面的定义,这里的例子不是必须的,但某些情况下需要)。

> Setup(redo, quantumoperators = '{L, L_, p, r}', algebrarules = {%Commutator(p[i], p[j]) = 0, %Commutator(r[i], p[j]) = `*`(I, `*`(kd_[i, j])), %Commutator(r[i], r[j]) = 0})
Setup(redo, quantumoperators = '{L, L_, p, r}', algebrarules = {%Commutator(p[i], p[j]) = 0, %Commutator(r[i], p[j]) = `*`(I, `*`(kd_[i, j])), %Commutator(r[i], r[j]) = 0})
Typesetting:-mprintslash([[algebrarules = {Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (2.3.22)

验证这些代数规则如何工作:

> %Commutator(r[m], p[n])
Typesetting:-mprintslash([Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (2.3.23)
> value(%)
`*`(I, `*`(Physics:-KroneckerDelta[m, n])) (2.3.24)
> Commutator(r[m], r[n])
0 (2.3.25)
> Commutator(p[m], p[n])
0 (2.3.26)

现在输入, 以及 r[j]p[k] 表示的 L[i]。对 LeviCivita 伪张量使用默认的缩写 ep_

> rule := %Commutator(L[i], L[j]) = `*`(I, `*`('ep_[i, j, k]', `*`(L[k])))
Typesetting:-mprintslash([rule := Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (2.3.27)
> L[i] := `*`(ep_[i, m, n], `*`(r[m], `*`(p[n])))
Typesetting:-mprintslash([L[i] := `*`(Physics:-`*`(r[m], p[n]), `*`(Physics:-LeviCivita[i, `~m`, `~n`]))], [`*`(Physics:-`*`(r[m], p[n]), `*`(Physics:-LeviCivita[i, `~m`, `~n`]))]) (2.3.28)
> L[j] := subs(i = j, L[i])
Typesetting:-mprintslash([L[j] := `*`(Physics:-`*`(r[m], p[n]), `*`(Physics:-LeviCivita[j, `~m`, `~n`]))], [`*`(Physics:-`*`(r[m], p[n]), `*`(Physics:-LeviCivita[j, `~m`, `~n`]))]) (2.3.29)
> L[k] := subs(i = k, L[i])
Typesetting:-mprintslash([L[k] := `*`(Physics:-`*`(r[m], p[n]), `*`(Physics:-LeviCivita[k, `~m`, `~n`]))], [`*`(Physics:-`*`(r[m], p[n]), `*`(Physics:-LeviCivita[k, `~m`, `~n`]))]) (2.3.30)

因此, 可以给定为:

> rule
Typesetting:-mprintslash([Typesetting:-msub(Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-mrow(Typesetting:-msub(Typesetting:-mi( (2.3.31)

用户可以展开这个规则,得到实际值,然后使用 Simplify 命令,

> expand(rule)
Typesetting:-mprintslash([`+`(`-`(`*`(Physics:-LeviCivita[i, `~m`, `~n`], `*`(Physics:-LeviCivita[j, `~a`, `~b`], `*`(`+`(`-`(`*`(`+`(I), `*`(Physics:-KroneckerDelta[b, m], `*`(Physics:-`*`(r[a], p[n]... (2.3.32)
> Simplify(%)
Typesetting:-mprintslash([`+`(`*`(I, `*`(Physics:-`*`(r[i], p[j]))), `-`(`*`(`+`(I), `*`(Physics:-`*`(r[j], p[i]))))) = `+`(`*`(I, `*`(Physics:-`*`(r[i], p[j]))), `-`(`*`(`+`(I), `*`(Physics:-`*`(r[j]... (2.3.33)

或者使用 Simplify 规则,而不是首先展开。

> Simplify(rule)

Typesetting:-mprintslash([`+`(`*`(I, `*`(Physics:-`*`(r[i], p[j]))), `-`(`*`(`+`(I), `*`(Physics:-`*`(r[j], p[i]))))) = `+`(`*`(I, `*`(Physics:-`*`(r[i], p[j]))), `-`(`*`(`+`(I), `*`(Physics:-`*`(r[j]... (2.3.34)

法律声明:© Maplesoft, Maple是Waterloo Maple Inc.的注册商标。该程序可能包含错误,莎益博公司对使用该材料导致的损失不承担责任。该程序仅适用非商业、非赢利用途。如果您想使用这个应用程序,请联系莎益博公司。



https://blog.sciencenet.cn/blog-516836-599836.html

上一篇:矩阵求解问题
下一篇:中文教材《MapleSim系统建模与仿真》
收藏 IP: 180.169.73.*| 热度|

1 黄富强

该博文允许注册用户评论 请点击登录 评论 (4 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-25 10:18

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部