このワークシートはSageMathにおける微分可能多様体の取り扱いについての簡単な紹介です。以下で紹介するツールはSageManifolds プロジェクト (version 1.2, included in SageMath 8.2).を通じて実装されました。
ipnyb形式のワークシートファイルはここ からダウンロード可能です。このワークシートを実行するには、コマンドsage -n jupyter
などを使ってSageMathのJupyterノートブックインタフェースを起動する必要があります。
[訳注:この日本語版翻訳は山本 昇によって作成されました。翻訳者へのご連絡は、https://souran.kek.jp/kss/top/ を経由して、 職員情報詳細ページ内の「メール送信」リンクをご利用ください。この翻訳版作成にあたり、東海大学理学部北林さんには貴重なコメントをいただきました。この場を借りてお礼申しあげます。 (2023/05/05追記:原文の更新を反映しました。)]
このワークシートはSageMathのバージョン 9.2 (あるいはそれ以降)を必要としています、それ以前のバージョンではSageManifoldsの全ての機能が利用可能というわけではないからです。 [訳注:このjupyter notebookはSageMath 9.8 を使って実行しています。]
version()
'SageMath version 10.0, Release Date: 2023-05-20'
最初に、ノートブックが結果をLaTexを使った数式表示で表示するようにします。
%display latex
例として、 $\mathbb{R}$上の3次元の微分可能多様体を定義します。
M = Manifold(3, 'M', latex_name=r'\mathcal{M}', start_index=1)
3
, は多様体の次元です。SageManifoldsでは任意の正の整数を指定できます。'M'
, は多様体の名前を与える文字列です。この名前は = 記号の左辺にあるシンボルの名前(ここではM
)と
異なっていても構いません。左辺のシンボル名はコンピュータメモリのなかの多様体オブジェクトを参照しています。一方、
引数であたえる名前は、多様体に与えられた数学的な名前です。latex_name=r'\mathcal{M}'
, はこの多様体をLaTeXで表示する際に使う名前を指定します。
最初の引用符の前の 'r' に注意してください。:これはこの文字列が raw 文字列であることを示しています。
それによって文字列\mathcal
中のバックスラッシュ '\' は通常の文字として取り扱われます( '\\' としてエスケープする必要がないということです)。
この引数(latex_name
)が省略された場合は、第2引数に与えられた名前(ここではM
です)が使われます。start_index=1
は多様体のテンソル成分の指標の範囲を指定しています。これを1とすることは指標の範囲が$\{1,2,3\}$であることを示しています。この引数の既定値は start_index=0
です。規定のベースフィールド(基底)は$\mathbb{R}$であることに注意してください。もし、
field='complex'
,が与えられていれば、複素数体$\mathbb{C}$を基底として持つ
多様体が定義されます。[list of all options を参照のこと]
Note that the default base field is $\mathbb{R}$. If we would have used the optional argument `field='complex'`, we would have defined a manifold over $\mathbb{C}$. See the [list of all options](http://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/manifold.html#sage.manifolds.manifold.Manifold) for more details.
Mを要求すると、そのLaTexのシンボルとして表示されます。
M
代わりに print
関数を使うと、簡潔な記述が表示されます。
print(M)
3-dimensional differentiable manifold M
show()
関数を使って、LaTeXを使って表示することを明示することもできます。
show(M)
type
コマンドを使うと、M
に対応するPythonオブジェクトのタイプ(DifferentiableManifold_with_category
)が表示できます。
Via the command type, we get the type of the Python object corresponding to M (here the Python class DifferentiableManifold_with_category):
print(type(M))
<class 'sage.manifolds.differentiable.manifold.DifferentiableManifold_with_category'>
category()
関数を使って、多様体M
のカテゴリーを調べます。この例では、この多様体の
カテゴリーは$\mathbb{R}$の上の滑らかな多様体であることがわかります。
category(M)
多様体の指標(を表すgeneator
)は irange()
メソッドで生成されます。この指標は for
-ループなどで使われます。
The indices on the manifold are generated by the method irange(), to be used in loops:
[i for i in M.irange()]
このように単純な場合には、 list()
関数が利用可能です。
list(M.irange())
start_index
パラメータが明示的に指定されていない場合、多様体の指標は 0 からはじまります、例えばこの例のように(0,1,2) の範囲となります。
If the parameter start_index had not been specified, the default range of the indices would have been $\{0,1,2\}$ instead:
M0 = Manifold(3, 'M', r'\mathcal{M}')
[i for i in M0.irange()]
まずは、多様体 $\mathcal{M}$ は一つの座標系で覆われると仮定します(そうでない場合は以下で議論されます)。
座標系 X
は次のように宣言されます。
Let us assume that the manifold $\mathcal{M}$ can be covered by a single chart (other cases are discussed below); the chart is declared as follows:
X.<x,y,z> = M.chart()
上式の左辺にある.<x,y,z>
は Pythonの変数 x
, y
and z
が座標系の軸名として使われることを意味します。
これにより、座標軸を名前で指定することが可能になります。
この例では、関数 chart()
は引数をもっていません。この場合には、座標の名前は、x
, y
と z
(即ち、左辺の <...>
演算子で与えられた名前)になります。また座標の範囲は $(-\infty,+\infty)$ となります。それ以外の座標の名前やその範囲を指定する場合には chart()
にそれらを引数として与えなければなりません。座標名と異なる LaTex で使われる名前を指定する場合も同様です。(以下にそのような例が示されます。)
座標系は座標系が覆う開集合(ここでは多様体自身)と座標の組で表示されます。
The chart is displayed as a pair formed by the open set covered by it (here the whole manifold) and the coordinates:
print(X)
Chart (M, (x, y, z))
X
それぞれの座標値は指標を使って入手できます。指標の指定方法は多様体の定義時の設定(start_index=1
)に従います。
The coordinates can be accessed individually, by means of their indices, following the convention defined by start_index=1 in the manifold's definition:
X[1]
X[2]
X[3]
座標の全体は[:]
演算子を使って取得します。
The full set of coordinates is obtained by means of the operator [:]:
X[:]
座標系定義で使った <x,y,z>
演算子のおかげで、それぞれの座標をこの名前を使って直接取り扱えます。
z is X[3]
座標は SageMath の記号表現になっています。
print(type(z))
<class 'sage.symbolic.expression.Expression'>
実数値をもつ座標の関数 (数学的にいえば、座標の終域で定義された関数) は チャートのfunction()
メソッドを使って生成されます。
Real-valued functions of the chart coordinates (mathematically speaking, functions defined on the chart codomain) are generated via the method function() acting on the chart:
f = X.function(x+y^2+z^3)
f
f.display()
f(1,2,3)
これらの関数は、SageManiforldsのクラス ChartFunction
(実際には、そのサブクラス𝙲𝚑𝚊𝚛𝚝𝙵𝚞𝚗𝚌𝚝𝚒𝚘𝚗𝚁𝚒𝚗𝚐_𝚠𝚒𝚝h_𝚌𝚊𝚝𝚎𝚐𝚘𝚛𝚢.𝚎𝚕𝚎𝚖𝚎𝚗t_𝚌𝚕𝚊𝚜𝚜
)に属しています。
print(type(f))
<class 'sage.manifolds.chart_func.ChartFunctionRing_with_category.element_class'>
そしてこのChartFunction
クラスに属する関数は、標準的な SageMath の記号的関数とは全ての演算で自動的簡約化の振る舞いが異なっています。
例えば、二つの記号的関数の和:
and differ from SageMath standard symbolic functions by automatic simplifications in all operations. For instance, adding the two symbolic functions
f0(x,y,z) = cos(x)^2 ; g0(x,y,z) = sin(x)^2
は、次の結果になります。
results in
f0 + g0
一方、ChartFunction
クラスに属する関数は自動的に簡約化されます。
while the sum of the corresponding functions in the class ChartFunction is automatically simplified:
f1 = X.function(cos(x)^2) ; g1 = X.function(sin(x)^2)
f1 + g1
同じ結果を記号的関数でも得るためには、simplify_trig()
メソッドを使います。
To get the same output with symbolic functions, one has to invoke the method simplify_trig():
(f0 + g0).simplify_trig()
違いは表示方法にもあります。記号関数 f0
を表示させると、
Another difference regards the display; if we ask for the symbolic function f0, we get:
f0
となりますが、座標関数 f1
を表示させると、座標表示だけが表示されます。
while if we ask for the chart function f1, we get only the coordinate expression:
f1
f0
の場合と同じような表示を望む場合には、 display()
メソッドを使います。
To get an output similar to that of f0, one should call the method display():
f1.display()
expr()
メソッドは基になる記号表現を返すことを覚えておいてください。
f1.expr()
print(type(f1.expr()))
<class 'sage.symbolic.expression.Expression'>
まず、多様体$\mathcal{M}$の部分集合を考えましょう。
例えば、$\{y=0, x\geq 0\}$ で定義される領域の補集合 $U$ です
[ (y!=0, x<0)
は $y\not=0$ OR $x<0$を意味していることに注意してください; $y\not=0$ AND $x<0$ は[y!=0, x<0]
となります]。
U = M.open_subset('U', coord_def={X: (y!=0, x<0)})
開部分集合$U$に制限された座標系 X
を X_U
と呼ぶことにします。
X_U = X.restrict(U)
X_U
$U$上の別の座標系 Y
を球面座標 $(r,\theta,\phi)$ を使って導入します。
We introduce another chart on $U$, with spherical-type coordinates $(r,\theta,\phi)$:
Y.<r,th,ph> = U.chart(r'r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi')
Y
ここでの関数 chart()
は引数を持っています。それはraw文字列でLaTexのシンボルを含んでいます。また、この文字列には座標の(既定値の $(-\infty, +\infty)$ とは異なる)範囲指定が含まれています。フィールドは:
で区切られており、座標は空白文字で区切られています。 座標 $r$ については、LaTexシンボルを指定していないので、下限と上限の二つだけが指定されています。LaTexシンボルは出力の際に使われます。
The function chart() has now some argument; it is a string, which contains specific LaTeX symbols, hence the prefix 'r' to it (for raw string). It also contains the coordinate ranges, since they are different from the default value, which is $(-\infty, +\infty)$. For a given coordinate, the various fields are separated by the character ':' and a space character separates the coordinates. Note that for the coordinate $r$, there are only two fields, since the LaTeX symbol has not to be specified. The LaTeX symbols are used for the outputs:
Sageが使っている座標の条件は、assumptions()
メソッドを使って確認することができます。
The declared coordinate ranges are now known to Sage, as we may check by means of the command assumptions():
assumptions()
これらの条件は、表現の簡約化の際に使われます。
They are used in simplifications:
simplify(abs(r))
$r >0$ と仮定されているので、$\mathrm{abs}(r)$ は $r$ に簡約されます。
simplify(abs(x)) # no simplification occurs since x can take any value in R
$x$ は$R$の負の値を含むどんな値でも取ることができますから、$\mathrm{abs}(x)$ は簡約できません。
座標 $Y$が宣言されたあとで、さらに 遷移写像を指定することで、$Y$の$X_U$への関係を完全に特定することができます。
After having been declared, the chart Y can be fully specified by its relation to the chart X_U, via a transition map:
transit_Y_to_X = Y.transition_map(
X_U,
[r*sin(th)*cos(ph), r*sin(th)*sin(ph), r*cos(th)]
)
transit_Y_to_X
transit_Y_to_X.display()
set_inverse()
メソッドを用いることで、遷移写像の逆写像を指定することができます。
The inverse of the transition map can be specified by means of the method set_inverse():
transit_Y_to_X.set_inverse(sqrt(x^2+y^2+z^2), atan2(sqrt(x^2+y^2),z), atan2(y, x))
Check of the inverse coordinate transformation: r == r *passed* th == arctan2(r*sin(th), r*cos(th)) **failed** ph == arctan2(r*sin(ph)*sin(th), r*cos(ph)*sin(th)) **failed** x == x *passed* y == y *passed* z == z *passed* NB: a failed report can reflect a mere lack of simplification.
導かれた逆写像は、それと元の写像を組み合わせることで検証できます。 左辺と右辺がそれぞれに対応しています。 上の結果が示しているように、thとphの検証が失敗したと報告されているのは、 arctan2が関係する表式の単純化が不十分であることに起因しています。
逆写像を表示させてみましょう。
transit_Y_to_X.inverse().display()
この段階で、多様体のアトラス( user atlas
であって最大アトラスではありません)は三つの座標系を含んでいます。
At this stage, the manifold's atlas (the "user atlas", not the maximal atlas!) contains three charts:
M.atlas()
多様体に最初に定義された座標系は既定の座標系とみなされます。既定座標系はあとで、set_default_chart()
メソッドを使って変更できます。
The first chart defined on the manifold is considered as the manifold's default chart (it can be changed by the method set_default_chart()):
M.default_chart()
各々の開部分空間は各自のアトラスを持っています。開部分空間はそれ自身でも多様体であるからです。
Each open subset has its own atlas (since an open subset of a manifold is a manifold by itself):
U.atlas()
U.default_chart()
Y.plot(X,color={r:'red', th:'green', ph:'blue'})
Y.plot(X)
コマンドを使って、座標系$Y$を座標系$X$を使って表示することができます。このコマンドは、座標系$Y$で一定の座標値を持つ線を、座標系$X$に基づく"直交フレーム"中に表示します。
Y.plot(X, color={r:'blue', th:'green', ph:'red'}, aspect_ratio=1)
コマンドplot()
は多くのオプションを持っています。オプションを使い、描画される座標線の数、スタイル、色、そして座標の範囲などを指定します。
(参照:list of all options):
Y.plot(X, ranges={r:(1,2), th:(0,pi/2)}, number_values=4,
color={r:'blue', th:'green', ph:'red'}, aspect_ratio=1)
逆に、(制限された)座標系 $X|_{U}$ を座標系$Y$を使って表示することも可能です。この場合、座標系 $X$ の全てを表示することはできません、なぜなら $X$ の定義域(ドメイン)は $Y$ のそれより広いからです。
Conversly, the chart $X|_{U}$ can be plotted in terms of the chart $Y$ (this is not possible for the whole chart $X$ since its domain is larger than that of chart $Y$):
graph = X_U.plot(Y,color={x:'blue',y:'green', z:'red'})
show(graph, axes_labels=['r','theta','phi'])
オプションを追加してすることで、グラフを見やすくできます。
graph = X_U.plot(Y, ranges={x:(0,2), y:(0,2),z:(0,2),
r:(0,5), th:(0,pi/2), ph:(0, 2*pi) },
number_values=4,
color={x:'blue',y:'green', z:'red'})
show(graph, axes_labels=['r','theta','phi'])
多様体$\mathcal{M}$上の点は、与えられた座標系での座標を使って定義されます。
A point on $\mathcal{M}$ is defined by its coordinates in a given chart:
p = M.point((1,2,-1), chart=X, name='p') ; print(p) ; p
Point p on the 3-dimensional differentiable manifold M
$X=(\mathcal{M}, (x,y,z))$ は既定の座標系ですから、その名前を省略することが可能です。
Since $X=(\mathcal{M}, (x,y,z))$ is the manifold's default chart, its name can be omitted:
p = M.point((1,2,-1), name='p') ; print(p) ; p
Point p on the 3-dimensional differentiable manifold M
もちろんpは多様体$\mathcal{M}$中の点です。
Of course, $p$ belongs to $\mathcal{M}$:
p in M
この点は$U$の中の点でもあります。
It is also in $U$:
p in U
実際、点$p$の座標 $y$ は 0 ではありません ( $y\not=0$ ):(Uは $ y!=0 || x<0 $で定義された開領域)
Indeed the coordinates of $p$ have $y\not=0$:
p.coord(X)
ここで、$X$は$\mathcal{M}$の既定座標系であることから coord()
にわたす引数では、省略可能であることに注意してください。
Note in passing that since $X$ is the default chart on $\mathcal{M}$, its name can be omitted in the arguments of coord():
p.coord()
$p$の座標値は、座標系を点$p$に作用させることによっても得ることができます(座標系の定義により!):
The coordinates of $p$ can also be obtained by letting the chart acting of the point (from the very definition of a chart!):
X(p)
別の点 $q$ を $y = 0$ and $x \geq 0$を満たす一つの点として定義します。
Let $q$ be a point with $y = 0$ and $x \geq 0$:
q = M.point((1,0,2), name='q')
$q$は$U$には属しません。
This time, the point does not belong to $U$:
q in U
従って、点$q$の座標系$Y=(U, (r,\theta,\phi))$ での座標値を求めることはできません。
Accordingly, we cannot ask for the coordinates of $q$ in the chart $Y=(U, (r,\theta,\phi))$:
try:
q.coord(Y)
except ValueError as exc:
print("Error: " + str(exc))
Error: the point does not belong to the domain of Chart (U, (r, th, ph))
しかし、点$p$については可能です。
but we can for point $p$:
p.coord(Y)
Y(p)
点は比較可能です。:
Points can be compared:
q == p
p1 = U.point((sqrt(3)*sqrt(2), pi-atan(sqrt(5)), atan(2)), chart=Y)
p1 == p
SageMathの用語では、点は それが定義された多様体を 親(parents) として持つ 要素(elements) です。
In SageMath's terminology, points are elements, whose parents are the manifold on which they have been defined:
p.parent()
q.parent()
p1.parent()
スカラー場 は微分可能な写像 $U \longrightarrow \mathbb{R}$ のことです。ここで $U$ は多様体$\mathcal{M}$の開部分集合です。 スカラー場はその定義域を覆う座標系を使った式で定義されます。一般には、一つ以上の座標系が定義域全体を覆うためには必要となります。
f = U.scalar_field({X_U: x+y^2+z^3}, name='f') ; print(f)
Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M
座標で書かれた表式は、座標系をキーとしたPythonの辞書型データ{X_U: x+y^2+z^3}
として渡されます。
この例では、辞書には一つの座標系しかありませんので、次のような表現も可能です。
The coordinate expressions of the scalar field are passed as a Python dictionary, with the charts as keys, hence the writing {X_U: x+y^2+z^3}.
Since in the present case, there is only one chart in the dictionary, an alternative writing is
f = U.scalar_field({X_U:x+y^2+z^3}, name='f')
print(f)
Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M
$X_U$ は定義域 ($U$) の既定の座標系ですので、上記の表現では省略可能です。
Since X_U is the domain's default chart, it can be omitted in the above declaration:
f = U.scalar_field(x+y^2+z^3, name='f') ; print(f)
Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M
スカラー場は定義域となる多様体から実数体への写像ですから、それは点に対して働き、座標値に対して働くものではありません。
f(p)
スカラー場のdisplay()
メソッドは与えられた座標系でのスカラー場の表現を表示します。
f.display(X_U)
引数なしで呼び出された場合、display()
メソッドは 定義域 $U$ の上で定義された全ての座標系について、座標表現を表示します。
(但し副座標系,即ち制限された副定義域のみで定義された座標系は除きます。)
f.display()
スカラー場 $f$の 座標$(r,\theta,\phi)$ での表現はユーザによって与えられたものではなく、座標系の遷移写像で定義された座標変換のルールを使って自動的に導出されていることに注意してください。
Note that the expression of $f$ in terms of the coordinates $(r,\theta,\phi)$ has not been provided by the user but has been automatically computed by means of the change-of-coordinate formula declared above in the transition map.
f.display(Y)
各座標系で、スカラー場は座標の関数(CoordFunctionSymb
のオブジェクト)として表現されます。このオブジェクトはcoord_function()
メソッドを通じてアクセス可能です。
In each chart, the scalar field is represented by a function of the chart coordinates (an object of the type CoordFunctionSymb described above), which is accessible via the method coord_function():
f.coord_function(X_U)
f.coord_function(X_U).display()
f.coord_function(Y)
f.coord_function(Y).display()
"生"の記号的表現は、expr()
メソッドの戻り値として返されます。
The "raw" symbolic expression is returned by the method expr():
f.expr(X_U)
f.expr(Y)
f.expr(Y) is f.coord_function(Y).expr()
スカラー場は具体的な式ではなく、座標値の関数を用いて定義することも可能です。
A scalar field can also be defined by some unspecified function of the coordinates:
h = U.scalar_field(function('H')(x, y, z), name='h') ; print(h)
Scalar field h on the Open subset U of the 3-dimensional differentiable manifold M
h.display()
h.display(Y)
h(p) # remember that p is the point of coordinates (1,2,-1) in the chart X_U
$f$の親(parent)は すべての $U$ 上の滑らかなスカラー場からなる集合 $C^\infty(U)$ です。これは$\mathbb{R}$上の 可換代数です。
The parent of $f$ is the set $C^\infty(U)$ of all smooth scalar fields on $U$, which is a commutative algebra over $\mathbb{R}$:
CU = f.parent() ; CU
print(CU)
Algebra of differentiable scalar fields on the Open subset U of the 3-dimensional differentiable manifold M
CU.category()
代数$CU$の基礎体となる環は実数体$\mathbb{R}$です。それはSageMathではSymbolic Ring (SR)で表現されます。
CU.base_ring()
スカラー場の演算は代数構造を通じて定義されます。
Arithmetic operations on scalar fields are defined through the algebra structure:
s = f + 2*h ; print(s)
Scalar field on the Open subset U of the 3-dimensional differentiable manifold M
s.display()
点 $p$での多様体の接ベクトル空間を次のようにして取り出します。
The tangent vector space to the manifold at point $p$ is obtained as follows:
Tp = M.tangent_space(p) ; Tp
print(Tp)
Tangent space at Point p on the 3-dimensional differentiable manifold M
$T_p\, \mathcal{M}$は $\mathbb{R}$上の3次元のベクトル空間です。
$T_p\, \mathcal{M}$ is a 3-dimensional vector space over $\mathbb{R}$ (represented here by SageMath's Symbolic Ring (SR)) :
print(Tp.category())
Category of finite dimensional vector spaces over Symbolic Ring
Tp.dim()
$T_p\, \mathcal{M}$のベクトルの基底は点$p$の周りのベクトルフレームから誘導されます。
$T_p\, \mathcal{M}$ is automatically endowed with vector bases deduced from the vector frames defined around the point:
Tp.bases()
対照的に、点 $q$ については、あらかじめ定義された基底は一つだけです。 $q$ はドメイン $U$ に含まれませんので、$(r,\theta,\phi)$ に関連づけれられていません。
For the tangent space at the point $q$, on the contrary, there is only one pre-defined basis, since $q$ is not in the domain $U$ of the frame associated with coordinates $(r,\theta,\phi)$:
Tq = M.tangent_space(q)
Tq.bases()
ランダムな要素:
A random element:
v = Tp.an_element() ; print(v)
Tangent vector at Point p on the 3-dimensional differentiable manifold M
v.display()
u = Tq.an_element() ; print(u)
Tangent vector at Point q on the 3-dimensional differentiable manifold M
u.display()
上記の簡略化された表現(基底ベクトルに点$p$あるいは$q$の指定がない)から類推されるのとは異なり、$u$と$v$は異なるベクトルです。これらは異なったベクトル空間に属しています。:
Note that, despite what the above simplified writing may suggest (the mention of the point $p$ or $q$ is omitted in the basis vectors), $u$ and $v$ are different vectors, for they belong to different vector spaces:
v.parent()
u.parent()
とくに $u$と$v$を足し合わせることはできません。
In particular, it is not possible to add $u$ and $v$:
try:
s = u + v
except TypeError as exc:
print("Error: ", str(exc))
Error: unsupported operand parent(s) for +: 'Tangent space at Point q on the 3-dimensional differentiable manifold M' and 'Tangent space at Point p on the 3-dimensional differentiable manifold M'
全ての座標系は座標系のドメインの上のベクトルフレームを持っています。これは、coordinate basis
と呼ばれます、
Each chart defines a vector frame on the chart domain: the so-called coordinate basis:
X.frame()
X.frame().domain() # this frame is defined on the whole manifold このフレームは多様体全体で定義されています。
Y.frame()
座標系 $Y$ のフレームは、部分多様体 $U$ でのみ定義されています。
Y.frame().domain() # このフレームは部分多様体 $U$でのみ定義されています。
frames()
メソッドによって、与えられた開空間で定義されたフレームのリストが入手可能です。
The list of frames defined on a given open subset is returned by the method frames():
M.frames()
U.frames()
M.default_frame()
set_default_frame()
メソッドで別途明示的に指定されない限り、基底の座標系に関連づけられるベクトルフレームが基底のフレームです。
Unless otherwise specified (via the command set_default_frame()), the default frame is that associated with the default chart:
M.default_frame() is M.default_chart().frame()
U.default_frame() is U.default_chart().frame()
フレームのそれぞれの要素は指標を使って指定できます。
Individual elements of a frame can be accessed by means of their indices:
e = U.default_frame() ; e2 = e[2] ;e2
print(e2)
Vector field ∂/∂y on the Open subset U of the 3-dimensional differentiable manifold M
新しいベクトル場を次のようにして、定義できます。
We may define a new vector field as follows:
v = e[2] + 2*x*e[3] ; print(v)
Vector field on the Open subset U of the 3-dimensional differentiable manifold M
v.display()
ベクトル場は与えられたベクトルフレームに関する要素を指定することで、定義できます。 もしベクトルフレームが指定されていない場合には、既定のフレームがもちろん仮定されます。
A vector field can be defined by its components with respect to a given vector frame. When the latter is not specified, the open set's default frame is of course assumed:
v = U.vector_field(name='v') # vector field defined on the open set U
v[1] = 1+y
v[2] = -x
v[3] = x*y*z
v.display()
SageMath 8.8 以降では、ベクトルフィールドの成分はそれを宣言する時に設定することができます。従って、上記は次の宣言と等価です。
v = U.vector_field(1+y, -x, x*y*z, name='v') # valid only in SageMath 8.8 and higher
v.display()
$U$上のベクトル場はSageの 要素(element) オブジェクトです。その 親(parent) は $U$上で定義されたベクトル場の集合$\mathfrak{X}(U)$ に設定されています。
Vector fields on $U$ are Sage element objects, whose parent is the set $\mathfrak{X}(U)$ of vector fields defined on $U$:
v.parent()
集合 $\mathfrak{X}(U)$ は$U$で定義されたのスカラー場の可換代数$C^\infty(U)$上のモジュールです。
The set $\mathfrak{X}(U)$ is a module over the commutative algebra $C^\infty(U)$ of scalar fields on $U$:
print(v.parent())
Free module X(U) of vector fields on the Open subset U of the 3-dimensional differentiable manifold M
print(v.parent().category())
Category of finite dimensional modules over Algebra of differentiable scalar fields on the Open subset U of the 3-dimensional differentiable manifold M
v.parent().base_ring()
ベクトル場はスカラー場に作用します。
A vector field acts on scalar fields:
f.display()
s = v(f) ; print(s)
Scalar field v(f) on the Open subset U of the 3-dimensional differentiable manifold M
s.display()
e[3].display()
e[3](f).display()
設定されていない要素は、0 と仮定されます。
Unset components are assumed to be zero:
w = U.vector_field(name='w')
w[2] = 3
w.display()
$U$上のベクトル場は座標系 $(r,\theta,\phi)$ に関係付けられているベクトルフレームで展開することができます。
A vector field on $U$ can be expanded in the vector frame associated with the chart $(r,\theta,\phi)$:
v.display(Y.frame())
既定の設定では、要素は既定の座標 $(x,y,z)$ を用いて、表現されます。これらの要素を 別の座標 $(r,\theta,\phi)$ を用いて表現するには、
display()
メソッドの2番目の引数として、対応する座標系を指定することが必要です。
By default, the components are expressed in terms of the default coordinates $(x,y,z)$. To express them in terms of the coordinates $(r,\theta,\phi)$, one should add the corresponding chart as the second argument of the method display():
v.display(Y.frame(), Y)
for i in M.irange():
show(e[i].display(Y.frame(), Y))
既定のフレームに関するテンソル場の要素は、コマンド [:]
を使うことで、リストとして取り出せます。
The components of a tensor field w.r.t. the default frame can also be obtained as a list, via the command [:]:
v[:]
別の方法として、display_comp()
メソッドを使うこともできます。
An alternative is to use the method display_comp():
v.display_comp()
別のフレームについての要素を取り出すには、comp()
メソッドを通じて要素を取り出すフレームを指定する必要があります。
To obtain the components w.r.t. to another frame, one may go through the method comp() and specify the frame:
v.comp(Y.frame())[:]
しかしながら、最初の引数にフレームを与える 短縮表現も用意されています。
However a shortcut is to provide the frame as the first argument of the square brackets:
v[Y.frame(), :]
v.display_comp(Y.frame())
要素は、既定の座標系の座標で表現されます。これらの別の座標系の座標、例えば$(r,\theta,\phi)$、で表現したい時には、
[]
の最後の引数として、座標系の名前を与えます。
Components are shown expressed in terms of the default's coordinates; to get them in terms of the coordinates $(r,\theta,\phi)$ instead, add the chart name as the last argument in the square brackets:
v[Y.frame(), :, Y]
あるいは、display_comp()
の引数に座標系の名前を与えます。
or specify the chart in display_comp():
v.display_comp(Y.frame(), chart=Y)
v.display_comp(Y.frame(),chart=X_U)
ベクトル場の成分を座標についての表現ではなく、スカラーフィールドとして取り出すために、二重の括弧 [[]]
を使います。
print(v[[1]])
Scalar field on the Open subset U of the 3-dimensional differentiable manifold M
v[[1]].display()
[v[[i]].expr(X_U) for i in range(1,4)]
ベクトル場は関数オブジェクトを要素として定義することも可能です。
A vector field can be defined with components being unspecified functions of the coordinates:
u = U.vector_field(name='u')
u[:] = [function('u_x')(x,y,z),
function('u_y')(x,y,z),
function('u_z')(x,y,z)]
u.display()
s = v + u ; s.set_name('s') ; s.display()
多様体中のある点でのベクトル場の値はat()
メソッドを通じて入手します。
The value of a vector field at some point of the manifold is obtained via the method at():
vp = v.at(p) ; print(vp)
Tangent vector v at Point p on the 3-dimensional differentiable manifold M
vp.display()
座標系 $X_U$ = $(x,y,z)$ を使った、点$p$の座標と、ベクトル場$v$の要素は次のようになっていたことを思い出してください。
Indeed, recall that, w.r.t. chart X_U=$(x,y,z)$, the coordinates of the point $p$ and the components of the vector field $v$ are
p.coord(X_U)
v.display(X_U.frame(), X_U)
記述を簡単にするために、点$p$でのベクトル場の値とベクトル場は同じ記号($v$)を使って表示されています。set_name()
メソッドを使うことで、
表示に使われる記号を変更できます。
Note that to simplify the writing, the symbol used to denote the value of the vector field at point $p$ is the same as that of the vector field itself (namely $v$); this can be changed by the method set_name():
vp.set_name(latex_name='v|_p')
vp.display()
もちろん、$v|_p$ は$p$の接ベクトル空間に属しています。
Of course, $v|_p$ belongs to the tangent space at $p$:
vp.parent()
vp in M.tangent_space(p)
up = u.at(p) ; print(up)
Tangent vector u at Point p on the 3-dimensional differentiable manifold M
up.display()
$\mathcal{M}$の1-形式とは、線形形式の場です。例えば、スカラー場の微分は1ー形式です。
A 1-form on $\mathcal{M}$ is a field of linear forms. For instance, it can be the differential of a scalar field:
df = f.differential() ; print(df)
1-form df on the Open subset U of the 3-dimensional differentiable manifold M
df.display()
上記の表現では、1-形式は座標系 $(x,y,z)$から導かれる基底$(\mathrm{d}x, \mathrm{d}y, \mathrm{d}z)$で展開されています。
この基底はcoframe()
メソッドで取り出すことが可能です。
In the above writing, the 1-form is expanded over the basis $(\mathrm{d}x, \mathrm{d}y, \mathrm{d}z)$ associated with the chart $(x,y,z)$. This basis can be accessed via the method coframe():
dX = X.coframe() ; dX
多様体 $M$の上に存在する全ての $coframe$ のリストは coframes()
メソッドを使って取り出します。
The list of all coframes defined on a given manifold open subset is returned by the method coframes():
M.coframes()
ベクトル場として、多様体上の点 $p$ における微分形式の値は at()
メソッドで取り出します。
As for a vector field, the value of the differential form at some point on the manifold is obtained by the method at():
dfp = df.at(p) ; print(dfp)
Linear form df on the Tangent space at Point p on the 3-dimensional differentiable manifold M
dfp.display()
なお、$p$の座標は次のようなものでした。
Recall that
p.coord()
線形形式 $\mathrm{d}f|_p$ は$p$の接ベクトル空間の双対空間に所属しています。
The linear form $\mathrm{d}f|_p$ belongs to the dual of the tangent vector space at $p$:
dfp.parent()
dfp.parent() is M.tangent_space(p).dual()
その結果、線形形式を$p$の接ベクトルに作用させると、実数が結果として得られます。
As such, it is acting on vectors at $p$, yielding a real number:
print(vp) ; vp.display()
Tangent vector v at Point p on the 3-dimensional differentiable manifold M
dfp(vp)
print(up) ; up.display()
Tangent vector u at Point p on the 3-dimensional differentiable manifold M
dfp(up)
一般的な関数で定義されるスカラー場 $h$ の 微分形式:
The differential 1-form of the unspecified scalar field $h$:
show(h.display())
dh = h.differential() ;
dh.display()
1-形式を何もないところから、定義することもできます。
具体的な定義がまだないので、display()
することはできません。
A 1-form can also be defined from scratch:
om = U.one_form(name='omega', latex_name=r'\omega')
print(om)
show(om)
try:
om.display()
except ValueError as m:
print("Value Error! ",m)
1-form omega on the Open subset U of the 3-dimensional differentiable manifold M
Value Error! no basis could be found for computing the components in the Coordinate frame (U, (∂/∂x,∂/∂y,∂/∂z))
与えられたcoframeの要素を与えることで、この1-形式を確定できます。
It can be specified by providing its components in a given coframe:
om[:] = [x^2+y^2, z, x-z] # components in the default coframe (dx,dy,dz)
om.display()
SageMath 8.8 以降では、1-形式の成分を宣言時に初期化することができます。上記の式は次の式と等価です。
om = U.one_form(
x^2+y^2, z, x-z, # valid only in SageMath 8.8 and higher
name='omega',
latex_name=r'\omega'
)
om.display()
もちろん、既定のフレームとは異なるフレームでの要素を指定することもできます。
Of course, one may set the components in a frame different from the default one:
om[Y.frame(), :, Y] = [r*sin(th)*cos(ph), 0, r*sin(th)*sin(ph)]
om.display(Y.frame(), Y)
この場合、coframe $(\mathrm{d}x,\mathrm{d}y,\mathrm{d}z)$での要素は自動的に更新されます。
The components in the coframe $(\mathrm{d}x,\mathrm{d}y,\mathrm{d}z)$ are updated automatically:
om.display()
元の要素の値に戻してみます。
Let us revert to the values set previously:
om[:] = [x^2+y^2, z, x-z]
om.display()
今度は、coframe $(\mathrm{d}r, \mathrm{d}\theta,\mathrm{d}\phi)$ についての要素は自動的に更新されています。
This time, the components in the coframe $(\mathrm{d}r, \mathrm{d}\theta,\mathrm{d}\phi)$ are those that are updated:
om.display(Y.frame(), Y)
1-形式は、ベクトル場に作用して、スカラー場を与えます。
A 1-form acts on vector fields, resulting in a scalar field:
print(om(v)) ; om(v).display()
Scalar field omega(v) on the Open subset U of the 3-dimensional differentiable manifold M
print(df(v)) ; df(v).display()
Scalar field df(v) on the Open subset U of the 3-dimensional differentiable manifold M
om(u).display()
スカラー場$f$から導かれた1ー形式については、次の恒等式が成立します。
In the case of a differential 1-form, the following identity holds:
df(v) == v(f)
1-形式は、親が $U$上で定義された全ての1ー形式からなる $C^\infty(U)$ 級のモジュール $\Omega^{1}(U)$ であるSageの element オブジェクトです。
df.parent()
print(df.parent())
Free module Omega^1(U) of 1-forms on the Open subset U of the 3-dimensional differentiable manifold M
print(om.parent())
Free module Omega^1(U) of 1-forms on the Open subset U of the 3-dimensional differentiable manifold M
$\Omega^{1}(U)$は自由モジュール $\mathfrak{X}(U)$の双対です。
df.parent() is v.parent().dual()
二つの1ー形式の 外積 は wedge()
メソッドを使って求められます。その結果は 2-形式となります。
The exterior product of two 1-forms is taken via the method wedge() and results in a 2-form:
a = om.wedge(df) ; print(a) ; a.display()
2-form omega∧df on the Open subset U of the 3-dimensional differentiable manifold M
行列形式での要素の表示:
A matrix view of the components:
a[:]
歪対称性から導かれる余分な要素を省き、ゼロでない成分だけを表示します:
Displaying only the non-vanishing components, skipping the redundant ones (i.e. those that can be deduced by antisymmetry):
a.display_comp(only_nonredundant=True)
2-形式 $\omega\wedge\mathrm{d}f$ を コフレーム $(\mathrm{d}r,\mathrm{d}\theta,\mathrm{d}\phi)$ での成分に展開することもできます。
The 2-form $\omega\wedge\mathrm{d}f$ can be expanded on the $(\mathrm{d}r,\mathrm{d}\theta,\mathrm{d}\phi)$ coframe:
a.display(Y.frame(), Y)
$A:=\omega\wedge\mathrm{d}f$ は2-形式として 二組のベクトルに作用させることができ、また歪対称です。
As a 2-form, $A:=\omega\wedge\mathrm{d}f$ can be applied to a pair of vectors and is antisymmetric:
a.set_name('A')
print(a(u,v)) ; a(u,v).display()
Scalar field A(u,v) on the Open subset U of the 3-dimensional differentiable manifold M
a(u,v) == - a(v,u)
a.symmetries()
no symmetry; antisymmetry: (0, 1)
ある微分形式の 外微分 は以下のように、exterior_derivative()
メソッドを使って求めます。
The exterior derivative of a differential form:
dom = om.exterior_derivative() ; print(dom) ; dom.display()
2-form domega on the Open subset U of the 3-dimensional differentiable manifold M
exterior_derivative()
メソッドを作用させる代わりに、関数 diff()
を使うこともできます(SageMath 9.2以降で利用可能)。
dom = diff(om)
dom
da = diff(a) ; print(da) ; da.display()
3-form dA on the Open subset U of the 3-dimensional differentiable manifold M
外微分 を続けて作用させると、結果は0になります。
The exterior derivative is nilpotent:
ddf = diff(df) ; ddf.display()
ddom = diff(dom) ; ddom.display()
テンソル場のあるベクトル場に関するLie微分は、lie_derivative()
メソッドを用いて計算します。
The Lie derivative of any tensor field with respect to a vector field is computed by the method lie_derivative(), with the vector field as the argument:
lv_om = om.lie_derivative(v) ; print(lv_om) ;
lv_om.display()
1-form on the Open subset U of the 3-dimensional differentiable manifold M
lu_dh = dh.lie_derivative(u) ; print(lu_dh) ;
lu_dh.display()
1-form on the Open subset U of the 3-dimensional differentiable manifold M
Cartanの恒等式を確かめてみましょう
1-形式$\omega$についてのCartanの恒等式 $$\mathcal{L}_v \omega = v\cdot \mathrm{d}\omega + \mathrm{d}\langle \omega, v\rangle$$ 2-形式$\omega$についてのCartanの恒等式 $$\mathcal{L}_v A = v\cdot \mathrm{d}A + \mathrm{d}(v\cdot A)$$
Let us check Cartan identity on the 1-form $\omega$:
$\mathcal{L}_v \omega = v\cdot \mathrm{d}\omega + \mathrm{d}\langle \omega, v\rangle$
and on the 2-form $A$:
$\mathcal{L}_v A = v\cdot \mathrm{d}A + \mathrm{d}(v\cdot A)$
om.lie_derivative(v) == v.contract(diff(om)) + diff(om(v))
a.lie_derivative(v) == v.contract(diff(a)) + diff(v.contract(a))
ベクトル場の別のベクトル場によるLie微分は、二つのベクトル場による 交換子積(あるいは 交換子) になります。
The Lie derivative of a vector field along another one is the commutator of the two vectors fields:
v.lie_derivative(u)(f) == u(v(f)) - v(u(f))
これまでに、次のようなテンソル場をみてきました。
より一般に、$(p,q)$型のテンソル場をSageManifoldsに導入することができます。 例えば、副多様体$U$上の(1,2)型のテンソル場を次のように宣言します。
t = U.tensor_field(1, 2, name='T') ; print(t)
Tensor field T of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M
ベクトルや1-形式と同じように、テンソル場の既定のフレームに関する要素を []
演算子を使って設定できます。
As for vectors or 1-forms, the tensor's components with respect to the domain's default frame are set by means of square brackets:
t[1,2,1] = 1 + x^2
t[3,2,1] = x*y*z
設定されていない要素は0です。
Unset components are zero:
t.display()
t[:]
0 でない要素を表示します。
Display of the nonzero components:
t.display_comp()
二重括弧[[]]
演算子は既定のフレームに関する成分をスカラー場として返します。一方、一重の括弧[]
演算子はこのスカラー場の既定の座標系についての表現を返します。
Double square brackets return the component (still w.r.t. the default frame) as a scalar field, while single square brackets return the expression of this scalar field in terms of the domain's default coordinates:
print(t[[1,2,1]]) ;
t[[1,2,1]].display()
Scalar field on the Open subset U of the 3-dimensional differentiable manifold M
print(t[1,2,1])
t[1,2,1]
x^2 + 1
(1,2)型のテンソル場は (1-形式、ベクトル場、ベクトル場)からなる3成分のタプルをスカラー場に写像します。
A tensor field of type (1,2) maps a 3-tuple (1-form, vector field, vector field) to a scalar field:
print(t(om, u, v))
t(om, u, v).display()
Scalar field T(omega,u,v) on the Open subset U of the 3-dimensional differentiable manifold M
ベクトル場や微分形式と同じように、多様体に定義されたどのフレームついてのテンソル場の成分も取り出せます。
As for vectors and differential forms, the tensor components can be taken in any frame defined on the manifold:
t[Y.frame(), 1,1,1, Y]
print(v.tensor_type())
print(a.tensor_type())
(1, 0) (0, 2)
b = v*a
print(b)
b
Tensor field v⊗A of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M
テンソル積は、(歪)対称性を保ちます。$A$は2-形式なので、二つの引数(位置0および1)について歪対称です。結果として$b$は最後の二つの引数(位置1および2)について歪対称となります。
The tensor product preserves the (anti)symmetries: since $A$ is a 2-form, it is antisymmetric with respect to its two arguments (positions 0 and 1); as a result, b is antisymmetric with respect to its last two arguments (positions 1 and 2):
a.symmetries()
no symmetry; antisymmetry: (0, 1)
b.symmetries()
no symmetry; antisymmetry: (1, 2)
標準的な テンソル 計算 は実装済みです。
Standard tensor arithmetics is implemented:
s = - t + 2*f* b
print(s)
Tensor field of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M
テンソルの縮約は trace()
メソッドおよび contract()
メソッドで取り扱われます。例として、テンソル $T$ の最初の二つの引数(位置 0 および 1) について縮約してみましょう。つまり、$c_i = T^k_{\ \, k i}$で与えられるテンソル $c$を構築してみましょう。
c = t.trace(0,1)
print(c)
1-form on the Open subset U of the 3-dimensional differentiable manifold M
trace(0,1)
と入力する代わりに、指標表記 を使って縮約を指定できます。指標は文字列として[]
演算子の中に記述されます。
文字列中で、"^" は反変指標の前、"_" は共変指標の前、に置かれます。
c1 = t['^k_ki']
print(c1)
c1 == c
1-form on the Open subset U of the 3-dimensional differentiable manifold M
縮約は繰り返された指標(ここでは $k$ です)について実行されます。それ以外の文字(ここでは $i$ )は任意です。
t['^k_kj'] == c
t['^b_ba'] == c
縮約されない指標については "."(ドット)で置き換え可能です。
It can even be replaced by a dot:
t['^k_k.'] == c
この文字列中ではLaTeX式の指定も可能です。
LaTeX notations are allowed:
t['^{k}_{ki}'] == c
SageMath 9.2以降では、ギリシャ文字を使うことも可能です。
t['^μ_μα'] == c
テンソル場 $T$ とベクトル場 $v$ の縮約 $T^i_{\ j k} v^k$ は次のようにして、実行されます。ここで、2は$T$の最後の指標の場所、0は$v$の唯一の指標の場所です。
The contraction $T^i_{\ j k} v^k$ of the tensor fields $T$ and $v$ is taken as follows (2 refers to the last index position of $T$ and 0 to the only index position of v):
tv = t.contract(2, v, 0)
print(tv)
Tensor field of type (1,1) on the Open subset U of the 3-dimensional differentiable manifold M
2はTの最後の指標の場所、0は$v$の唯一の指標の場所ですので、上記の表記の簡略版は次のようになります。
Since 2 corresponds to the last index position of $T$ and 0 to the first index position of $v$, a shortcut for the above is
tv1 = t.contract(v)
print(tv1)
Tensor field of type (1,1) on the Open subset U of the 3-dimensional differentiable manifold M
tv1 == tv
contract()
メソッドに替わって、指標表記 と 直積演算子 *
を組み合わせることで、縮約を表現できます。
Instead of contract(), the index notation, combined with the * operator, can be used to denote the contraction:
t['^i_jk']*v['^k'] == tv
繰り替えされない指標については、.
で置き換えることができます。
The non-repeated indices can be replaced by dots:
t['^._.k']*v['^k'] == tv
多様体$\mathcal{M}$のRiemann 計量 はつぎのように宣言されます。
A Riemannian metric on the manifold $\mathcal{M}$ is declared as follows:
g = M.riemannian_metric('g')
print(g)
Riemannian metric g on the 3-dimensional differentiable manifold M
計量 $g$ は対称な (0,2) 型のテンソル場です。
It is a symmetric tensor field of type (0,2):
g.parent()
print(g.parent())
Free module T^(0,2)(M) of type-(0,2) tensors fields on the 3-dimensional differentiable manifold M
g.symmetries()
symmetry: (0, 1); no antisymmetry
計量は、あるベクトルフレームに関する要素で初期化されます。例えば、 $\mathcal{M}$の既定のフレームを使って、
The metric is initialized by its components with respect to some vector frame. For instance, using the default frame of $\mathcal{M}$:
g[1,1], g[2,2], g[3,3] = 1, 1, 1
g.display()
別のベクトルフレームに関する成分を表示します。
The components w.r.t. another vector frame are obtained as for any tensor field:
g.display(Y.frame(), Y)
show(u.display())
もちろん計量は二つのベクトルに作用します。
Of course, the metric acts on vector pairs:
show(u.display());show(v.display());
print(g(u,v)) ;
g(u,v).display()
Scalar field g(u,v) on the Open subset U of the 3-dimensional differentiable manifold M
計量 $g$ に付随する Levi-Civita 接続は、.connection()
メソッドを使って求められます。:
The Levi-Civita connection associated to the metric $g$:
nabla = g.connection()
print(nabla)
nabla
Levi-Civita connection nabla_g associated with the Riemannian metric g on the 3-dimensional differentiable manifold M
多様体の既定の座標をつかってChristoffel記号を書き出します。 既定の座標系では、すべての成分が $0$ になっています。
The Christoffel symbols with respect to the manifold's default coordinates:
nabla.coef()[:]
次に、球面座標$(r,\theta,\phi)$を使って、Christoffel記号を書き出します。 空間の各店で、接ベクトルの向きが変わっていくことから、接続係数にも非零の成分が現れます。
The Christoffel symbols with respect to the coordinates $(r,\theta,\phi)$:
nabla.coef(Y.frame())[:, Y]
display()
を使って、見易く表示させて見ます。既定の設定では非零の接続係数のみが表示されます。
nabla.display(frame=Y.frame(), chart=Y)
計量のchristoffel_symbols_display()
メソッドを使うこともできます。この関数は(既定の設定では)独立なChristoffel記号だけを表示します。
g.christoffel_symbols_display(Y)
The connection acting as a covariant derivative:
nab_v = nabla(v)
print(nab_v) ; nab_v.display()
Tensor field nabla_g(v) of type (1,1) on the Open subset U of the 3-dimensional differentiable manifold M
v.display(Y)
v.display()
nab_v.display(Y)
nab_v.display()
Levi-Civita 接続係数であることから、 $\nabla_g$ には捩れ(torsion) はありません。
Being a Levi-Civita connection, $\nabla_g$ is torsion.free:
Levi-Civita接続は定義から、対称な接続係数なので、捩れはない。print(nabla.torsion()) ; nabla.torsion().display()
Tensor field of type (1,2) on the 3-dimensional differentiable manifold M
この例ではさらに、多様体は平坦(フラット, 曲率が0)です。
In the present case, it is also flat:
print(nabla.riemann()) ; nabla.riemann().display()
Tensor field Riem(g) of type (1,3) on the 3-dimensional differentiable manifold M
$g_{rr}$ を $1/(1+r^2)$と変更することで、曲率のある空間を考えましょう。
Let us consider a non-flat metric, by changing $g_{rr}$ to $1/(1+r^2)$:
g[Y.frame(), 1,1, Y] = 1/(1+r^2)
g.display(Y.frame(), Y)
簡単の為に、部分多様体$U$の既定の座標系をY=$(U,(r,\theta,\phi))$に変更します。
For convenience, we change the default chart on the domain $U$ to Y=$(U,(r,\theta,\phi))$:
U.set_default_chart(Y)
これによって、 $(r,\theta,\phi)$を使った座標表現を求める際に座標系 $Y$ を指定する必要がありません。
In this way, we do not have to specify Y when asking for coordinate expressions in terms of $(r,\theta,\phi)$:
g.display(Y.frame())
この計量は双曲空間 $\mathbb{H}^3$ の計量だと気がつきます。座標系 $(U,(x,y,z))$についての表現は、次のようになります。
We recognize the metric of the hyperbolic space $\mathbb{H}^3$. Its expression in terms of the chart $(U,(x,y,z))$ is
g.display(X_U.frame(), X_U)
要素の行列表示の方がより適切かもしれません。
A matrix view of the components may be more appropriate:
g[X_U.frame(), :, X_U]
もともとは $U$でのみ定義されていたこれらの成分を、全体の多様体$\mathcal{M}$までに拡張します。拡張は、座標系 X=$(\mathcal{M},(x,y,z))$ に付随するフレームでの座標表現が同じであることを要求して実行されます。
We extend these components, a priori defined only on $U$, to the whole manifold $\mathcal{M}$, by demanding the same coordinate expressions in the frame associated to the chart X=$(\mathcal{M},(x,y,z))$:
g.add_comp_by_continuation(X.frame(), U, X)
g.display()
Levi-Civita接続は、計量 $g$の変更後、自動的に再計算されます。
The Levi-Civita connection is automatically recomputed, after the change in $g$:
nabla = g.connection()
とくに、Christoffel 係数は、異なっています。
In particular, the Christoffel symbols are different:
nabla.display(only_nonredundant=True)
nabla.display(frame=Y.frame(), chart=Y, only_nonredundant=True)
Rimannテンソルは、今や:
The Riemann tensor is now
Riem = nabla.riemann()
print(Riem) ; Riem.display(Y.frame())
Tensor field Riem(g) of type (1,3) on the 3-dimensional differentiable manifold M
リーマンテンソルは接続などを明示的に求めることなく、計量$g$から直接算出することもできます。
Note that it can be accessed directely via the metric, without any explicit mention of the connection:
g.riemann() is nabla.riemann()
g.riemann().display(Y.frame())
Ricci テンソル はこのようになります。
The Ricci tensor is
Ric = g.ricci()
print(Ric)
Ric.display(Y.frame())
Field of symmetric bilinear forms Ric(g) on the 3-dimensional differentiable manifold M
Weyl テンソル は:
The Weyl tensor is:
Weylテンソルについては Weinberg Page 145, 内山 page. 322, eq. (52.25) を参照
C = g.weyl()
print(C) ; C.display()
Tensor field C(g) of type (1,3) on the 3-dimensional differentiable manifold M
と、多様体 $\mathcal{M}$ の次元が 3 なので、Weyl テンソル は恒等的に0になります。
最後に Ricci スカラ(曲率) を求めます。
The Weyl tensor vanishes identically because the dimension of $\mathcal{M}$ is 3.
Finally, the Ricci scalar is
R = g.ricci_scalar()
print(R) ; R.display()
Scalar field r(g) on the 3-dimensional differentiable manifold M
このようにこの空間 $\mathbb{H}^3$ は負の定曲率をもった空間(双曲空間)であることが、改めて確認できます。
We recover the fact that $\mathbb{H}^3$ is a Riemannian manifold of constant negative curvature.
もっとも重要な軽量 $g$によって引き起こされるテンソル場の変形は、musical isomorphism あるいは 指標の引き上げ および 指標の引き下げと呼ばれるものです。
The most important tensor transformation induced by the metric $g$ is the so-called musical isomorphism, or index raising and index lowering:
print(t)
Tensor field T of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M
t.display()
t.display(X_U.frame(), X_U)
テンソル場 $T$の最後の指標(位置は2)を計量 $g$ について、引き上げます。
s = t.up(g, 2)
print(t,s)
Tensor field T of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M Tensor field of type (2,1) on the Open subset U of the 3-dimensional differentiable manifold M
上記の式で引き上げられた指標は反変な指数のうち最後のものになることに注意しましょう。つまり、メソッドup
が返すテンソル $s$ は
$$ s^{ab}_{\ \ \ \, c} = g^{bi} T^a_{\ \ ic}$$
です。
これについての詳細はup()の解説 をご覧ください。
See the up() documentation for more details.
$T$の全ての共変な指標(この例では 位置 1と2)を引き上げます。
Raising all the covariant indices of $T$ (i.e. those at the positions 1 and 2):
s = t.up(g)
print(s)
Tensor field of type (3,0) on the Open subset U of the 3-dimensional differentiable manifold M
s = t.down(g)
print(s)
Tensor field of type (0,3) on the Open subset U of the 3-dimensional differentiable manifold M
上記の式で引き下げられた指標は 共変な指標のうち 最初 の指標になることに注意しましょう。 即ち、down
メソッドが返すテンソル $s$ は、
$$ s_{abc} = g_{ai} T^i_{\ \ bc}$$
となります。
これについての詳細はdown()の解説 をご覧ください。
計量 $g$についての体積 3-形式(Levi-Civita テンソル )は
The volume 3-form (Levi-Civita tensor) associated with the metric $g$ is
epsilon = g.volume_form()
print(epsilon)
epsilon.display()
3-form eps_g on the 3-dimensional differentiable manifold M
epsilon.display(Y.frame())
epsilon.display(Y.frame())
print(f) ; f.display()
Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M
sf = f.hodge_dual(g.restrict(U))
print(sf)
sf.display()
3-form *f on the Open subset U of the 3-dimensional differentiable manifold M
古典的な式$\star f = f\, \epsilon_g$, より正確には $\star f = f\, \epsilon_g|_U$, を確かめてみましょう。 $f$ は $U$ 上でのみ定義されていることに注意します。
We check the classical formula $\star f = f\, \epsilon_g$, or, more precisely, $\star f = f\, \epsilon_g|_U$ (for $f$ is defined on $U$ only):
sf == f * epsilon.restrict(U)
1-形式のHodge 双対は、2ー形式 です。(3次元多様体の場合);
The Hodge dual of a 1-form is a 2-form:
print(om) ; om.display()
1-form omega on the Open subset U of the 3-dimensional differentiable manifold M
som = om.hodge_dual(g)
print(som) ;
som.display()
2-form *omega on the Open subset U of the 3-dimensional differentiable manifold M
(3次元多様体上では)2ー形式のhodge 双対は 1ー形式になります。
The Hodge dual of a 2-form is a 1-form:
print(a)
2-form A on the Open subset U of the 3-dimensional differentiable manifold M
sa = a.hodge_dual(g)
print(sa)
sa.display()
1-form *A on the Open subset U of the 3-dimensional differentiable manifold M
最後に3ー形式のHodge 双対は 0-forms です。
Finally, the Hodge dual of a 3-form is a 0-form:
print(da)
da.display()
3-form dA on the Open subset U of the 3-dimensional differentiable manifold M
sda = da.hodge_dual(g)
print(sda)
show(sda.display())
Scalar field *dA on the Open subset U of the 3-dimensional differentiable manifold M
3次元のリーマン計量に対して、Hodge 双対はidempotent、つまり2回続けて作用させると元に戻ります。
In dimension 3 and for a Riemannian metric, the Hodge star is idempotent:
sf.hodge_dual(g) == f
som.hodge_dual(g) == om
sa.hodge_dual(g) == a
sda.hodge_dual(g.restrict(U)) == da
オブジェクトが呼び出すことのできる関数(メソッドを入手するには、オブジェクトの名前を入力したのち、"."とTABを入力します。
つまり、sa.<tab>
です。
オブジェクトやメソッドについての情報を入手するために、疑問符 ?
をお使いください。
To get the list of functions (methods) that can be called on a object, type the name of the object, followed by a dot and the TAB key, e.g.
sa.
To get information on an object or a method, use the question mark:
nabla?
Signature: nabla(tensor) Type: LeviCivitaConnection String form: Levi-Civita connection nabla_g associated with the Riemannian metric g on the 3-dimensional differentiable manifold M File: /private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/manifolds/differentiable/levi_civita_connection.py Docstring: Levi-Civita connection on a pseudo-Riemannian manifold. Let M be a differentiable manifold of class C^\infty (smooth manifold) over \RR endowed with a pseudo-Riemannian metric g. Let C^\infty(M) be the algebra of smooth functions M--> \RR (cf. "DiffScalarFieldAlgebra") and let \mathfrak{X}(M) be the C^\infty(M)-module of vector fields on M (cf. "VectorFieldModule"). The *Levi-Civita connection associated with* g is the unique operator \begin{array}{cccc} \nabla: & \mathfrak{X}(M) x \mathfrak{X}(M) & ---> & \mathfrak{X}(M) \\ & (u,v) & |---> & \nabla_u v \end{array} that * is \RR-bilinear, i.e. is bilinear when considering \mathfrak{X}(M) as a vector space over \RR * is C^\infty(M)-linear w.r.t. the first argument: \forall f\in C^\infty(M),\ \nabla_{fu} v = f\nabla_u v * obeys Leibniz rule w.r.t. the second argument: \forall f\in C^\infty(M),\ \nabla_u (f v) = df(u)\, v + f \nabla_u v * is torsion-free * is compatible with g: \forall (u,v,w)\in \mathfrak{X}(M)^3,\ u(g(v,w)) = g(\nabla_u v, w) + g(v, \nabla_u w) The Levi-Civita connection \nabla gives birth to the *covariant derivative operator* acting on tensor fields, denoted by the same symbol: \begin{array}{cccc} \nabla: & T^{(k,l)}(M) & ---> & T^{(k,l+1)}(M)\\ & t & |---> & \nabla t \end{array} where T^{(k,l)}(M) stands for the C^\infty(M)-module of tensor fields of type (k,l) on M (cf. "TensorFieldModule"), with the convention T^{(0,0)}(M):=C^\infty(M). For a vector field v, the covariant derivative \nabla v is a type-(1,1) tensor field such that \forall u \in\mathfrak{X}(M), \ \nabla_u v = \nabla v(., u) More generally for any tensor field t\in T^{(k,l)}(M), we have \forall u \in\mathfrak{X}(M), \ \nabla_u t = \nabla t(..., u) Note: The above convention means that, in terms of index notation, the "derivation index" in \nabla t is the *last* one: \nabla_c t^{a_1... a_k}_{\quad\quad b_1... b_l} = (\nabla t)^{a_1... a_k}_{\quad\quad b_1... b_l c} INPUT: * "metric" -- the metric g defining the Levi-Civita connection, as an instance of class "PseudoRiemannianMetric" * "name" -- name given to the connection * "latex_name" -- (default: "None") LaTeX symbol to denote the connection * "init_coef" -- (default: "True") determines whether the Christoffel symbols are initialized (in the top charts on the domain, i.e. disregarding the subcharts) EXAMPLES: Levi-Civita connection associated with the Euclidean metric on \RR^3 expressed in spherical coordinates: sage: forget() # for doctests only sage: M = Manifold(3, 'R^3', start_index=1) sage: c_spher.<r,th,ph> = M.chart(r'r:(0,+oo) th:(0,pi):\theta ph:(0,2*pi):\phi') sage: g = M.metric('g') sage: g[1,1], g[2,2], g[3,3] = 1, r^2 , (r*sin(th))^2 sage: g.display() g = dr⊗dr + r^2 dth⊗dth + r^2*sin(th)^2 dph⊗dph sage: nab = g.connection(name='nabla', latex_name=r'\nabla') ; nab Levi-Civita connection nabla associated with the Riemannian metric g on the 3-dimensional differentiable manifold R^3 Let us check that the connection is compatible with the metric: sage: Dg = nab(g) ; Dg Tensor field nabla(g) of type (0,3) on the 3-dimensional differentiable manifold R^3 sage: Dg == 0 True and that it is torsionless: sage: nab.torsion() == 0 True As a check, let us enforce the computation of the torsion: sage: sage.manifolds.differentiable.affine_connection.AffineConnection.torsion(nab) == 0 True The connection coefficients in the manifold's default frame are Christoffel symbols, since the default frame is a coordinate frame: sage: M.default_frame() Coordinate frame (R^3, (∂/∂r,∂/∂th,∂/∂ph)) sage: nab.coef() 3-indices components w.r.t. Coordinate frame (R^3, (∂/∂r,∂/∂th,∂/∂ph)), with symmetry on the index positions (1, 2) We note that the Christoffel symbols are symmetric with respect to their last two indices (positions (1,2)); their expression is: sage: nab.coef()[:] # display as a array [[[0, 0, 0], [0, -r, 0], [0, 0, -r*sin(th)^2]], [[0, 1/r, 0], [1/r, 0, 0], [0, 0, -cos(th)*sin(th)]], [[0, 0, 1/r], [0, 0, cos(th)/sin(th)], [1/r, cos(th)/sin(th), 0]]] sage: nab.display() # display only the non-vanishing symbols Gam^r_th,th = -r Gam^r_ph,ph = -r*sin(th)^2 Gam^th_r,th = 1/r Gam^th_th,r = 1/r Gam^th_ph,ph = -cos(th)*sin(th) Gam^ph_r,ph = 1/r Gam^ph_th,ph = cos(th)/sin(th) Gam^ph_ph,r = 1/r Gam^ph_ph,th = cos(th)/sin(th) sage: nab.display(only_nonredundant=True) # skip redundancy due to symmetry Gam^r_th,th = -r Gam^r_ph,ph = -r*sin(th)^2 Gam^th_r,th = 1/r Gam^th_ph,ph = -cos(th)*sin(th) Gam^ph_r,ph = 1/r Gam^ph_th,ph = cos(th)/sin(th) The same display can be obtained via the function "christoffel_symbols_display()" acting on the metric: sage: g.christoffel_symbols_display(chart=c_spher) Gam^r_th,th = -r Gam^r_ph,ph = -r*sin(th)^2 Gam^th_r,th = 1/r Gam^th_ph,ph = -cos(th)*sin(th) Gam^ph_r,ph = 1/r Gam^ph_th,ph = cos(th)/sin(th) Init docstring: Construct a Levi-Civita connection. Call docstring: Action of the connection on a tensor field. INPUT: * "tensor" -- a tensor field T, of type (k,\ell) OUTPUT: * tensor field \nabla T.
g.ricci_scalar?
Signature: g.ricci_scalar(name=None, latex_name=None) Docstring: Return the metric's Ricci scalar. The Ricci scalar is the scalar field r defined from the Ricci tensor Ric and the metric tensor g by r = g^{ij} Ric_{ij} INPUT: * "name" -- (default: "None") name given to the Ricci scalar; if none, it is set to "r(g)", where "g" is the metric's name * "latex_name" -- (default: "None") LaTeX symbol to denote the Ricci scalar; if none, it is set to "r(g)", where "g" is the metric's name OUTPUT: * the Ricci scalar r, as an instance of "DiffScalarField" EXAMPLES: Ricci scalar of the standard metric on the 2-sphere: sage: M = Manifold(2, 'S^2', start_index=1) sage: U = M.open_subset('U') # the complement of a meridian (domain of spherical coordinates) sage: c_spher.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi') sage: a = var('a') # the sphere radius sage: g = U.metric('g') sage: g[1,1], g[2,2] = a^2, a^2*sin(th)^2 sage: g.display() # standard metric on the 2-sphere of radius a: g = a^2 dth⊗dth + a^2*sin(th)^2 dph⊗dph sage: g.ricci_scalar() Scalar field r(g) on the Open subset U of the 2-dimensional differentiable manifold S^2 sage: g.ricci_scalar().display() # The Ricci scalar is constant: r(g): U → ℝ (th, ph) ↦ 2/a^2 Init docstring: Initialize self. See help(type(self)) for accurate signature. File: /private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/manifolds/differentiable/metric.py Type: method
二つの疑問符 ??
は Pythonソースコード に直接導かれます。(SageMathはオープンソースです、そうでしょう?)
g.ricci_scalar??
Signature: g.ricci_scalar(name=None, latex_name=None) Docstring: Return the metric's Ricci scalar. The Ricci scalar is the scalar field r defined from the Ricci tensor Ric and the metric tensor g by r = g^{ij} Ric_{ij} INPUT: * "name" -- (default: "None") name given to the Ricci scalar; if none, it is set to "r(g)", where "g" is the metric's name * "latex_name" -- (default: "None") LaTeX symbol to denote the Ricci scalar; if none, it is set to "r(g)", where "g" is the metric's name OUTPUT: * the Ricci scalar r, as an instance of "DiffScalarField" EXAMPLES: Ricci scalar of the standard metric on the 2-sphere: sage: M = Manifold(2, 'S^2', start_index=1) sage: U = M.open_subset('U') # the complement of a meridian (domain of spherical coordinates) sage: c_spher.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi') sage: a = var('a') # the sphere radius sage: g = U.metric('g') sage: g[1,1], g[2,2] = a^2, a^2*sin(th)^2 sage: g.display() # standard metric on the 2-sphere of radius a: g = a^2 dth⊗dth + a^2*sin(th)^2 dph⊗dph sage: g.ricci_scalar() Scalar field r(g) on the Open subset U of the 2-dimensional differentiable manifold S^2 sage: g.ricci_scalar().display() # The Ricci scalar is constant: r(g): U → ℝ (th, ph) ↦ 2/a^2 Source: def ricci_scalar(self, name=None, latex_name=None): r""" Return the metric's Ricci scalar. The Ricci scalar is the scalar field `r` defined from the Ricci tensor `Ric` and the metric tensor `g` by .. MATH:: r = g^{ij} Ric_{ij} INPUT: - ``name`` -- (default: ``None``) name given to the Ricci scalar; if none, it is set to "r(g)", where "g" is the metric's name - ``latex_name`` -- (default: ``None``) LaTeX symbol to denote the Ricci scalar; if none, it is set to "\\mathrm{r}(g)", where "g" is the metric's name OUTPUT: - the Ricci scalar `r`, as an instance of :class:`~sage.manifolds.differentiable.scalarfield.DiffScalarField` EXAMPLES: Ricci scalar of the standard metric on the 2-sphere:: sage: M = Manifold(2, 'S^2', start_index=1) sage: U = M.open_subset('U') # the complement of a meridian (domain of spherical coordinates) sage: c_spher.<th,ph> = U.chart(r'th:(0,pi):\theta ph:(0,2*pi):\phi') sage: a = var('a') # the sphere radius sage: g = U.metric('g') sage: g[1,1], g[2,2] = a^2, a^2*sin(th)^2 sage: g.display() # standard metric on the 2-sphere of radius a: g = a^2 dth⊗dth + a^2*sin(th)^2 dph⊗dph sage: g.ricci_scalar() Scalar field r(g) on the Open subset U of the 2-dimensional differentiable manifold S^2 sage: g.ricci_scalar().display() # The Ricci scalar is constant: r(g): U → ℝ (th, ph) ↦ 2/a^2 """ if self._ricci_scalar is None: manif = self._ambient_domain ric = self.ricci() ig = self.inverse() frame = ig.common_basis(ric) cric = ric._components[frame] cig = ig._components[frame] rsum1 = 0 for i in manif.irange(): rsum1 += cig[[i,i]] * cric[[i,i]] rsum2 = 0 for i in manif.irange(): for j in manif.irange(start=i+1): rsum2 += cig[[i,j]] * cric[[i,j]] self._ricci_scalar = rsum1 + 2*rsum2 if name is None: self._ricci_scalar._name = "r(" + self._name + ")" else: self._ricci_scalar._name = name if latex_name is None: self._ricci_scalar._latex_name = r"\mathrm{r}\left(" + \ self._latex_name + r"\right)" else: self._ricci_scalar._latex_name = latex_name return self._ricci_scalar File: /private/var/tmp/sage-10.0-current/local/var/lib/sage/venv-python3.11.1/lib/python3.11/site-packages/sage/manifolds/differentiable/metric.py Type: method
ページ:SageManifolds の例をご覧ください。とくに、平行化不能な多様体(スカラー場は少なくとも二つの座標系で定義される必要があり、 モジュール $\mathfrak{X}(\mathcal{M})$はもはやフリーではなく、 テンソル場は少なくとも二つのフレームで定義される必要があります) での使い方については、 2-次元 球面 が役に立つでしょう。
Christian Bär氏によるチュートリアル ビデオもご覧ください。