微分と幾何学 (3)

微分と幾何学 (3)#

SymPyによる二次元リーマン多様体#

import sympy
from sympy import Matrix, BlockMatrix
from sympy.diffgeom.rn import R2_r, R2_p
print(R2_r)
print(R2_p)
rectangular
polar
Matrix(R2_r.base_scalars())
\[\begin{split}\displaystyle \left[\begin{matrix}\mathbf{x}\\\mathbf{y}\end{matrix}\right]\end{split}\]
Matrix(R2_p.base_scalars())
\[\begin{split}\displaystyle \left[\begin{matrix}\mathbf{\rho}\\\mathbf{\theta}\end{matrix}\right]\end{split}\]
s = R2_p.transform(R2_r, R2_p.base_scalars())
s
\[\begin{split}\displaystyle \left[\begin{matrix}\cos{\left(\mathbf{\theta} \right)} \mathbf{\rho}\\\sin{\left(\mathbf{\theta} \right)} \mathbf{\rho}\end{matrix}\right]\end{split}\]
s = R2_r.transform(R2_p, R2_r.base_scalars())
s
\[\begin{split}\displaystyle \left[\begin{matrix}\sqrt{\mathbf{x}^{2} + \mathbf{y}^{2}}\\\operatorname{atan}_{2}{\left(\mathbf{y},\mathbf{x} \right)}\end{matrix}\right]\end{split}\]
Matrix(R2_p.base_oneforms())
\[\begin{split}\displaystyle \left[\begin{matrix}\operatorname{d}\rho\\\operatorname{d}\theta\end{matrix}\right]\end{split}\]
Matrix(R2_p.base_vectors())
\[\begin{split}\displaystyle \left[\begin{matrix}\partial_{\rho}\\\partial_{\theta}\end{matrix}\right]\end{split}\]
%%ai vioras
二次元ユークリッド空間の第一形式について

二次元ユークリッド空間は、通常私たちが考える2次元空間のことを指します。これは通常、2つの直交する軸(通常はx軸とy軸と呼ばれます)によって定義されます。このような空間における点は、それぞれの軸に沿った座標のペア(x, y)によって一意に識別することができます。

「第一形式」という用語は、一般的に微分幾何学の文脈で使用されます。特に、微分形式の理論においては、「第一形式」は1-形式または微分1-形式と呼ばれます。

1-形式は、ベクトル場をスカラーにマッピングするために使用される数学的なオブジェクトです。二次元ユークリッド空間の場合、1-形式は通常、2つの成分を持ちます。これらの成分は、各軸に沿った「微分」を表します。具体的には、1-形式$\omega$は以下のように表されます:

$$\omega = dx \otimes \alpha + dy \otimes \beta$$

ここで、$\alpha$と$\beta$はスカラー関数であり、「$dx$」と「$dy$」は、それぞれx軸とy軸に沿った微分を表します。「$\otimes$」はテンソル積を表します。

1-形式は、ベクトル場と組み合わせて使用されることが一般的で、ベクトル場の各点における「方向導関数」を計算するのに役立ちます。

Matrix(R2_p.base_oneforms())
\[\begin{split}\displaystyle \left[\begin{matrix}\operatorname{d}\rho\\\operatorname{d}\theta\end{matrix}\right]\end{split}\]
Matrix(R2_p.base_vectors())
\[\begin{split}\displaystyle \left[\begin{matrix}\partial_{\rho}\\\partial_{\theta}\end{matrix}\right]\end{split}\]
%%ai vioras
線素 (line element) の長さを第一形式で表して下さい

二次元ユークリッド空間における線素(line element)の長さは、微小変化$dx$と$dy$に関して次のように表されます。

$$ds^2 = dx^2 + dy^2$$

ここで、$ds$は線素(line element)の微小の長さを表します。

この表現を微分1-形式(第一形式)の言葉で表現すると、次のようになります。

$$ds = \sqrt{(dx)^2 + (dy)^2}$$

ここで、$(dx)^2$と$(dy)^2$は微分1-形式の平方を表し、これらの和の平方根を取ることで、線素の長さ$ds$を得ます。

なお、これはユークリッド空間(つまり、通常の「平らな」空間)での表現であり、曲率を持つ空間(例えば、一般相対性理論の文脈で考えられるような)では、異なる表現が必要になることに注意してください。

%%ai vioras
計量テンソルは?

計量テンソル(または計量)は、一般相対性理論や微分幾何学の中心的な概念であり、特定の空間内の距離や角度を定義する方法を提供します。具体的には、計量テンソルは、特定の点における2つのベクトル間の内積を計算するためのツールとして機能します。

計量テンソルは通常、$g_{\mu\nu}$(ここで、$\mu$と$\nu$は指標)で表され、これは特定の座標系におけるテンソルの各成分を示します。二次元ユークリッド空間では、計量テンソルは次のようになります:

$$g = \begin{bmatrix} 1 & 0 \ 0 & 1 \end{bmatrix}$$

これは、二次元ユークリッド空間の標準的な座標(つまり、直交座標)に関して、内積が通常のユークリッド内積(つまり、スカラー積)になることを示しています。

計量テンソルは、空間の幾何学的性質(曲率など)を決定する基本的な要素であり、一般相対性理論のアインシュタインの場の方程式の出発点となります。また、計量テンソルを用いて、曲線の長さや面積、体積などを計算することができます。

%%ai vioras
極座標表示によって誘導される計量を求めて下さい

極座標系では、座標は一般に $(r, \theta)$ と表され、ここで $r$ は原点からの距離(半径)を、$\theta$ は正の x 軸からの角度を表します。

極座標系における微小距離(線素)$ds$は次のように表されます:

$$ds^2 = dr^2 + r^2 d\theta^2$$

この式は、半径方向の微小変化 $dr$ と角度方向の微小変化 $d\theta$ から直交座標系における微小距離の二乗 $ds^2$ を計算します。これは、微小円弧の長さを $r d\theta$ とし、ピタゴラスの定理を用いて得られます。

したがって、極座標系における計量テンソルは次のようになります:

$$g = \begin{bmatrix} 1 & 0 \ 0 & r^2 \end{bmatrix}$$

この計量テンソルは、極座標系における距離と角度の測定を可能にします。ここで、計量テンソルの成分 $g_{\mu\nu}$ は、座標間の内積を定義します。この場合、$g_{rr} = 1$ は半径方向の距離を、$g_{\theta\theta} = r^2$ は角度方向の距離を定義します。

Matrix(BlockMatrix([e(s) for e in R2_p.base_vectors()]))
\[\begin{split}\displaystyle \left[\begin{matrix}\cos{\left(\mathbf{\theta} \right)} & - \sin{\left(\mathbf{\theta} \right)} \mathbf{\rho}\\\sin{\left(\mathbf{\theta} \right)} & \cos{\left(\mathbf{\theta} \right)} \mathbf{\rho}\end{matrix}\right]\end{split}\]
ds = Matrix(BlockMatrix(ds)).multiply(Matrix(R2_p.base_oneforms()))
ds
\[\begin{split}\displaystyle \left[\begin{matrix}- \sin{\left(\mathbf{\theta} \right)} \mathbf{\rho} \operatorname{d}\theta + \cos{\left(\mathbf{\theta} \right)} \operatorname{d}\rho\\\sin{\left(\mathbf{\theta} \right)} \operatorname{d}\rho + \cos{\left(\mathbf{\theta} \right)} \mathbf{\rho} \operatorname{d}\theta\end{matrix}\right]\end{split}\]
ds2=sympy.expand(ds.dot(ds))
ds2
\[\displaystyle \sin^{2}{\left(\mathbf{\theta} \right)} \mathbf{\rho}^{2} \operatorname{d}\theta^{2} + \sin^{2}{\left(\mathbf{\theta} \right)} \operatorname{d}\rho^{2} + \cos^{2}{\left(\mathbf{\theta} \right)} \mathbf{\rho}^{2} \operatorname{d}\theta^{2} + \cos^{2}{\left(\mathbf{\theta} \right)} \operatorname{d}\rho^{2}\]
sympy.simplify(ds2.coeff(R2_p.base_oneform(0)**2))
\[\displaystyle 1\]
sympy.simplify(ds2.coeff(R2_p.base_oneform(1)**2))
\[\displaystyle \mathbf{\rho}^{2}\]
!pip install -U einsteinpy
Requirement already satisfied: einsteinpy in /opt/conda/lib/python3.11/site-packages (0.4.0)
Requirement already satisfied: numpy in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (1.26.4)
Requirement already satisfied: astropy in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (6.1.1)
Requirement already satisfied: matplotlib in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (3.8.4)
Requirement already satisfied: scipy>=1.0 in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (1.13.0)
Requirement already satisfied: plotly>=4.0 in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (5.22.0)
Requirement already satisfied: sympy>=1.1 in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (1.12)
Requirement already satisfied: numba!=0.49.0,>=0.46 in /opt/conda/lib/python3.11/site-packages (from einsteinpy) (0.60.0)
Requirement already satisfied: llvmlite<0.44,>=0.43.0dev0 in /opt/conda/lib/python3.11/site-packages (from numba!=0.49.0,>=0.46->einsteinpy) (0.43.0)
Requirement already satisfied: tenacity>=6.2.0 in /opt/conda/lib/python3.11/site-packages (from plotly>=4.0->einsteinpy) (8.2.3)
Requirement already satisfied: packaging in /opt/conda/lib/python3.11/site-packages (from plotly>=4.0->einsteinpy) (24.0)
Requirement already satisfied: mpmath>=0.19 in /opt/conda/lib/python3.11/site-packages (from sympy>=1.1->einsteinpy) (1.3.0)
Requirement already satisfied: pyerfa>=2.0.1.1 in /opt/conda/lib/python3.11/site-packages (from astropy->einsteinpy) (2.0.1.4)
Requirement already satisfied: astropy-iers-data>=0.2024.5.27.0.30.8 in /opt/conda/lib/python3.11/site-packages (from astropy->einsteinpy) (0.2024.7.22.0.34.13)
Requirement already satisfied: PyYAML>=3.13 in /opt/conda/lib/python3.11/site-packages (from astropy->einsteinpy) (6.0.1)
Requirement already satisfied: contourpy>=1.0.1 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (1.2.1)
Requirement already satisfied: cycler>=0.10 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (4.51.0)
Requirement already satisfied: kiwisolver>=1.3.1 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (1.4.5)
Requirement already satisfied: pillow>=8 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (10.3.0)
Requirement already satisfied: pyparsing>=2.3.1 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (3.1.2)
Requirement already satisfied: python-dateutil>=2.7 in /opt/conda/lib/python3.11/site-packages (from matplotlib->einsteinpy) (2.9.0)
Requirement already satisfied: six>=1.5 in /opt/conda/lib/python3.11/site-packages (from python-dateutil>=2.7->matplotlib->einsteinpy) (1.16.0)
import sympy
from sympy import sin, cos, tan, cot
import einsteinpy
einsteinpy.__version__
'0.4.0'
from einsteinpy.symbolic import MetricTensor
from einsteinpy.symbolic import ChristoffelSymbols, RiemannCurvatureTensor
from einsteinpy.symbolic import RicciTensor, RicciScalar
from sympy import sin, cos, tan, cot
syms = sympy.symbols('r theta')
syms
(r, theta)
r, theta = syms
g=sympy.diag(1,r**2)
g
\[\begin{split}\displaystyle \left[\begin{matrix}1 & 0\\0 & r^{2}\end{matrix}\right]\end{split}\]
metric = MetricTensor(g.tolist(), syms)
metric.tensor()
\[\begin{split}\displaystyle \left[\begin{matrix}1 & 0\\0 & r^{2}\end{matrix}\right]\end{split}\]