{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sage多様体演習 Sage manifold tutorial\n", "\n", "このワークシートはSageMathにおける微分可能多様体の取り扱いについての簡単な紹介です。以下で紹介するツールは[SageManifolds](http://sagemanifolds.obspm.fr) プロジェクト (version 1.2, included in SageMath 8.2).を通じて実装されました。\n", "ipnyb形式のワークシートファイルは[ここ](https://raw.githubusercontent.com/sagemanifolds/SageManifolds/master/Worksheets/v1.2/SM_tutorial.ipynb) からダウンロード可能です。このワークシートを実行するには、コマンド`sage -n jupyter`などを使ってSageMathのJupyterノートブックインタフェースを起動する必要があります。\n", "[訳注:この日本語版翻訳は山本 昇によって作成されました。翻訳者へのご連絡は、https://souran.kek.jp/kss/top/ を経由して、 職員情報詳細ページ内の「メール送信」リンクをご利用ください。この翻訳版作成にあたり、東海大学理学部北林さんには貴重なコメントをいただきました。この場を借りてお礼申しあげます。]\n", "\n", "This worksheet provides a short introduction to differentiable manifolds in SageMath. The tools described below have been implemented through the\n", "[SageManifolds](http://sagemanifolds.obspm.fr) project (version 1.2, included in SageMath 8.2).\n", "\n", "Click [here](https://raw.githubusercontent.com/sagemanifolds/SageManifolds/master/Worksheets/v1.2/SM_tutorial.ipynb) to download the worksheet file (ipynb format). To run it, you must start SageMath with the Jupyter notebook, via the command `sage -n jupyter`\n", "\n", "[Note for Japanese version.: this document was translated into Japanese by Noboru Yamamoto. You can reach him through https://souran.kek.jp/kss/top/. \"Staff Detail Information\" page includes a link \"send email\". The translator thanks Prof. Kitabayashi of Tokai University for his valuable comments on the draft of the documents.]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "このワークシートはSageMathのバージョン 7.5 (あるいはそれ以降)を必要としています、それ以前のバージョンではSageManifoldsの全ての機能が利用可能というわけではないからです。( 訳注:このjupyter notebookはSageMath 8.2を使って実行しています。)\n", "\n", "The following assumes that you are using version 7.5 (or higher) of SageMath, since lower versions do not include all features of SageManifolds:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'SageMath version 8.2, Release Date: 2018-05-05'" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "version()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "最初に、ノートブックが結果をLaTexを使った数式表示で表示するようにします。\n", "\n", "First we set up the notebook to display mathematical objects using LaTeX rendering:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "%display latex" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 多様体の定義 Defining a manifold\n", "\n", "例として、 $\\mathbb{R}$上の3次元の微分可能多様体を定義します。\n", "\n", "As an example let us define a differentiable manifold of dimension 3 over $\\mathbb{R}$:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "M = Manifold(3, 'M', latex_name=r'\\mathcal{M}', start_index=1)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- 最初の引数、`3`, は多様体の次元です。SageManifoldsでは任意の正の整数を指定できます。\n", "- 2番目の引数, `'M'`, は多様体の名前を与える文字列です。この名前は = 記号の左辺にあるシンボルの名前(ここでは`M`)と\n", "異なっていても構いません。左辺のシンボル名はコンピュータメモリのなかの多様体オブジェクトを参照しています。一方、\n", "引数であたえる名前は、多様体に与えられた数学的な名前です。\n", "- 省略可能な引数、`latex_name=r'\\mathcal{M}'` , はこの多様体をLaTeXで表示する際に使う名前を指定します。\n", "最初の引用符の前の 'r' に注意してください。:これはこの文字列が *raw* 文字列であることを示しています。\n", "それによって文字列中のバックスラッシュ '\\\n", "' は通常の文字として取り扱われます( '\\\\' とする必要がないということ)。\n", "この引数(`latex_name`)が省略された場合は、第2引数に与えられた名前が使われます。\n", "- 次の省略可能な引数`start_index=1`は多様体のテンソル成分の指標の範囲を指定しています。これを1とすることは指標の範囲が$\\{1,2,3\\}$であることを示しています。この引数の既定値は `start_index=0` です。\n", "\n", "\n", "- The first argument, `3`, is the manifold dimension. In SageManifolds, it can be any\n", " positive integer.\n", "- The second argument, `'M'`, is a string defining the manifold's name; it may be \n", " different from the symbol set on the left-hand side of the = sign (here `M`): the latter\n", " stands for a mere Python variable, which refers to the manifold object in the computer \n", " memory, while the string `'M'` is the mathematical symbol chosen for the manifold.\n", "- The optional argument `latex_name=r'\\mathcal{M}'` sets the LaTeX\n", " symbol to display the manifold. Note the letter 'r' in front on the first quote: \n", " it indicates that the string is a *raw* one, so that the backslash character \n", " in `\\mathcal` is considered as an ordinary character (otherwise, the backslash is \n", " used to escape some special characters). If the argument `latex_name` is not \n", " provided by the user, it is set to the string used as the second argument (here `'M'`)\n", "- The optional argument `start_index=1` defines the range of indices to be used for \n", " tensor components on the manifold: setting it to 1 means that indices will range \n", " in $\\{1,2,3\\}$. The default value is `start_index=0`.\n", "\n", "規定のベースフィールド(基底)は$\\mathbb{R}$であることに注意してください。もし、\n", "`field='complex'`,が与えられていれば、複素数体$\\mathbb{C}$を基底として持つ\n", "多様体が定義されます。[[list of all options](http://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/manifold.html#sage.manifolds.manifold.Manifold) を参照のこと]\n", "\n", "Note that the default base field is $\\mathbb{R}$. If we would have used the optional\n", "argument `field='complex'`, we would have defined a manifold over $\\mathbb{C}$. See the\n", "[list of all options](http://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/manifold.html#sage.manifolds.manifold.Manifold) for more details. \n", "\n", "Mを要求すると、そのLaTexのシンボルとして表示されます。\n", "\n", "If we ask for M, it is displayed via its LaTeX symbol:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "3-dimensional differentiable manifold M" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "代わりに `print` 関数を使うと、簡潔な記述が表示されます。\n", "\n", "If we use the `print` function instead, we get a short description of the object:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(M)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`type` コマンドを使うと、Mに対応するPythonオブジェクトのタイプ(`DifferentiableManifold_with_category`)を表示できます。\n", "\n", "

Via the command type, we get the type of the Python object corresponding to M (here the Python class DifferentiableManifold_with_category):

" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(M)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "category()関数を使って、多様体`M`のカテゴリーを調べます。この例では、この多様体の\n", "カテゴリーは$\\mathbb{R}$の上の滑らかな多様体であることがわかります。\n", "\n", "We can also ask for the category of M and see that it is the category of smooth manifolds over $\\mathbb{R}$:" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Category of smooth manifolds over Real Field with 53 bits of precision" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "category(M)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "多様体の指標(を表すgeneator)は `irange()` メソッドで生成されます。この指標はfor-ループなどで使われます。\n", "\n", "

The indices on the manifold are generated by the method irange(), to be used in loops:

" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1\n", "2\n", "3\n" ] } ], "source": [ "for i in M.irange():\n", " print(i)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`start_index` パラメータが明示的に指定されていない場合、多様体の指標は 0 からはじまります、例えばこの例のように(0,1,2) の範囲となります。\n", "\n", "

If the parameter start_index had not been specified, the default range of the indices would have been $\\{0,1,2\\}$ instead:

" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0\n", "1\n", "2\n" ] } ], "source": [ "M0 = Manifold(3, 'M', r'\\mathcal{M}')\n", "for i in M0.irange():\n", " print(i)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 多様体上の座標系(chart)の定義:Defining a chart on the manifold\n", "まずは、多様体 $\\mathcal{M}$ は一つの座標系で覆われると仮定します(そうでない場合は以下で議論されます)。\n", "座標系は次のように宣言されます。\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "X. = M.chart()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "上式の左辺にある`.` は Pythonの変数 `x`, `y` and `z`が座標系の軸名として使われることを意味します。\n", "これにより、座標軸を名前で指定することが可能になります。\n", "\n", "The writing `.` in the left-hand side means that the Python variables `x`, `y` and `z` are set to the three coordinates of the chart. This allows one to refer subsequently to the coordinates by their names.\n", "\n", "この例では、関数 `chart()` は引数をもっていません。この場合には、座標の名前は、`x`, `y` と `z` (即ち、左辺の `<...>` 演算子で与えられた名前)になります。また座標の範囲は $(-\\infty,+\\infty)$ となります。それ以外の座標の名前やその範囲を指定する場合には `chart()` にそれらを引数として与えなければなりません。座標名と異なる LaTex で使われる名前を指定する場合も同様です。(以下にそのような例が示されます。)\n", "\n", "In this example, the function `chart()` has no arguments, which implies that the coordinate symbols will be `x`, `y` and `z` (i.e. exactly the characters set in the `<...>` operator) and that each coordinate range is $(-\\infty,+\\infty)$. For other cases, an argument must be passed to `chart()`  to specify the coordinate symbols and range, as well as the LaTeX symbol of a coordinate if the latter is different from the coordinate name (an example will be provided below)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標系は座標系が覆う部分多様体(ここでは多様体自身)と座標の組みで表示されます。\n", "\n", "

The chart is displayed as a pair formed by the open set covered by it (here the whole manifold) and the coordinates:

" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Chart (M, (x, y, z))\n" ] } ], "source": [ "print(X)" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Chart (M, (x, y, z))" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "それぞれの座標値は指標を使って入手できます。指標の指定方法は多様体の定義時の設定(`start_index=1`)に従います。\n", "\n", "

The coordinates can be accessed individually, by means of their indices, following the convention defined by start_index=1 in the manifold's definition:

" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "x" ] }, "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X[1]" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "y" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X[2]" ] }, { "cell_type": "code", "execution_count": 15, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "z" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X[3]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標の全体は`[:]` 演算子を使って取得します。\n", "

The full set of coordinates is obtained by means of the operator [:]:

" ] }, { "cell_type": "code", "execution_count": 16, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z)" ] }, "execution_count": 16, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X[:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標系定義で使った `` 演算子のおかげで、それぞれの座標をこの名前を使って直接取り扱えます。\n", "\n", "Thanks to the operator `` used in the chart declaration, each coordinate can be accessed directly via its name:" ] }, { "cell_type": "code", "execution_count": 17, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "z is X[3]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標は SageMath の記号表現になっています。\n", "\n", "Coordinates are SageMath symbolic expressions:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 18, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(z)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 座標の関数 Functions of the chart coordinates\n", "\n", "実数値をもつ座標の関数 (数学的にいえば、**座標の終域で定義された関数**) は チャートの`function()` メソッドを使って生成されます。\n", "\n", "

Functions of the chart coordinates

\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "z^3 + y^2 + x" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f = X.function(x+y^2+z^3) ; f" ] }, { "cell_type": "code", "execution_count": 20, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z) |--> z^3 + y^2 + x" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.display()" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "32" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f(1,2,3)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "これらの関数は、SageManiforldsのクラス `ChartFunction` に属しています。\n", "\n", "

They belong to SageManifolds class ChartFunction:

" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(f)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "そしてこの`ChartFunction`クラスに属する関数は、標準的な SageMath の記号的関数とは全ての演算で自動的簡約化の振る舞いが異なっています。例えば、二つの記号的関数の和:\n", "\n", "

and differ from SageMath standard symbolic functions by automatic simplifications in all operations. For instance, adding the two symbolic functions

" ] }, { "cell_type": "code", "execution_count": 23, "metadata": {}, "outputs": [], "source": [ "f0(x,y,z) = cos(x)^2 ; g0(x,y,z) = sin(x)^2" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "は、次の結果になります。\n", "\n", "

results in

" ] }, { "cell_type": "code", "execution_count": 24, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z) |--> cos(x)^2 + sin(x)^2" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f0 + g0" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "一方、`ChartFunction` クラスに属する関数は自動的に簡約化されます。\n", "\n", "

while the sum of the corresponding functions in the class ChartFunction is automatically simplified:

" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "1" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f1 = X.function(cos(x)^2) ; g1 = X.function(sin(x)^2)\n", "f1 + g1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "同じ結果を記号的関数でも得るためには、`simplify_trig()` メソッドを使います。\n", "\n", "

To get the same output with symbolic functions, one has to invoke the method simplify_trig():

" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z) |--> 1" ] }, "execution_count": 26, "metadata": {}, "output_type": "execute_result" } ], "source": [ "(f0 + g0).simplify_trig()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "違いは表示方法にもあります。記号関数 `f0`を表示させると、\n", "\n", "

Another difference regards the display; if we ask for the symbolic function f0, we get:

" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z) |--> cos(x)^2" ] }, "execution_count": 27, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f0" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "となりますが、座標関数 `f1` を表示させると、座標表示だけが表示されます。\n", "\n", "

while if we ask for the chart function f1, we get only the coordinate expression:

" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "cos(x)^2" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f1" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`f0` の場合と同じような表示を望む場合には、 `display()` メソッドを使います。\n", "\n", "

To get an output similar to that of f0, one should call the method display():

" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z) |--> cos(x)^2" ] }, "execution_count": 29, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f1.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`expr()`メソッドは基になる記号表現を返します。\n", "\n", "Note that the method `expr()` returns the underlying symbolic expression:" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "cos(x)^2" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f1.expr()" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "type(f1.expr())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### 多様体への二つ目の座標系の導入:Introducing a second chart on the manifold\n", "\n", "まず、多様体$\\mathcal{M}$の部分集合を考えましょう。たとえば、$\\{y=0, x\\geq 0\\}$ で定義される領域の補集合 $U$ です(\n", "`(y!=0, x<0)` は $y\\not=0$ OR $x<0$を意味していることに注意。$y\\not=0$ AND $x<0$ は`[y!=0, x<0]`となる。)。\n", "\n", "Let us first consider an open subset of $\\mathcal{M}$, for instance the complement $U$ of the region defined by $\\{y=0, x\\geq 0\\}$ (note that `(y!=0, x<0)` stands for $y\\not=0$ OR $x<0$; the condition $y\\not=0$ AND $x<0$ would have been written `[y!=0, x<0]` instead):" ] }, { "cell_type": "code", "execution_count": 32, "metadata": {}, "outputs": [], "source": [ "U = M.open_subset('U', coord_def={X: (y!=0, x<0)})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "開部分集合$U$に制限された座標系 `X` を `X_U`と呼ぶことにします。\n", "\n", "Let us call `X_U` the restriction of the chart `X` to the open subset $U$:" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Chart (U, (x, y, z))" ] }, "execution_count": 33, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X_U = X.restrict(U) ; X_U" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$U$上の別の座標系、 $(r,\\theta,\\phi)$、を 導入します。\n", "\n", "

We introduce another chart on $U$, with spherical-type coordinates $(r,\\theta,\\phi)$:

" ] }, { "cell_type": "code", "execution_count": 34, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Chart (U, (r, th, ph))" ] }, "execution_count": 34, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Y. = U.chart(r'r:(0,+oo) th:(0,pi):\\theta ph:(0,2*pi):\\phi') ; Y" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ここでは関数 `chart()` は引数を持っています。それはraw文字列でLaTexのシンボルを含んでいます。また、この文字列には座標の(標準とは異なる)範囲指定が含まれています。フィールドは`:`で区切られており、座標は空白文字で区切られています。 座標$r$については、LaTexシンボルを指定していないので、下限と上限の二つだけが指定されています。LaTexシンボルは出力の際に使われます。\n", "\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 35, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(th, ph)" ] }, "execution_count": 35, "metadata": {}, "output_type": "execute_result" } ], "source": [ "th, ph" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(th, ph)" ] }, "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Y[2], Y[3]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Sageが使っている座標の条件は、`assumptions()`メソッドを使って確認することができます。\n", "\n", "

The declared coordinate ranges are now known to Sage, as we may check by means of the command assumptions():

" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[x is real,\n", " y is real,\n", " z is real,\n", " r is real,\n", " r > 0,\n", " th is real,\n", " th > 0,\n", " th < pi,\n", " ph is real,\n", " ph > 0,\n", " ph < 2*pi]" ] }, "execution_count": 37, "metadata": {}, "output_type": "execute_result" } ], "source": [ "assumptions()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "これらの条件は、表現の簡約化の際に使われます。\n", "\n", "

They are used in simplifications:

" ] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "r" ] }, "execution_count": 38, "metadata": {}, "output_type": "execute_result" } ], "source": [ "simplify(abs(r))" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "abs(x)" ] }, "execution_count": 39, "metadata": {}, "output_type": "execute_result" } ], "source": [ "simplify(abs(x)) # no simplification occurs since x can take any value in R" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標 $Y$が宣言されたあとで、さらに 遷移写像を指定することで、$Y$の$X_U$への関係を完全に特定することができます。\n", "

After having been declared, the chart Y can be fully specified by its relation to the chart X_U, via a transition map:

" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [], "source": [ "transit_Y_to_X = Y.transition_map(X_U, [r*sin(th)*cos(ph), r*sin(th)*sin(ph), r*cos(th)])" ] }, { "cell_type": "code", "execution_count": 41, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Change of coordinates from Chart (U, (r, th, ph)) to Chart (U, (x, y, z))" ] }, "execution_count": 41, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transit_Y_to_X" ] }, { "cell_type": "code", "execution_count": 42, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "x = r*cos(ph)*sin(th)\n", "y = r*sin(ph)*sin(th)\n", "z = r*cos(th)" ] }, "execution_count": 42, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transit_Y_to_X.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`set_inverse()` メソッドを用いることで、遷移写像の逆写像を指定することができます。\n", "\n", "

The inverse of the transition map can be specified by means of the method set_inverse():

" ] }, { "cell_type": "code", "execution_count": 43, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "r = sqrt(x^2 + y^2 + z^2)\n", "th = arctan2(sqrt(x^2 + y^2), z)\n", "ph = arctan2(y, x)" ] }, "execution_count": 43, "metadata": {}, "output_type": "execute_result" } ], "source": [ "transit_Y_to_X.set_inverse(sqrt(x^2+y^2+z^2), atan2(sqrt(x^2+y^2),z), atan2(y, x))\n", "transit_Y_to_X.inverse().display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "この段階で、多様体のアトラス( `user atlas`であって最大アトラスではありません)は三つの座標系を含んでいます。\n", "\n", "

At this stage, the manifold's atlas (the \"user atlas\", not the maximal atlas!) contains three charts:

" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Chart (M, (x, y, z)), Chart (U, (x, y, z)), Chart (U, (r, th, ph))]" ] }, "execution_count": 44, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M.atlas()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "多様体に最初に定義された座標系は既定の座標系とみなされます。既定座標系はあとで、`set_default_chart()`メソッドを使って変更できます。\n", "\n", "

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()):

" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Chart (M, (x, y, z))" ] }, "execution_count": 45, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M.default_chart()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "各々の開部分空間は各自のアトラスを持っています。開部分空間はそれ自身でも多様体であるからです。\n", "

Each open subset has its own atlas (since an open subset of a manifold is a manifold by itself):

" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Chart (U, (x, y, z)), Chart (U, (r, th, ph))]" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "U.atlas()" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Chart (U, (x, y, z))" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "U.default_chart()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標系$Y$を座標系$X$を使って表示することができます。\n", "まずは、3次元画像のビューワーを定義しましょう。(ユーザが操作可能な3次元画像の表示には、`'threejs'`あるいは`'jmon'`を指定します。)\n", "\n", "We can draw the chart $Y$ in terms of the chart $X$. \n", "Let us first define a viewer for 3D plots (use `'threejs'` or `'jmol'` for interactive 3D graphics):" ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [], "source": [ "viewer3D = 'threejs' # must be 'threejs', 'jmol', 'tachyon' or None (default)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "画像は座標系$Y$で一定の座標値を持つ線を、座標系$X$に基づく\"直交フレーム\"中に表示します。\n", "\n", "The plot shows lines of constant coordinates from the $Y$ chart in a \"Cartesian frame\" based on the $X$ coordinates:" ] }, { "cell_type": "code", "execution_count": 49, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "Graphics3d Object" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "graph = Y.plot(X)\n", "show(graph, viewer=viewer3D, online=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "コマンド`plot()`は多くのオプションを持っています。それらは、描画される座標線の数、スタイル、色、そして座標の範囲などを指定します。\n", "(参照:[list of all options](http://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/chart.html#sage.manifolds.chart.RealChart.plot)):\n", "\n", "The command plot() allows for many options, to control the number of coordinate lines to be drawn, their style and color, as well as the coordinate ranges (cf. the [list of all options](http://doc.sagemath.org/html/en/reference/manifolds/sage/manifolds/chart.html#sage.manifolds.chart.RealChart.plot)):" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "Graphics3d Object" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "graph = Y.plot(X, ranges={r:(1,2), th:(0,pi/2)}, number_values=4, \n", " color={r:'blue', th:'green', ph:'red'})\n", "show(graph, aspect_ratio=1, viewer=viewer3D, online=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "逆に、(制限された)座標系 $X|_{U}$ を座標系$Y$を使って表示することも可能です。この場合、座標系 $X$ の全てを表示することはできません、なぜなら $X$ の定義域(ドメイン)は $Y$ のそれより広いからです。\n", "\n", "

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$):

" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n" ], "text/plain": [ "Graphics3d Object" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "graph = X_U.plot(Y,\n", " color={x:'blue',y:'green', z:'red'})\n", "show(graph, viewer=viewer3D, online=True, axes_labels=['r','theta','phi'])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 多様体上の点\n", "\n", "多様体$\\mathcal{M}$上の点は、与えられた座標系での座標を使って定義されます。\n", "\n", "

Points on the manifold

\n", "

A point on $\\mathcal{M}$ is defined by its coordinates in a given chart:

" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Point p on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Point p on the 3-dimensional differentiable manifold M" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p = M.point((1,2,-1), chart=X, name='p') ; print(p) ; p" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$X=(\\mathcal{M}, (x,y,z))$ は既定の座標系ですから、その名前を省略することが可能です。\n", "

Since $X=(\\mathcal{M}, (x,y,z))$ is the manifold's default chart, its name can be omitted:

" ] }, { "cell_type": "code", "execution_count": 53, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Point p on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Point p on the 3-dimensional differentiable manifold M" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p = M.point((1,2,-1), name='p') ; print(p) ; p" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "もちろんpは多様体$\\mathcal{M}$中の点です。\n", "

Of course, $p$ belongs to $\\mathcal{M}$:

" ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 54, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p in M" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "この点は$U$の中の点でもあります。\n", "\n", "

It is also in $U$:

" ] }, { "cell_type": "code", "execution_count": 55, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 55, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p in U" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "実際、点$p$の座標 $y$ は 0 ではありません ( $y\\not=0$ ):(Uは $ y!=0 || x<0 $で定義された開領域)\n", "\n", "

Indeed the coordinates of $p$ have $y\\not=0$:

" ] }, { "cell_type": "code", "execution_count": 56, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(1, 2, -1)" ] }, "execution_count": 56, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.coord(X)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ここで、$X$は$\\mathcal{M}$の既定座標系であることから `coord()` の引数と渡すときには、省略可能であることに注意してください。\n", "\n", "

Note in passing that since $X$ is the default chart on $\\mathcal{M}$, its name can be omitted in the arguments of coord():

" ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(1, 2, -1)" ] }, "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.coord()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$p$の座標値は、座標系を点$p$に作用させることによっても得ることができます(座標系の定義により!):\n", "\n", "

The coordinates of $p$ can also be obtained by letting the chart acting of the point (from the very definition of a chart!):

" ] }, { "cell_type": "code", "execution_count": 58, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(1, 2, -1)" ] }, "execution_count": 58, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X(p)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "別の点$q$を$y = 0$ and $x \\geq 0$を満たす点として定義します。\n", "

Let $q$ be a point with $y = 0$ and $x \\geq 0$:

" ] }, { "cell_type": "code", "execution_count": 59, "metadata": {}, "outputs": [], "source": [ "q = M.point((1,0,2), name='q')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$q$は$U$には属しません。\n", "\n", "

This time, the point does not belong to $U$:

" ] }, { "cell_type": "code", "execution_count": 60, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "False" ] }, "execution_count": 60, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q in U" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "従って、点$q$の座標系$Y=(U, (r,\\theta,\\phi))$ での座標値を求めることはできません。\n", "

Accordingly, we cannot ask for the coordinates of $q$ in the chart $Y=(U, (r,\\theta,\\phi))$:

" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Error: the point does not belong to the domain of Chart (U, (r, th, ph))\n" ] } ], "source": [ "try:\n", " q.coord(Y)\n", "except ValueError as exc:\n", " print(\"Error: \" + str(exc))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "しかし、点$p$については可能です。\n", "\n", "

but we can for point $p$:

" ] }, { "cell_type": "code", "execution_count": 62, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(sqrt(3)*sqrt(2), pi - arctan(sqrt(5)), arctan(2))" ] }, "execution_count": 62, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.coord(Y)" ] }, { "cell_type": "code", "execution_count": 63, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(sqrt(3)*sqrt(2), pi - arctan(sqrt(5)), arctan(2))" ] }, "execution_count": 63, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Y(p)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "点は比較可能です。:\n", "

Points can be compared:

" ] }, { "cell_type": "code", "execution_count": 64, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "False" ] }, "execution_count": 64, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q == p" ] }, { "cell_type": "code", "execution_count": 65, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 65, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p1 = U.point((sqrt(3)*sqrt(2), pi-atan(sqrt(5)), atan(2)), chart=Y)\n", "p1 == p" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "SageMathの用語では、点は それが定義された多様体を **親(parents)** として持つ **要素(elements)** です。\n", "

In SageMath's terminology, points are elements, whose parents are the manifold on which they have been defined:

" ] }, { "cell_type": "code", "execution_count": 66, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "3-dimensional differentiable manifold M" ] }, "execution_count": 66, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.parent()" ] }, { "cell_type": "code", "execution_count": 67, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "3-dimensional differentiable manifold M" ] }, "execution_count": 67, "metadata": {}, "output_type": "execute_result" } ], "source": [ "q.parent()" ] }, { "cell_type": "code", "execution_count": 68, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p1.parent()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## スカラー場:Scalar fields\n", "スカラー場は微分可能な写像$U \\longrightarrow \\mathbb{R}$のことです。ここで $U$ は多様体$\\mathcal{M}$の開部分集合です。\n", "スカラー場はその定義域を覆う座標系を使った式で定義されます。一般には、一つ以上の座標系が定義域全体を覆うためには必要となります。\n", "\n", "

A scalar field is a differentiable mapping $U \\longrightarrow \\mathbb{R}$, where $U$ is an open subset of $\\mathcal{M}$.

\n", "

The scalar field is defined by its expressions in terms of charts covering its domain (in general more than one chart is necessary to cover all the domain):

" ] }, { "cell_type": "code", "execution_count": 69, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "f = U.scalar_field({X_U: x+y^2+z^3}, name='f') ; print(f)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標で書かれた表式は、座標系をキーとしたPythonの辞書型データ`{X_U: x+y^2+z^3}`として渡されます。\n", "この例では、辞書には一つの座標系しかありませんので、次のような表現も可能です。\n", "\n", "

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}.

\n", "

Since in the present case, there is only one chart in the dictionary, an alternative writing is

" ] }, { "cell_type": "code", "execution_count": 70, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "f = U.scalar_field(x+y^2+z^3, chart=X_U, name='f') ; print(f)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$X_U$ は定義域 ($U$) の既定の座標系ですので、上記の表現では省略可能です。\n", "\n", "

Since X_U is the domain's default chart, it can be omitted in the above declaration:

" ] }, { "cell_type": "code", "execution_count": 71, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "f = U.scalar_field(x+y^2+z^3, name='f') ; print(f)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "スカラー場は定義域となる多様体から実数体への写像ですから、それは点に対して働き、座標値に対して働くものではありません。\n", "As a mapping $U\\subset\\mathcal{M}\\longrightarrow\\mathbb{R}$, a scalar field acts on points, not on coordinates:" ] }, { "cell_type": "code", "execution_count": 72, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "4" ] }, "execution_count": 72, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f(p)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "スカラー場の`display()` メソッドは与えられた座標系でのスカラー場の表現を表示します。\n", "\n", "The method `display()` provides the expression of the scalar field in terms of a given chart:" ] }, { "cell_type": "code", "execution_count": 73, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "f: U --> R\n", " (x, y, z) |--> z^3 + y^2 + x" ] }, "execution_count": 73, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.display(X_U)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "引数なしで呼び出された場合、`display()`メソッドは 定義域 $U$ の上で定義された全ての座標系について、座標表現を表示します。\n", "(但し制限された副定義域のみで定義された *副座標系* は除きます。)\n", "\n", "If no argument is provided, the method `display()` shows the coordinate expression of the scalar field in all the charts defined on the domain (except for *subcharts*, i.e. the restrictions of some chart to a subdomain):" ] }, { "cell_type": "code", "execution_count": 74, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "f: U --> R\n", " (x, y, z) |--> z^3 + y^2 + x\n", " (r, th, ph) |--> r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 74, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "スカラー場 $f$の 座標$(r,\\theta,\\phi)$ での表現はユーザによって与えられたものではなく、座標系の遷移写像で定義された座標変換のルールを使って自動的に導出されていることに注意してください。\n", "\n", "

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.

" ] }, { "cell_type": "code", "execution_count": 75, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "f: U --> R\n", " (r, th, ph) |--> r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 75, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.display(Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "各座標系で、スカラー場は座標の関数(`CoordFunctionSymb` のオブジェクト)として表現されます。このオブジェクトは`coord_function()`メソッドを通じてアクセス可能です。\n", "

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():

" ] }, { "cell_type": "code", "execution_count": 76, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "z^3 + y^2 + x" ] }, "execution_count": 76, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.coord_function(X_U)" ] }, { "cell_type": "code", "execution_count": 77, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(x, y, z) |--> z^3 + y^2 + x" ] }, "execution_count": 77, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.coord_function(X_U).display()" ] }, { "cell_type": "code", "execution_count": 78, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 78, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.coord_function(Y)" ] }, { "cell_type": "code", "execution_count": 79, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(r, th, ph) |--> r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 79, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.coord_function(Y).display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\"生\"の記号的表現は、`expr()`メソッドの戻り値として返されます。\n", "

The \"raw\" symbolic expression is returned by the method expr():

" ] }, { "cell_type": "code", "execution_count": 80, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "z^3 + y^2 + x" ] }, "execution_count": 80, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.expr(X_U)" ] }, { "cell_type": "code", "execution_count": 81, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 81, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.expr(Y)" ] }, { "cell_type": "code", "execution_count": 82, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 82, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.expr(Y) is f.coord_function(Y).expr()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "スカラー場は具体的な式ではなく、座標値の関数を用いて定義することも可能です。\n", "

A scalar field can also be defined by some unspecified function of the coordinates:

" ] }, { "cell_type": "code", "execution_count": 83, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field h on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "h = U.scalar_field(function('H')(x, y, z), name='h') ; print(h)" ] }, { "cell_type": "code", "execution_count": 84, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "h: U --> R\n", " (x, y, z) |--> H(x, y, z)\n", " (r, th, ph) |--> H(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 84, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h.display()" ] }, { "cell_type": "code", "execution_count": 85, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "h: U --> R\n", " (r, th, ph) |--> H(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 85, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h.display(Y)" ] }, { "cell_type": "code", "execution_count": 86, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "H(1, 2, -1)" ] }, "execution_count": 86, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h(p) # remember that p is the point of coordinates (1,2,-1) in the chart X_U" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$f$の親(parent)は すべての $U$ 上の滑らかなスカラー場からなる集合 $C^\\infty(U)$ です。これは$\\mathbb{R}$上の 可換代数です。\n", "\n", "

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}$:

" ] }, { "cell_type": "code", "execution_count": 87, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Algebra of differentiable scalar fields on the Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 87, "metadata": {}, "output_type": "execute_result" } ], "source": [ "CU = f.parent() ; CU" ] }, { "cell_type": "code", "execution_count": 88, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Algebra of differentiable scalar fields on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(CU)" ] }, { "cell_type": "code", "execution_count": 89, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Category of commutative algebras over Symbolic Ring" ] }, "execution_count": 89, "metadata": {}, "output_type": "execute_result" } ], "source": [ "CU.category()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "代数$CU$の基礎体となる環は実数体$\\mathbb{R}$です。それはSageMathではSymbolic Ring (SR)で表現されます。\n", "\n", "
 
\n", "
\n", "

The base ring of the algebra is the field $\\mathbb{R}$, which is represented here by SageMath's Symbolic Ring (SR):

\n", "
\n", "
 
" ] }, { "cell_type": "code", "execution_count": 90, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Symbolic Ring" ] }, "execution_count": 90, "metadata": {}, "output_type": "execute_result" } ], "source": [ "CU.base_ring()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "スカラー場の代数計算は代数構造を通じて定義されます。\n", "\n", "

Arithmetic operations on scalar fields are defined through the algebra structure:

" ] }, { "cell_type": "code", "execution_count": 91, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "s = f + 2*h ; print(s)" ] }, { "cell_type": "code", "execution_count": 92, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "U --> R\n", "(x, y, z) |--> z^3 + y^2 + x + 2*H(x, y, z)\n", "(r, th, ph) |--> r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th) + 2*H(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 92, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 接空間:Tangent spaces\n", "\n", "点 $p$での多様体の接ベクトル空間を次のようにして取り出します。\n", "\n", "

The tangent vector space to the manifold at point $p$ is obtained as follows:

" ] }, { "cell_type": "code", "execution_count": 93, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Tangent space at Point p on the 3-dimensional differentiable manifold M" ] }, "execution_count": 93, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Tp = M.tangent_space(p) ; Tp" ] }, { "cell_type": "code", "execution_count": 94, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent space at Point p on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(Tp)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$T_p\\, \\mathcal{M}$は $\\mathbb{R}$上の3次元のベクトル空間です。\n", "\n", "

$T_p\\, \\mathcal{M}$ is a 3-dimensional vector space over $\\mathbb{R}$ (represented here by SageMath's Symbolic Ring (SR)) :

" ] }, { "cell_type": "code", "execution_count": 95, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Category of finite dimensional vector spaces over Symbolic Ring\n" ] } ], "source": [ "print(Tp.category())" ] }, { "cell_type": "code", "execution_count": 96, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "3" ] }, "execution_count": 96, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Tp.dim()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

$T_p\\, \\mathcal{M}$のベクトルの基底は点$p$の周りのベクトルフレームから誘導されます。\n", "\n", "

$T_p\\, \\mathcal{M}$ is automatically endowed with vector bases deduced from the vector frames defined around the point:

" ] }, { "cell_type": "code", "execution_count": 97, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Basis (d/dx,d/dy,d/dz) on the Tangent space at Point p on the 3-dimensional differentiable manifold M,\n", " Basis (d/dr,d/dth,d/dph) on the Tangent space at Point p on the 3-dimensional differentiable manifold M]" ] }, "execution_count": 97, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Tp.bases()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "対照的に、点 $q$については、あらかじめ定義された基底は一つだけです。$q$はドメイン$U$に含まれませんので、$(r,\\theta,\\phi)$に関連づけれられていません。\n", "\n", "

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)$:

" ] }, { "cell_type": "code", "execution_count": 98, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Basis (d/dx,d/dy,d/dz) on the Tangent space at Point q on the 3-dimensional differentiable manifold M]" ] }, "execution_count": 98, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Tq = M.tangent_space(q)\n", "Tq.bases()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ランダムな要素:\n", "\n", "

A random element:

" ] }, { "cell_type": "code", "execution_count": 99, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent vector at Point p on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "v = Tp.an_element() ; print(v)" ] }, { "cell_type": "code", "execution_count": 100, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "d/dx + 2 d/dy + 3 d/dz" ] }, "execution_count": 100, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display()" ] }, { "cell_type": "code", "execution_count": 101, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent vector at Point q on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "u = Tq.an_element() ; print(u)" ] }, { "cell_type": "code", "execution_count": 102, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "d/dx + 2 d/dy + 3 d/dz" ] }, "execution_count": 102, "metadata": {}, "output_type": "execute_result" } ], "source": [ "u.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "上記の簡略化された表現(基底ベクトルに点$p$あるいは$q$の指定がない)から類推されるのとは異なり、$u$と$v$は異なるベクトルです。これらは異なったベクトル空間に属しています。:\n", "\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 103, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Tangent space at Point p on the 3-dimensional differentiable manifold M" ] }, "execution_count": 103, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.parent()" ] }, { "cell_type": "code", "execution_count": 104, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Tangent space at Point q on the 3-dimensional differentiable manifold M" ] }, "execution_count": 104, "metadata": {}, "output_type": "execute_result" } ], "source": [ "u.parent()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "とくに $u$と$v$を足し合わせることはできません。\n", "

In particular, it is not possible to add $u$ and $v$:

" ] }, { "cell_type": "code", "execution_count": 105, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "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'\n" ] } ], "source": [ "try:\n", " s = u + v\n", "except TypeError as exc:\n", " print(\"Error: \" + str(exc))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## べクトル場:Vector Fields\n", "全ての座標系は座標系のドメインの上のベクトルフレーム、`coordinate basis`と呼ばれます、を持っています。\n", "\n", "

Each chart defines a vector frame on the chart domain: the so-called coordinate basis:

" ] }, { "cell_type": "code", "execution_count": 106, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Coordinate frame (M, (d/dx,d/dy,d/dz))" ] }, "execution_count": 106, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X.frame()" ] }, { "cell_type": "code", "execution_count": 107, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "3-dimensional differentiable manifold M" ] }, "execution_count": 107, "metadata": {}, "output_type": "execute_result" } ], "source": [ "X.frame().domain() # this frame is defined on the whole manifold このフレームは多様体全体で定義されています。" ] }, { "cell_type": "code", "execution_count": 108, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Coordinate frame (U, (d/dr,d/dth,d/dph))" ] }, "execution_count": 108, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Y.frame()" ] }, { "cell_type": "code", "execution_count": 109, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 109, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Y.frame().domain() # this frame is defined only on U このフレームは部分多様体 $U$でのみ定義されています。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`frames()`メソッドによって、与えられた開空間で定義されたフレームのリストが入手可能です。\n", "\n", "

The list of frames defined on a given open subset is returned by the method frames():

" ] }, { "cell_type": "code", "execution_count": 110, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Coordinate frame (M, (d/dx,d/dy,d/dz)),\n", " Coordinate frame (U, (d/dx,d/dy,d/dz)),\n", " Coordinate frame (U, (d/dr,d/dth,d/dph))]" ] }, "execution_count": 110, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M.frames()" ] }, { "cell_type": "code", "execution_count": 111, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Coordinate frame (U, (d/dx,d/dy,d/dz)),\n", " Coordinate frame (U, (d/dr,d/dth,d/dph))]" ] }, "execution_count": 111, "metadata": {}, "output_type": "execute_result" } ], "source": [ "U.frames()" ] }, { "cell_type": "code", "execution_count": 112, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Coordinate frame (M, (d/dx,d/dy,d/dz))" ] }, "execution_count": 112, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M.default_frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`set_default_frame()`メソッドで別途明示的に指定されない限り、基底の座標系に関連づけられるベクトルフレームが基底のフレームです。\n", "\n", "

Unless otherwise specified (via the command set_default_frame()), the default frame is that associated with the default chart:

" ] }, { "cell_type": "code", "execution_count": 113, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 113, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M.default_frame() is M.default_chart().frame()" ] }, { "cell_type": "code", "execution_count": 114, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 114, "metadata": {}, "output_type": "execute_result" } ], "source": [ "U.default_frame() is U.default_chart().frame()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "フレームのそれぞれの要素は指標を使って指定できます。\n", "\n", "

Individual elements of a frame can be accessed by means of their indices:

" ] }, { "cell_type": "code", "execution_count": 115, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Vector field d/dy on the Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 115, "metadata": {}, "output_type": "execute_result" } ], "source": [ "e = U.default_frame() ; e2 = e[2] ; e2" ] }, { "cell_type": "code", "execution_count": 116, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Vector field d/dy on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(e2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "新しいベクトル場を次のようにして、定義できます。\n", "

We may define a new vector field as follows:

" ] }, { "cell_type": "code", "execution_count": 117, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Vector field on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "v = e[2] + 2*x*e[3] ; print(v)" ] }, { "cell_type": "code", "execution_count": 118, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "d/dy + 2*x d/dz" ] }, "execution_count": 118, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場は与えられたベクトルフレームに関する要素を指定することで、定義できます。\n", "もしベクトルフレームが指定されていない場合には、既定のフレームがもちろん仮定されます。\n", "\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 119, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v = (y + 1) d/dx - x d/dy + x*y*z d/dz" ] }, "execution_count": 119, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v = U.vector_field(name='v') # vector field defined on the open set U\n", "v[1] = 1+y\n", "v[2] = -x\n", "v[3] = x*y*z\n", "v.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$U$上のベクトル場はSageの **要素(element)** オブジェクトです。その **親(parent)** は $U$上で定義されたベクトル場の$\\mathfrak{X}(U)$集合に設定されています。\n", "\n", "

Vector fields on $U$ are Sage element objects, whose parent is the set $\\mathfrak{X}(U)$ of vector fields defined on $U$:

" ] }, { "cell_type": "code", "execution_count": 120, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Free module X(U) of vector fields on the Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 120, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.parent()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "集合 $\\mathfrak{X}(U)$ は$U$で定義されたのスカラー場の可換代数$C^\\infty(U)$上のモジュールです。\n", "\n", "

The set $\\mathfrak{X}(U)$ is a module over the commutative algebra $C^\\infty(U)$ of scalar fields on $U$:

" ] }, { "cell_type": "code", "execution_count": 121, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Free module X(U) of vector fields on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(v.parent())" ] }, { "cell_type": "code", "execution_count": 122, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Category of finite dimensional modules over Algebra of differentiable scalar fields on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(v.parent().category())" ] }, { "cell_type": "code", "execution_count": 123, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Algebra of differentiable scalar fields on the Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 123, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.parent().base_ring()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場はスカラー場に作用します。\n", "\n", "

A vector field acts on scalar fields:

" ] }, { "cell_type": "code", "execution_count": 124, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "f: U --> R\n", " (x, y, z) |--> z^3 + y^2 + x\n", " (r, th, ph) |--> r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 124, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f.display()" ] }, { "cell_type": "code", "execution_count": 125, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field v(f) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "s = v(f) ; print(s)" ] }, { "cell_type": "code", "execution_count": 126, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v(f): U --> R\n", " (x, y, z) |--> 3*x*y*z^3 - (2*x - 1)*y + 1\n", " (r, th, ph) |--> -3*r^5*cos(ph)*cos(th)^5*sin(ph) + 3*r^5*cos(ph)*cos(th)^3*sin(ph) - 2*r^2*cos(ph)*sin(ph)*sin(th)^2 + r*sin(ph)*sin(th) + 1" ] }, "execution_count": 126, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s.display()" ] }, { "cell_type": "code", "execution_count": 127, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "d/dz = d/dz" ] }, "execution_count": 127, "metadata": {}, "output_type": "execute_result" } ], "source": [ "e[3].display()" ] }, { "cell_type": "code", "execution_count": 128, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "d/dz(f): U --> R\n", " (x, y, z) |--> 3*z^2\n", " (r, th, ph) |--> 3*r^2*cos(th)^2" ] }, "execution_count": 128, "metadata": {}, "output_type": "execute_result" } ], "source": [ "e[3](f).display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "設定されていない要素は、0 と仮定されます。\n", "\n", "

Unset components are assumed to be zero:

" ] }, { "cell_type": "code", "execution_count": 129, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "w = 3 d/dy" ] }, "execution_count": 129, "metadata": {}, "output_type": "execute_result" } ], "source": [ "w = U.vector_field(name='w')\n", "w[2] = 3\n", "w.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$U$上のベクトル場は座標系 $(r,\\theta,\\phi)$ に関係付けられているベクトルフレームで展開することができます。\n", "\n", "

A vector field on $U$ can be expanded in the vector frame associated with the chart $(r,\\theta,\\phi)$:

" ] }, { "cell_type": "code", "execution_count": 130, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v = (x*y*z^2 + x)/sqrt(x^2 + y^2 + z^2) d/dr - (x^3*y + x*y^3 - x)*sqrt(x^2 + y^2)*z/(x^4 + 2*x^2*y^2 + y^4 + (x^2 + y^2)*z^2) d/dth - (x^2 + y^2 + y)/(x^2 + y^2) d/dph" ] }, "execution_count": 130, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display(Y.frame())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "既定の設定では、要素は既定の座標 $(x,y,z)$ を用いて、表現されます。これらの要素を 別の座標 $(r,\\theta,\\phi)$ を用いて表現するには、\n", "`display()`メソッドの2番目の引数として、対応する座標系を指定することが必要です。\n", "\n", "

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():

" ] }, { "cell_type": "code", "execution_count": 131, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v = (r^3*cos(ph)*cos(th)^2*sin(ph)*sin(th)^2 + cos(ph)*sin(th)) d/dr - (r^3*cos(ph)*cos(th)*sin(ph)*sin(th)^3 - cos(ph)*cos(th))/r d/dth - (r*sin(th) + sin(ph))/(r*sin(th)) d/dph" ] }, "execution_count": 131, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display(Y.frame(), Y)" ] }, { "cell_type": "code", "execution_count": 132, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "d/dx = cos(ph)*sin(th) d/dr + cos(ph)*cos(th)/r d/dth - sin(ph)/(r*sin(th)) d/dph" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "d/dy = sin(ph)*sin(th) d/dr + cos(th)*sin(ph)/r d/dth + cos(ph)/(r*sin(th)) d/dph" ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "" ], "text/plain": [ "d/dz = cos(th) d/dr - sin(th)/r d/dth" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "for i in M.irange(): \n", " show(e[i].display(Y.frame(), Y))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "既定のフレームに関するテンソル場の要素は、コマンド `[:]` を使うことで、リストとして取り出せます。\n", "\n", "

The components of a tensor field w.r.t. the default frame can also be obtained as a list, via the command [:]:

" ] }, { "cell_type": "code", "execution_count": 133, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[y + 1, -x, x*y*z]" ] }, "execution_count": 133, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v[:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "別の方法として、`display_comp()`メソッドを使うこともできます。\n", "\n", "

An alternative is to use the method display_comp():

" ] }, { "cell_type": "code", "execution_count": 134, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v^x = y + 1 \n", "v^y = -x \n", "v^z = x*y*z " ] }, "execution_count": 134, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display_comp()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "別のフレームについての要素を取り出すには、`comp()` メソッドを通じて要素を取り出すフレームを指定する必要があります。\n", "\n", "

To obtain the components w.r.t. to another frame, one may go through the method comp() and specify the frame:

" ] }, { "cell_type": "code", "execution_count": 135, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[(x*y*z^2 + x)/sqrt(x^2 + y^2 + z^2),\n", " -(x^3*y + x*y^3 - x)*sqrt(x^2 + y^2)*z/(x^4 + 2*x^2*y^2 + y^4 + (x^2 + y^2)*z^2),\n", " -(x^2 + y^2 + y)/(x^2 + y^2)]" ] }, "execution_count": 135, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.comp(Y.frame())[:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "しかしながら、**[]**の最初の引数にフレームを与える 短縮表現も用意されています。\n", "\n", "

However a shortcut is to provide the frame as the first argument of the square brackets:

" ] }, { "cell_type": "code", "execution_count": 136, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[(x*y*z^2 + x)/sqrt(x^2 + y^2 + z^2),\n", " -(x^3*y + x*y^3 - x)*sqrt(x^2 + y^2)*z/(x^4 + 2*x^2*y^2 + y^4 + (x^2 + y^2)*z^2),\n", " -(x^2 + y^2 + y)/(x^2 + y^2)]" ] }, "execution_count": 136, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v[Y.frame(), :]" ] }, { "cell_type": "code", "execution_count": 137, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v^r = (x*y*z^2 + x)/sqrt(x^2 + y^2 + z^2) \n", "v^th = -(x^3*y + x*y^3 - x)*sqrt(x^2 + y^2)*z/(x^4 + 2*x^2*y^2 + y^4 + (x^2 + y^2)*z^2) \n", "v^ph = -(x^2 + y^2 + y)/(x^2 + y^2) " ] }, "execution_count": 137, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display_comp(Y.frame())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "要素は、既定の座標系の座標で表現されます。これらの別の座標系の座標、例えば$(r,\\theta,\\phi)$、で表現したい時には、\n", "`[]`の最後の引数として、座標系の名前を与えます。\n", "\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 138, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[r^3*cos(ph)*cos(th)^2*sin(ph)*sin(th)^2 + cos(ph)*sin(th),\n", " -(r^3*cos(ph)*cos(th)*sin(ph)*sin(th)^3 - cos(ph)*cos(th))/r,\n", " -(r*sin(th) + sin(ph))/(r*sin(th))]" ] }, "execution_count": 138, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v[Y.frame(), :, Y]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "あるいは、`display_comp()` の引数に座標系の名前を与えます。\n", "\n", "

or specify the chart in display_comp():

" ] }, { "cell_type": "code", "execution_count": 139, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v^r = r^3*cos(ph)*cos(th)^2*sin(ph)*sin(th)^2 + cos(ph)*sin(th) \n", "v^th = -(r^3*cos(ph)*cos(th)*sin(ph)*sin(th)^3 - cos(ph)*cos(th))/r \n", "v^ph = -(r*sin(th) + sin(ph))/(r*sin(th)) " ] }, "execution_count": 139, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display_comp(Y.frame(), chart=Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場の成分を座標についての表現ではなく、スカラーフィールドとして取り出すために、二重の括弧 `[[]]` を使います。\n", "\n", "To get some vector component as a scalar field instead of a coordinate expression, use double square brackets:" ] }, { "cell_type": "code", "execution_count": 140, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(v[[1]])" ] }, { "cell_type": "code", "execution_count": 141, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "U --> R\n", "(x, y, z) |--> y + 1\n", "(r, th, ph) |--> r*sin(ph)*sin(th) + 1" ] }, "execution_count": 141, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v[[1]].display()" ] }, { "cell_type": "code", "execution_count": 142, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "y + 1" ] }, "execution_count": 142, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v[[1]].expr(X_U)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場は要素に関数オブジェクトとして定義することも可能です。\n", "\n", "

A vector field can be defined with components being unspecified functions of the coordinates:

" ] }, { "cell_type": "code", "execution_count": 143, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "u = u_x(x, y, z) d/dx + u_y(x, y, z) d/dy + u_z(x, y, z) d/dz" ] }, "execution_count": 143, "metadata": {}, "output_type": "execute_result" } ], "source": [ "u = U.vector_field(name='u')\n", "u[:] = [function('u_x')(x,y,z), function('u_y')(x,y,z), function('u_z')(x,y,z)]\n", "u.display()" ] }, { "cell_type": "code", "execution_count": 144, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "s = (y + u_x(x, y, z) + 1) d/dx + (-x + u_y(x, y, z)) d/dy + (x*y*z + u_z(x, y, z)) d/dz" ] }, "execution_count": 144, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s = v + u ; s.set_name('s') ; s.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### ある点でのベクトル場の値:Values of vector fields at a given point\n", "多様体中のある点でのベクトル場の値は`at()`メソッドを通じて入手します。\n", "\n", "

The value of a vector field at some point of the manifold is obtained via the method at():

" ] }, { "cell_type": "code", "execution_count": 145, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent vector v at Point p on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "vp = v.at(p) ; print(vp)" ] }, { "cell_type": "code", "execution_count": 146, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v = 3 d/dx - d/dy - 2 d/dz" ] }, "execution_count": 146, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vp.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "座標系 $X_U$ = $(x,y,z)$ を使った、点$p$の座標と、ベクトル場$v$の要素は次のようになっていたことを思い出してください。\n", "\n", "

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

" ] }, { "cell_type": "code", "execution_count": 147, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(1, 2, -1)" ] }, "execution_count": 147, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.coord(X_U)" ] }, { "cell_type": "code", "execution_count": 148, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v = (y + 1) d/dx - x d/dy + x*y*z d/dz" ] }, "execution_count": 148, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display(X_U.frame(), X_U)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "記述を簡単にするために、点$p$でのベクトル場の値とベクトル場は同じ記号($v$)を使って表示されています。`set_name()`メソッドを使うことで、\n", "表示に使われる記号を変更できます。\n", "\n", "

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():

" ] }, { "cell_type": "code", "execution_count": 149, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "v = 3 d/dx - d/dy - 2 d/dz" ] }, "execution_count": 149, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vp.set_name(latex_name='v|_p')\n", "vp.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "もちろん、$v|_p$ は$p$の接ベクトル空間に属しています。\n", "\n", "

Of course, $v|_p$ belongs to the tangent space at $p$:

" ] }, { "cell_type": "code", "execution_count": 150, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Tangent space at Point p on the 3-dimensional differentiable manifold M" ] }, "execution_count": 150, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vp.parent()" ] }, { "cell_type": "code", "execution_count": 151, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 151, "metadata": {}, "output_type": "execute_result" } ], "source": [ "vp in M.tangent_space(p)" ] }, { "cell_type": "code", "execution_count": 152, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent vector u at Point p on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "up = u.at(p) ; print(up)" ] }, { "cell_type": "code", "execution_count": 153, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "u = u_x(1, 2, -1) d/dx + u_y(1, 2, -1) d/dy + u_z(1, 2, -1) d/dz" ] }, "execution_count": 153, "metadata": {}, "output_type": "execute_result" } ], "source": [ "up.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1-形式: 1-forms\n", "$\\mathcal{M}$の1-形式とは、線形形式の場です。例えば、スカラー場の微分は1ー形式です。\n", " \n", "

A 1-form on $\\mathcal{M}$ is a field of linear forms. For instance, it can be the differential of a scalar field:

" ] }, { "cell_type": "code", "execution_count": 154, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form df on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "df = f.differential() ; print(df)" ] }, { "cell_type": "code", "execution_count": 155, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "df = dx + 2*y dy + 3*z^2 dz" ] }, "execution_count": 155, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "上記の表現では、1-形式は座標系 $(x,y,z)$から導かれる基底$(\\mathrm{d}x, \\mathrm{d}y, \\mathrm{d}z)$で展開されています。\n", "この基底は`coframe()`メソッドで取り出すことが可能です。\n", "\n", "

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():

" ] }, { "cell_type": "code", "execution_count": 156, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Coordinate coframe (M, (dx,dy,dz))" ] }, "execution_count": 156, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dX = X.coframe() ; dX" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "多様体 $M$の上に存在する全ての coframe のリストは `coframes()` メソッドを使って取り出します。\n", "\n", "

The list of all coframes defined on a given manifold open subset is returned by the method coframes():

" ] }, { "cell_type": "code", "execution_count": 157, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[Coordinate coframe (M, (dx,dy,dz)),\n", " Coordinate coframe (U, (dx,dy,dz)),\n", " Coordinate coframe (U, (dr,dth,dph))]" ] }, "execution_count": 157, "metadata": {}, "output_type": "execute_result" } ], "source": [ "M.coframes()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場として、多様体上の点 $p$ における微分形式の値は `at()` メソッドで取り出します。\n", "\n", "

As for a vector field, the value of the differential form at some point on the manifold is obtained by the method at():

" ] }, { "cell_type": "code", "execution_count": 158, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Linear form df on the Tangent space at Point p on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "dfp = df.at(p) ; print(dfp)" ] }, { "cell_type": "code", "execution_count": 159, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "df = dx + 4 dy + 3 dz" ] }, "execution_count": 159, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dfp.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "なお、$p$の座標は次のようなものでした。\n", "

Recall that

" ] }, { "cell_type": "code", "execution_count": 160, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(1, 2, -1)" ] }, "execution_count": 160, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.coord()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "線形形式 $\\mathrm{d}f|_p$ は$p$の接ベクトル空間の双対に所属しています。\n", "\n", "

The linear form $\\mathrm{d}f|_p$ belongs to the dual of the tangent vector space at $p$:

" ] }, { "cell_type": "code", "execution_count": 161, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Dual of the Tangent space at Point p on the 3-dimensional differentiable manifold M" ] }, "execution_count": 161, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dfp.parent()" ] }, { "cell_type": "code", "execution_count": 162, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 162, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dfp.parent() is M.tangent_space(p).dual()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "その結果、線形形式を$p$の接ベクトルに作用させると、実数が結果として得られます。\n", "\n", "

As such, it is acting on vectors at $p$, yielding a real number:

" ] }, { "cell_type": "code", "execution_count": 163, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent vector v at Point p on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "v = 3 d/dx - d/dy - 2 d/dz" ] }, "execution_count": 163, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(vp) ; vp.display()" ] }, { "cell_type": "code", "execution_count": 164, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "-7" ] }, "execution_count": 164, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dfp(vp)" ] }, { "cell_type": "code", "execution_count": 165, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tangent vector u at Point p on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "u = u_x(1, 2, -1) d/dx + u_y(1, 2, -1) d/dy + u_z(1, 2, -1) d/dz" ] }, "execution_count": 165, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(up) ; up.display()" ] }, { "cell_type": "code", "execution_count": 166, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "u_x(1, 2, -1) + 4*u_y(1, 2, -1) + 3*u_z(1, 2, -1)" ] }, "execution_count": 166, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dfp(up)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

The differential 1-form of the unspecified scalar field $h$:

" ] }, { "cell_type": "code", "execution_count": 167, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "dh = d(H)/dx dx + d(H)/dy dy + d(H)/dz dz" ] }, "execution_count": 167, "metadata": {}, "output_type": "execute_result" } ], "source": [ "h.display() ; dh = h.differential() ; dh.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1-形式を何もないところから、定義することもできます。\n", "\n", "

A 1-form can also be defined from scratch:

" ] }, { "cell_type": "code", "execution_count": 168, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form omega on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "om = U.one_form('omega', r'\\omega') ; print(om)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "与えられたcoframeの要素をあたえることで、この1-形式を特定できます。\n", "\n", "

It can be specified by providing its components in a given coframe:

" ] }, { "cell_type": "code", "execution_count": 169, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega = (x^2 + y^2) dx + z dy + (x - z) dz" ] }, "execution_count": 169, "metadata": {}, "output_type": "execute_result" } ], "source": [ "om[:] = [x^2+y^2, z, x-z] # components in the default coframe (dx,dy,dz)\n", "om.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "もちろん、既定のフレームとは異なるあるフレームでの要素を指定することもできます。\n", "

Of course, one may set the components in a frame different from the default one:

" ] }, { "cell_type": "code", "execution_count": 170, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega = r*cos(ph)*sin(th) dr + r*sin(ph)*sin(th) dph" ] }, "execution_count": 170, "metadata": {}, "output_type": "execute_result" } ], "source": [ "om[Y.frame(), :, Y] = [r*sin(th)*cos(ph), 0, r*sin(th)*sin(ph)]\n", "om.display(Y.frame(), Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "この場合、coframe $(\\mathrm{d}x,\\mathrm{d}y,\\mathrm{d}z)$での要素は自動的に更新されます。\n", "\n", "

The components in the coframe $(\\mathrm{d}x,\\mathrm{d}y,\\mathrm{d}z)$ are updated automatically:

" ] }, { "cell_type": "code", "execution_count": 171, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega = (x^4 + x^2*y^2 - sqrt(x^2 + y^2 + z^2)*y^2)/(sqrt(x^2 + y^2 + z^2)*(x^2 + y^2)) dx + (x^3*y + x*y^3 + sqrt(x^2 + y^2 + z^2)*x*y)/(sqrt(x^2 + y^2 + z^2)*(x^2 + y^2)) dy + x*z/sqrt(x^2 + y^2 + z^2) dz" ] }, "execution_count": 171, "metadata": {}, "output_type": "execute_result" } ], "source": [ "om.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "元の要素の値に戻してみます。\n", "\n", "

Let us revert to the values set previously:

" ] }, { "cell_type": "code", "execution_count": 172, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega = (x^2 + y^2) dx + z dy + (x - z) dz" ] }, "execution_count": 172, "metadata": {}, "output_type": "execute_result" } ], "source": [ "om[:] = [x^2+y^2, z, x-z]\n", "om.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "今度は、coframe $(\\mathrm{d}r, \\mathrm{d}\\theta,\\mathrm{d}\\phi)$ についての要素は自動的に更新されています。\n", "\n", "

This time, the components in the coframe $(\\mathrm{d}r, \\mathrm{d}\\theta,\\mathrm{d}\\phi)$ are those that are updated:

" ] }, { "cell_type": "code", "execution_count": 173, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega = (r^2*cos(ph)*sin(th)^3 + r*(cos(ph) + sin(ph))*cos(th)*sin(th) - r*cos(th)^2) dr + (r^2*cos(th)^2*sin(ph) + r^2*cos(th)*sin(th) + (r^3*cos(ph)*cos(th) - r^2*cos(ph))*sin(th)^2) dth + (-r^3*sin(ph)*sin(th)^3 + r^2*cos(ph)*cos(th)*sin(th)) dph" ] }, "execution_count": 173, "metadata": {}, "output_type": "execute_result" } ], "source": [ "om.display(Y.frame(), Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1-形式は、ベクトル場に作用して、スカラー場を与えます。\n", "\n", "

A 1-form acts on vector fields, resulting in a scalar field:

" ] }, { "cell_type": "code", "execution_count": 174, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field omega(v) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "omega(v): U --> R\n", " (x, y, z) |--> -x*y*z^2 + x^2*y + y^3 + x^2 + y^2 + (x^2*y - x)*z\n", " (r, th, ph) |--> -r^2*cos(ph)*cos(th)*sin(th) + (r^4*cos(ph)^2*cos(th)*sin(ph) + r^3*sin(ph))*sin(th)^3 - (r^4*cos(ph)*cos(th)^2*sin(ph) - r^2)*sin(th)^2" ] }, "execution_count": 174, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.display() ; om.display() ; print(om(v)) ; om(v).display()" ] }, { "cell_type": "code", "execution_count": 175, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field df(v) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "df(v): U --> R\n", " (x, y, z) |--> 3*x*y*z^3 - (2*x - 1)*y + 1\n", " (r, th, ph) |--> r*sin(ph)*sin(th) + (3*r^5*cos(ph)*cos(th)^3*sin(ph) - 2*r^2*cos(ph)*sin(ph))*sin(th)^2 + 1" ] }, "execution_count": 175, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.display() ; print(df(v)) ; df(v).display()" ] }, { "cell_type": "code", "execution_count": 176, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega(u): U --> R\n", " (x, y, z) |--> x^2*u_x(x, y, z) + y^2*u_x(x, y, z) + z*(u_y(x, y, z) - u_z(x, y, z)) + x*u_z(x, y, z)\n", " (r, th, ph) |--> r^2*sin(th)^2*u_x(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th)) + r*cos(th)*u_y(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th)) + (r*cos(ph)*sin(th) - r*cos(th))*u_z(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 176, "metadata": {}, "output_type": "execute_result" } ], "source": [ "u.display() ; om(u).display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "スカラー場$f$から導かれた1ー形式については、次の恒等式が成立します。\n", "\n", "

In the case of a differential 1-form, the following identity holds:

" ] }, { "cell_type": "code", "execution_count": 177, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 177, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df(v) == v(f)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1-形式は、*親*が $U$上で定義された全ての1ー形式からなる$C^\\infty(U)$-module $\\Omega^{1}(U)$ であるSageの *element* オブジェクトです。\n", "\n", "1-forms are Sage *element* objects, whose *parent* is the $C^\\infty(U)$-module $\\Omega^{1}(U)$ of all 1-forms defined on $U$:" ] }, { "cell_type": "code", "execution_count": 178, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Free module Omega^1(U) of 1-forms on the Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 178, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.parent()" ] }, { "cell_type": "code", "execution_count": 179, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Free module Omega^1(U) of 1-forms on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(df.parent())" ] }, { "cell_type": "code", "execution_count": 180, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Free module Omega^1(U) of 1-forms on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(om.parent())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$\\Omega^{1}(U)$は自由モジュール $\\mathfrak{X}(U)$の双対です。\n", "\n", "$\\Omega^{1}(U)$ is actually the dual of the free module $\\mathfrak{X}(U)$:" ] }, { "cell_type": "code", "execution_count": 181, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.parent() is v.parent().dual()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 微分形式と外積, 外微分\n", "二つの1ー形式の **外積** は `wedge()` メソッドを使って求められます。その結果は 2-形式となります。\n", "\n", "

Differential forms and exterior calculus

\n", "

The exterior product of two 1-forms is taken via the method wedge() and results in a 2-form:

" ] }, { "cell_type": "code", "execution_count": 182, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2-form omega/\\df on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "omega/\\df = (2*x^2*y + 2*y^3 - z) dx/\\dy + (3*(x^2 + y^2)*z^2 - x + z) dx/\\dz + (3*z^3 - 2*x*y + 2*y*z) dy/\\dz" ] }, "execution_count": 182, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = om.wedge(df) ; print(a) ; a.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "行列形式での要素の表示:\n", "

A matrix view of the components:

" ] }, { "cell_type": "code", "execution_count": 183, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[ 0 2*x^2*y + 2*y^3 - z 3*(x^2 + y^2)*z^2 - x + z]\n", "[ -2*x^2*y - 2*y^3 + z 0 3*z^3 - 2*x*y + 2*y*z]\n", "[-3*(x^2 + y^2)*z^2 + x - z -3*z^3 + 2*x*y - 2*y*z 0]" ] }, "execution_count": 183, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a[:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "歪対称性から導かれる余分な要素を省き、ゼロでない成分だけを表示します:\n", "

Displaying only the non-vanishing components, skipping the redundant ones (i.e. those that can be deduced by antisymmetry):

" ] }, { "cell_type": "code", "execution_count": 184, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega/\\df_xy = 2*x^2*y + 2*y^3 - z \n", "omega/\\df_xz = 3*(x^2 + y^2)*z^2 - x + z \n", "omega/\\df_yz = 3*z^3 - 2*x*y + 2*y*z " ] }, "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.display_comp(only_nonredundant=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2-形式$\\omega\\wedge\\mathrm{d}f$を コフレーム$(\\mathrm{d}r,\\mathrm{d}\\theta,\\mathrm{d}\\phi)$ での成分に展開することもできます。\n", "\n", "

The 2-form $\\omega\\wedge\\mathrm{d}f$ can be expanded on the $(\\mathrm{d}r,\\mathrm{d}\\theta,\\mathrm{d}\\phi)$ coframe:

" ] }, { "cell_type": "code", "execution_count": 185, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "omega/\\df = (3*r^5*cos(ph)*sin(th)^4 - (3*r^5*cos(ph) - 3*r^4*cos(th)*sin(ph) - 2*r^3*cos(ph)*sin(ph)^2)*sin(th)^2 - (3*r^4*sin(ph) + r^2*cos(ph))*cos(th) - (2*r^3*cos(th)*sin(ph)^2 + (sin(ph)^2 - 1)*r^2)*sin(th)) dr/\\dth + (2*r^4*sin(ph)*sin(th)^5 + (3*r^5*cos(th)^3*sin(ph) + 2*r^3*cos(ph)^2*cos(th)*sin(ph))*sin(th)^3 - (2*r^3*cos(ph)*cos(th)^2*sin(ph) + (cos(ph)*sin(ph) + 1)*r^2*cos(th))*sin(th)^2 - (3*r^4*cos(ph)*cos(th)^4 - r^2*cos(th)^2*sin(ph))*sin(th)) dr/\\dph + (-r^3*cos(th)^2*sin(th) - (3*r^6*cos(th)^2*sin(ph) + 2*r^4*cos(ph)^2*sin(ph) - 2*r^5*cos(th)*sin(ph))*sin(th)^4 + (2*r^4*cos(ph)*cos(th)*sin(ph) + r^3*cos(ph)*sin(ph))*sin(th)^3 + (3*r^5*cos(ph)*cos(th)^3 - r^3*cos(th)*sin(ph))*sin(th)^2) dth/\\dph" ] }, "execution_count": 185, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.display(Y.frame(), Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$A:=\\omega\\wedge\\mathrm{d}f$ は2-形式として 二組のベクトルに作用させることができ、また歪対称です。\n", "\n", "

As a 2-form, $A:=\\omega\\wedge\\mathrm{d}f$ can be applied to a pair of vectors and is antisymmetric:

" ] }, { "cell_type": "code", "execution_count": 186, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field A(u,v) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "A(u,v): U --> R\n", " (x, y, z) |--> 3*x*y*z^4*u_y(x, y, z) - 2*x^2*y^2*u_y(x, y, z) - 2*y^4*u_y(x, y, z) - 2*(x*u_x(x, y, z) + u_y(x, y, z))*y^3 + 3*(x^3*y*u_x(x, y, z) + x*y^3*u_x(x, y, z) + x*u_z(x, y, z))*z^3 - (3*y^3*u_z(x, y, z) - (2*x*u_y(x, y, z) - 3*u_z(x, y, z))*y^2 + 3*x^2*u_z(x, y, z) + (3*x^2*u_z(x, y, z) - x*u_x(x, y, z))*y)*z^2 - (2*x^3*u_x(x, y, z) + 2*x^2*u_y(x, y, z) + (2*x^2 - x)*u_z(x, y, z))*y - (2*x^2*y^2*u_y(x, y, z) + (x^2*u_x(x, y, z) - (2*x - 1)*u_z(x, y, z) - u_y(x, y, z))*y - x*u_x(x, y, z) - u_y(x, y, z) + u_z(x, y, z))*z + x*u_z(x, y, z)\n", " (r, th, ph) |--> (r^4*cos(ph)*cos(th)^2*sin(ph)*sin(th)^2 + (sin(ph)^3 - sin(ph))*r^4*cos(th)*sin(th)^3 + r^2*cos(ph)*cos(th)*sin(th) + (3*r^7*cos(ph)*cos(th)^3*sin(ph) - 2*r^4*cos(ph)*sin(ph))*sin(th)^4)*u_x(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th)) + (3*r^6*cos(ph)*cos(th)^4*sin(ph)*sin(th)^2 + r^2*cos(th)*sin(ph)*sin(th) + 2*((sin(ph)^4 - sin(ph)^2)*r^5*cos(th) - r^4*sin(ph)^2)*sin(th)^4 + 2*(r^5*cos(ph)*cos(th)^2*sin(ph)^2 - r^3*sin(ph))*sin(th)^3 + r*cos(th))*u_y(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th)) - ((3*r^5*cos(th)^2*sin(ph) - 2*(sin(ph)^3 - sin(ph))*r^3)*sin(th)^3 + (3*r^4*cos(th)^2 - 2*r^3*cos(ph)*cos(th)*sin(ph) - r^2*cos(ph)*sin(ph))*sin(th)^2 + r*cos(th) - (3*r^4*cos(ph)*cos(th)^3 - r^2*cos(th)*sin(ph) + r*cos(ph))*sin(th))*u_z(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 186, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.set_name('A')\n", "print(a(u,v)) ; a(u,v).display()" ] }, { "cell_type": "code", "execution_count": 187, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 187, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a(u,v) == - a(v,u)" ] }, { "cell_type": "code", "execution_count": 188, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "no symmetry; antisymmetry: (0, 1)\n" ] } ], "source": [ "a.symmetries()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ある微分形式の **外微分** は以下のように、`exterior_derivative()`メソッドを使って求めます。\n", "\n", "

The exterior derivative  of a differential form:

" ] }, { "cell_type": "code", "execution_count": 189, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2-form domega on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "domega = -2*y dx/\\dy + dx/\\dz - dy/\\dz" ] }, "execution_count": 189, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dom = om.exterior_derivative() ; print(dom) ; dom.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`exterior_derivative()`メソッドを作用させる代わりに、関数 `xder()` を使うこともできます。`xder()`関数の使用に先立って、`sage.manifolds.utilities`モジュールから`xder`をインポートしておく必要があります。\n", "\n", "

Instead of invoking the method exterior_derivative(), one can use the function xder, after having imported it from sage.manifolds.utilities:

" ] }, { "cell_type": "code", "execution_count": 190, "metadata": {}, "outputs": [], "source": [ "from sage.manifolds.utilities import xder\n", "dom = xder(om)" ] }, { "cell_type": "code", "execution_count": 191, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3-form dA on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "dA = (-6*y*z^2 - 2*y - 1) dx/\\dy/\\dz" ] }, "execution_count": 191, "metadata": {}, "output_type": "execute_result" } ], "source": [ "da = xder(a) ; print(da) ; da.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**外微分** を続けて作用させると、結果は0になります。\n", "\n", "

The exterior derivative is nilpotent:

" ] }, { "cell_type": "code", "execution_count": 192, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "ddf = 0" ] }, "execution_count": 192, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ddf = xder(df) ; ddf.display()" ] }, { "cell_type": "code", "execution_count": 193, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "ddomega = 0" ] }, "execution_count": 193, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ddom = xder(dom) ; ddom.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Lie 微分: Lie derivative\n", "テンソル場のあるベクトル場に関するLie微分は、`lie_derivative()` メソッドを用いて計算します。\n", "\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 194, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "(-y*z^2 + (x*y - 1)*z + 2*x) dx + (-x*z^2 + x^2 + y^2 + (x^2 + x*y)*z) dy + (-2*x*y*z + (x^2 + 1)*y + 1) dz" ] }, "execution_count": 194, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lv_om = om.lie_derivative(v) ; print(lv_om) ; lv_om.display()" ] }, { "cell_type": "code", "execution_count": 195, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "(u_x(x, y, z)*d^2(H)/dx^2 + u_y(x, y, z)*d^2(H)/dxdy + u_z(x, y, z)*d^2(H)/dxdz + d(H)/dx*d(u_x)/dx + d(H)/dy*d(u_y)/dx + d(H)/dz*d(u_z)/dx) dx + (u_x(x, y, z)*d^2(H)/dxdy + u_y(x, y, z)*d^2(H)/dy^2 + u_z(x, y, z)*d^2(H)/dydz + d(H)/dx*d(u_x)/dy + d(H)/dy*d(u_y)/dy + d(H)/dz*d(u_z)/dy) dy + (u_x(x, y, z)*d^2(H)/dxdz + u_y(x, y, z)*d^2(H)/dydz + u_z(x, y, z)*d^2(H)/dz^2 + d(H)/dx*d(u_x)/dz + d(H)/dy*d(u_y)/dz + d(H)/dz*d(u_z)/dz) dz" ] }, "execution_count": 195, "metadata": {}, "output_type": "execute_result" } ], "source": [ "lu_dh = dh.lie_derivative(u) ; print(lu_dh) ; lu_dh.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "*Cartanの恒等式*を確かめてみましょう\n", "\n", "1-形式$\\omega$についての*Cartanの恒等式*\n", "$$\\mathcal{L}_v \\omega = v\\cdot \\mathrm{d}\\omega + \\mathrm{d}\\langle \\omega, v\\rangle$$\n", "2-形式$\\omega$についての*Cartanの恒等式*\n", "$$\\mathcal{L}_v A = v\\cdot \\mathrm{d}A + \\mathrm{d}(v\\cdot A)$$\n", "\n", "

Let us check Cartan identity on the 1-form $\\omega$:

\n", "

$\\mathcal{L}_v \\omega = v\\cdot \\mathrm{d}\\omega + \\mathrm{d}\\langle \\omega, v\\rangle$

\n", "

and on the 2-form $A$:

\n", "

$\\mathcal{L}_v A = v\\cdot \\mathrm{d}A + \\mathrm{d}(v\\cdot A)$

" ] }, { "cell_type": "code", "execution_count": 196, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 196, "metadata": {}, "output_type": "execute_result" } ], "source": [ "om.lie_derivative(v) == v.contract(xder(om)) + xder(om(v))" ] }, { "cell_type": "code", "execution_count": 197, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 197, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a.lie_derivative(v) == v.contract(xder(a)) + xder(v.contract(a))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場の別のベクトル場によるLie微分は、二つのベクトル場による **交換子積**(あるいは **交換子**) になります。\n", "\n", "

The Lie derivative of a vector field along another one is the commutator of the two vectors fields:

" ] }, { "cell_type": "code", "execution_count": 198, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 198, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.lie_derivative(u)(f) == u(v(f)) - v(u(f))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 任意の階数のテンソル場:Tensor fields of arbitrary rank\n", "これまでに、次のようなテンソル場をみてきました。\n", "\n", " - (0,0)形式のテンソル :スカラー場,\n", " - (1,0) 形式のテンソル :ベクトル場,\n", " - (0,1)形式のテンソル :1ー形式あるいは一階の微分形式,\n", " - (0,2)形式で歪対称のテンソル :2ー形式あるいは二階の微分形式.\n", "\n", "より一般に、$(p,q)$型のテンソル場をSageManifoldsに導入することができます。\n", "例えば、副多様体$U$上の(1,2)型のテンソル場を次のように宣言します。\n", "\n", "

Tensor fields of arbitrary rank

\n", "

Up to now, we have encountered tensor fields

\n", "
    \n", "
  • of type (0,0) (i.e. scalar fields),
  • \n", "
  • of type (1,0) (i.e. vector fields),
  • \n", "
  • of type (0,1) (i.e. 1-forms),
  • \n", "
  • of type (0,2) and antisymmetric (i.e. 2-forms).
  • \n", "
\n", "

More generally, tensor fields of any type $(p,q)$ can be introduced in SageManifolds. For instance a tensor field of type (1,2) on the open subset $U$ is declared as follows:

" ] }, { "cell_type": "code", "execution_count": 199, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field T of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "t = U.tensor_field(1, 2, name='T') ; print(t)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトルや1-形式と同じように、テンソル場の既定のフレームに関する要素を `[]`演算子を使って設定できます。\n", "\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 200, "metadata": {}, "outputs": [], "source": [ "t[1,2,1] = 1 + x^2\n", "t[3,2,1] = x*y*z" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "設定されていない要素は0です。\n", "

Unset components are zero:

" ] }, { "cell_type": "code", "execution_count": 201, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "T = (x^2 + 1) d/dx*dy*dx + x*y*z d/dz*dy*dx" ] }, "execution_count": 201, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t.display()" ] }, { "cell_type": "code", "execution_count": 202, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[[[0, 0, 0], [x^2 + 1, 0, 0], [0, 0, 0]],\n", " [[0, 0, 0], [0, 0, 0], [0, 0, 0]],\n", " [[0, 0, 0], [x*y*z, 0, 0], [0, 0, 0]]]" ] }, "execution_count": 202, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t[:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "0 でない要素を表示します。\n", "

Display of the nonzero components:

" ] }, { "cell_type": "code", "execution_count": 203, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "T^x_yx = x^2 + 1 \n", "T^z_yx = x*y*z " ] }, "execution_count": 203, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t.display_comp()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "二重括弧`[[]]`演算子は既定のフレームに関する成分をスカラー場として返します。一方、一重の括弧`[]`演算子はこのスカラー場の既定の座標系についての表現を返します。\n", "

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:

" ] }, { "cell_type": "code", "execution_count": 204, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "U --> R\n", "(x, y, z) |--> x^2 + 1\n", "(r, th, ph) |--> r^2*cos(ph)^2*sin(th)^2 + 1" ] }, "execution_count": 204, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(t[[1,2,1]]) ; t[[1,2,1]].display()" ] }, { "cell_type": "code", "execution_count": 205, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "x^2 + 1\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "x^2 + 1" ] }, "execution_count": 205, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(t[1,2,1]) ; t[1,2,1]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(1,2)型のテンソル場は (1-形式、ベクトル場、ベクトル場)からなる3成分のタプルをスカラー場に写像します。\n", "\n", "

A tensor field of type (1,2) maps a 3-tuple (1-form, vector field, vector field) to a scalar field:

" ] }, { "cell_type": "code", "execution_count": 206, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field T(omega,u,v) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "T(omega,u,v): U --> R\n", " (x, y, z) |--> (x^2 + 1)*y^3*u_y(x, y, z) + (x^2 + 1)*y^2*u_y(x, y, z) - (x*y^2*u_y(x, y, z) + x*y*u_y(x, y, z))*z^2 + (x^4 + x^2)*y*u_y(x, y, z) + (x^2*y^2*u_y(x, y, z) + x^2*y*u_y(x, y, z))*z + (x^4 + x^2)*u_y(x, y, z)\n", " (r, th, ph) |--> (r^5*cos(ph)^2*sin(ph)*sin(th)^5 - ((cos(ph)^4 - cos(ph)^2)*r^5*cos(th) - r^4*cos(ph)^2)*sin(th)^4 + ((cos(ph)^3 - cos(ph))*r^5*cos(th)^2 + r^4*cos(ph)^2*cos(th)*sin(ph) + r^3*sin(ph))*sin(th)^3 - (r^4*cos(ph)*cos(th)^2*sin(ph) - r^2)*sin(th)^2)*u_y(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 206, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(t(om, u, v)) ; t(om, u, v).display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "ベクトル場や微分形式と同じように、多様体に定義されたどのフレームついてのテンソル場の成分も取り出せます。\n", "\n", "

As for vectors and differential forms, the tensor components can be taken in any frame defined on the manifold:

" ] }, { "cell_type": "code", "execution_count": 207, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "r^2*cos(ph)^4*sin(ph)*sin(th)^5 + (cos(ph)^4 - cos(ph)^2)*r^3*sin(th)^6 - (cos(ph)^4 - cos(ph)^2)*r^3*sin(th)^4 + cos(ph)^2*sin(ph)*sin(th)^3" ] }, "execution_count": 207, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t[Y.frame(), 1,1,1, Y]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## テンソル計算:Tensor calculus\n", "テンソル積$\\otimes$ は `*`で示されます。\n", "\n", "

The tensor product $\\otimes$ is denoted by `*`:

" ] }, { "cell_type": "code", "execution_count": 208, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "(0, 2)" ] }, "execution_count": 208, "metadata": {}, "output_type": "execute_result" } ], "source": [ "v.tensor_type() ; a.tensor_type()" ] }, { "cell_type": "code", "execution_count": 209, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field v*A of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Tensor field v*A of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M" ] }, "execution_count": 209, "metadata": {}, "output_type": "execute_result" } ], "source": [ "b = v*a ; print(b) ; b" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "テンソル積は、(歪)対称性を保ちます。$A$は2-形式なので、二つの引数(位置0および1)について歪対称です。結果として$b$は最後の二つの引数(位置1および2)について歪対称となります。\n", "\n", "

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):

" ] }, { "cell_type": "code", "execution_count": 210, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "no symmetry; antisymmetry: (0, 1)\n" ] } ], "source": [ "a.symmetries()" ] }, { "cell_type": "code", "execution_count": 211, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "no symmetry; antisymmetry: (1, 2)\n" ] } ], "source": [ "b.symmetries()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "標準的な **テンソル 計算** は実装済みです。\n", "\n", "

Standard tensor arithmetics is implemented:

" ] }, { "cell_type": "code", "execution_count": 212, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "s = - t + 2*f* b ; print(s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**テンソルの縮約 **は `trace()`メソッドおよび `contract()` メソッドで取り扱われます。例として、テンソル $T$の最初の二つの引数(位置 0 および 1) について縮約してみましょう。つまり、$c_i = T^k_{\\ \\, k i}$で与えられるテンソル $c$を構築してみましょう。\n", "\n", "

Tensor contractions are dealt with by the methods trace() and contract(): for instance, let us contract the tensor $T$ w.r.t. its first two arguments (positions 0 and 1), i.e. let us form the tensor $c$ of components $c_i = T^k_{\\ \\, k i}$:

" ] }, { "cell_type": "code", "execution_count": 213, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "c = t.trace(0,1)\n", "print(c)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`trace(0,1)`と入力する代わりに、**指標表記** を使って縮約を指定できます。指標は文字列として`[]`演算子の中に記述されます。\n", "文字列中で、\"^\" は反変指標の前、\"_\" は共変指標の前、に置かれます。\n", "\n", "

An alternative to the writing trace(0,1) is to use the index notation to denote the contraction: the indices are given in a string inside the [] operator, with '^' in front of the contravariant indices and '_' in front of the covariant ones:

" ] }, { "cell_type": "code", "execution_count": 214, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 214, "metadata": {}, "output_type": "execute_result" } ], "source": [ "c1 = t['^k_ki']\n", "print(c1)\n", "c1 == c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "縮約は繰り返された指標(ここでは $k$ です)について実行されます。それ以外の文字(ここでは $i$ )は任意です。\n", "\n", "

The contraction is performed on the repeated index (here k); the letter denoting the remaining index (here i) is arbitrary:

" ] }, { "cell_type": "code", "execution_count": 215, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 215, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['^k_kj'] == c" ] }, { "cell_type": "code", "execution_count": 216, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 216, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['^b_ba'] == c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "縮約されない指標については \".\"(ドット)で置き換え可能です。\n", "\n", "

It can even be replaced by a dot:

" ] }, { "cell_type": "code", "execution_count": 217, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 217, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['^k_k.'] == c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "この文字列中ではLaTeX式の指定も可能です。\n", "\n", "

LaTeX notations are allowed:

" ] }, { "cell_type": "code", "execution_count": 218, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 218, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['^{k}_{ki}'] == c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "テンソル場 $T$ とベクトル場 $v$ の縮約 $T^i_{\\ j k} v^k$ は次のようにして、実行されます。ここで、2は$T$の最後の指標の場所、0は$v$の唯一の指標の場所です。\n", "\n", "

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):

" ] }, { "cell_type": "code", "execution_count": 219, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (1,1) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "tv = t.contract(2, v, 0)\n", "print(tv)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2はTの最後の指標の場所、0は$v$の唯一の指標の場所ですので、上記の表記の簡略版は次のようになります。\n", "\n", "

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

" ] }, { "cell_type": "code", "execution_count": 220, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (1,1) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "tv1 = t.contract(v)\n", "print(tv1)" ] }, { "cell_type": "code", "execution_count": 221, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 221, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tv1 == tv" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`contract()` メソッドに替わって、**指標表記** と 直積演算子 `*` を組み合わせることで、縮約を表現できます。\n", "\n", "

Instead of contract(), the index notation, combined with the * operator, can be used to denote the contraction:

" ] }, { "cell_type": "code", "execution_count": 222, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 222, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['^i_jk']*v['^k'] == tv" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "繰り替えされない指標については、`.`で置き換えることができます。\n", "\n", "

The non-repeated indices can be replaced by dots:

" ] }, { "cell_type": "code", "execution_count": 223, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 223, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t['^._.k']*v['^k'] == tv" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 計量構造: Metric structures\n", "多様体$\\mathcal{M}$の**Riemann 計量** はつぎのように宣言されます。\n", "\n", "

A Riemannian metric on the manifold $\\mathcal{M}$ is declared as follows:

" ] }, { "cell_type": "code", "execution_count": 224, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Riemannian metric g on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "g = M.riemannian_metric('g')\n", "print(g)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "計量 $g$ は対称な (0,2) 型のテンソル場です。\n", "\n", "

It is a symmetric tensor field of type (0,2):

" ] }, { "cell_type": "code", "execution_count": 225, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Free module T^(0,2)(M) of type-(0,2) tensors fields on the 3-dimensional differentiable manifold M" ] }, "execution_count": 225, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.parent()" ] }, { "cell_type": "code", "execution_count": 226, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Free module T^(0,2)(M) of type-(0,2) tensors fields on the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(g.parent())" ] }, { "cell_type": "code", "execution_count": 227, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "symmetry: (0, 1); no antisymmetry\n" ] } ], "source": [ "g.symmetries()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "計量は、あるベクトルフレームに関する要素で初期化されます。例えば、\n", "$\\mathcal{M}$の既定のフレームを使って、\n", "

The metric is initialized by its components with respect to some vector frame. For instance, using the default frame of $\\mathcal{M}$:

" ] }, { "cell_type": "code", "execution_count": 228, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g = dx*dx + dy*dy + dz*dz" ] }, "execution_count": 228, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g[1,1], g[2,2], g[3,3] = 1, 1, 1\n", "g.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "別のベクトルフレームに関する成分を表示します。\n", "

The components w.r.t. another vector frame are obtained as for any tensor field:

" ] }, { "cell_type": "code", "execution_count": 229, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g = dr*dr + r^2 dth*dth + r^2*sin(th)^2 dph*dph" ] }, "execution_count": 229, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.display(Y.frame(), Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "もちろん計量は二つのベクトルに作用します。\n", "\n", "

Of course, the metric acts on vector pairs:

" ] }, { "cell_type": "code", "execution_count": 230, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field g(u,v) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "g(u,v): U --> R\n", " (x, y, z) |--> x*y*z*u_z(x, y, z) + y*u_x(x, y, z) - x*u_y(x, y, z) + u_x(x, y, z)\n", " (r, th, ph) |--> r^3*cos(ph)*cos(th)*sin(ph)*sin(th)^2*u_z(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th)) - r*cos(ph)*sin(th)*u_y(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th)) + (r*sin(ph)*sin(th) + 1)*u_x(r*cos(ph)*sin(th), r*sin(ph)*sin(th), r*cos(th))" ] }, "execution_count": 230, "metadata": {}, "output_type": "execute_result" } ], "source": [ "u.display() ; v.display(); print(g(u,v)) ; g(u,v).display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "計量 $g$に付随する **Levi-Civita 接続**は、:\n", "\n", "

The Levi-Civita connection associated to the metric $g$:

" ] }, { "cell_type": "code", "execution_count": 231, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Levi-Civita connection nabla_g associated with the Riemannian metric g on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Levi-Civita connection nabla_g associated with the Riemannian metric g on the 3-dimensional differentiable manifold M" ] }, "execution_count": 231, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nabla = g.connection() \n", "print(nabla) ; nabla" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "多様体の既定の座標をつかってChristoffel記号を書き出します。\n", "\n", "

The Christoffel symbols with respect to the manifold's default coordinates:

" ] }, { "cell_type": "code", "execution_count": 232, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[[[0, 0, 0], [0, 0, 0], [0, 0, 0]],\n", " [[0, 0, 0], [0, 0, 0], [0, 0, 0]],\n", " [[0, 0, 0], [0, 0, 0], [0, 0, 0]]]" ] }, "execution_count": 232, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nabla.coef()[:]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "次に、座標$(r,\\theta,\\phi)$を使って、Christoffel記号を書き出します。\n", "\n", "

The Christoffel symbols with respect to the coordinates $(r,\\theta,\\phi)$:

" ] }, { "cell_type": "code", "execution_count": 233, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[[[0, 0, 0], [0, -r, 0], [0, 0, -r*sin(th)^2]],\n", " [[0, 1/r, 0], [1/r, 0, 0], [0, 0, -cos(th)*sin(th)]],\n", " [[0, 0, 1/r], [0, 0, cos(th)/sin(th)], [1/r, cos(th)/sin(th), 0]]]" ] }, "execution_count": 233, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nabla.coef(Y.frame())[:, Y]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`display()` を使って、見易く表示させて見ます。既定の設定では非零の接続係数のみが表示されます。\n", "\n", "A nice view is obtained via the method `display()` (by default, only the nonzero connection coefficients are shown):" ] }, { "cell_type": "code", "execution_count": 234, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Gam^r_th,th = -r \n", "Gam^r_ph,ph = -r*sin(th)^2 \n", "Gam^th_r,th = 1/r \n", "Gam^th_th,r = 1/r \n", "Gam^th_ph,ph = -cos(th)*sin(th) \n", "Gam^ph_r,ph = 1/r \n", "Gam^ph_th,ph = cos(th)/sin(th) \n", "Gam^ph_ph,r = 1/r \n", "Gam^ph_ph,th = cos(th)/sin(th) " ] }, "execution_count": 234, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nabla.display(frame=Y.frame(), chart=Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "計量の`christoffel_symbols_display()`メソッドを使うこともできます。この関数は(既定の設定では)独立なChristoffel記号だけを表示します。\n", "\n", "One may also use the method `christoffel_symbols_display()` of the metric, which (by default) displays only the non-redundant Christoffel symbols:" ] }, { "cell_type": "code", "execution_count": 235, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Gam^r_th,th = -r \n", "Gam^r_ph,ph = -r*sin(th)^2 \n", "Gam^th_r,th = 1/r \n", "Gam^th_ph,ph = -cos(th)*sin(th) \n", "Gam^ph_r,ph = 1/r \n", "Gam^ph_th,ph = cos(th)/sin(th) " ] }, "execution_count": 235, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.christoffel_symbols_display(Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "接続の共変微分に対する作用。\n", "\n", "

The connection acting as a covariant derivative:

" ] }, { "cell_type": "code", "execution_count": 236, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field nabla_g(v) of type (1,1) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "nabla_g(v) = d/dx*dy - d/dy*dx + y*z d/dz*dx + x*z d/dz*dy + x*y d/dz*dz" ] }, "execution_count": 236, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nab_v = nabla(v)\n", "print(nab_v) ; nab_v.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Levi-Civita 接続係数として, $\\nabla_g$ には捩れ(torsion)がありません。\n", "\n", "

Being a Levi-Civita connection, $\\nabla_g$ is torsion.free:

" ] }, { "cell_type": "code", "execution_count": 237, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (1,2) on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "0" ] }, "execution_count": 237, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(nabla.torsion()) ; nabla.torsion().display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "この例ではさらに、多様体は平坦(フラット, 曲率が0)です。\n", "\n", "

In the present case, it is also flat:

" ] }, { "cell_type": "code", "execution_count": 238, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field Riem(g) of type (1,3) on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Riem(g) = 0" ] }, "execution_count": 238, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(nabla.riemann()) ; nabla.riemann().display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$g_{rr}$ to $1/(1+r^2)$と変更することで、曲率のある空間を考えましょう。\n", "\n", "

Let us consider a non-flat metric, by changing $g_{rr}$ to $1/(1+r^2)$:

" ] }, { "cell_type": "code", "execution_count": 239, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g = 1/(r^2 + 1) dr*dr + r^2 dth*dth + r^2*sin(th)^2 dph*dph" ] }, "execution_count": 239, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g[Y.frame(), 1,1, Y] = 1/(1+r^2)\n", "g.display(Y.frame(), Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "簡単の為に、副多様体$U$の既定の座標系をY=$(U,(r,\\theta,\\phi))$に変更します。\n", "\n", "

For convenience, we change the default chart on the domain $U$ to Y=$(U,(r,\\theta,\\phi))$:

" ] }, { "cell_type": "code", "execution_count": 240, "metadata": {}, "outputs": [], "source": [ "U.set_default_chart(Y)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "これによって、 $(r,\\theta,\\phi)$を使った座標表現を求める際に座標系 $Y$ を指定する必要がありません。\n", "\n", "

In this way, we do not have to specify Y when asking for coordinate expressions in terms of $(r,\\theta,\\phi)$:

" ] }, { "cell_type": "code", "execution_count": 241, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g = 1/(r^2 + 1) dr*dr + r^2 dth*dth + r^2*sin(th)^2 dph*dph" ] }, "execution_count": 241, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.display(Y.frame())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "この計量は双曲空間 $\\mathbb{H}^3$の計量だと気がつきます。座標系 $(U,(x,y,z))$についての表現は、次のようになります。\n", "\n", "

We recognize the metric of the hyperbolic space $\\mathbb{H}^3$. Its expression in terms of the chart $(U,(x,y,z))$ is

" ] }, { "cell_type": "code", "execution_count": 242, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g = (y^2 + z^2 + 1)/(x^2 + y^2 + z^2 + 1) dx*dx - x*y/(x^2 + y^2 + z^2 + 1) dx*dy - x*z/(x^2 + y^2 + z^2 + 1) dx*dz - x*y/(x^2 + y^2 + z^2 + 1) dy*dx + (x^2 + z^2 + 1)/(x^2 + y^2 + z^2 + 1) dy*dy - y*z/(x^2 + y^2 + z^2 + 1) dy*dz - x*z/(x^2 + y^2 + z^2 + 1) dz*dx - y*z/(x^2 + y^2 + z^2 + 1) dz*dy + (x^2 + y^2 + 1)/(x^2 + y^2 + z^2 + 1) dz*dz" ] }, "execution_count": 242, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.display(X_U.frame(), X_U)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "要素の行列表示の方がより適切かもしれません。\n", "\n", "

A matrix view of the components may be more appropriate:

" ] }, { "cell_type": "code", "execution_count": 243, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "[(y^2 + z^2 + 1)/(x^2 + y^2 + z^2 + 1) -x*y/(x^2 + y^2 + z^2 + 1) -x*z/(x^2 + y^2 + z^2 + 1)]\n", "[ -x*y/(x^2 + y^2 + z^2 + 1) (x^2 + z^2 + 1)/(x^2 + y^2 + z^2 + 1) -y*z/(x^2 + y^2 + z^2 + 1)]\n", "[ -x*z/(x^2 + y^2 + z^2 + 1) -y*z/(x^2 + y^2 + z^2 + 1) (x^2 + y^2 + 1)/(x^2 + y^2 + z^2 + 1)]" ] }, "execution_count": 243, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g[X_U.frame(), :, X_U]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "もともとは $U$でのみ定義されていたこれらの成分を、全体の多様体$\\mathcal{M}$までに拡張します。拡張は、座標系 X=$(\\mathcal{M},(x,y,z))$ に付随するフレームでの座標表現が同じであることを要求して実行されます。\n", "\n", "

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))$:

" ] }, { "cell_type": "code", "execution_count": 244, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "g = (y^2 + z^2 + 1)/(x^2 + y^2 + z^2 + 1) dx*dx - x*y/(x^2 + y^2 + z^2 + 1) dx*dy - x*z/(x^2 + y^2 + z^2 + 1) dx*dz - x*y/(x^2 + y^2 + z^2 + 1) dy*dx + (x^2 + z^2 + 1)/(x^2 + y^2 + z^2 + 1) dy*dy - y*z/(x^2 + y^2 + z^2 + 1) dy*dz - x*z/(x^2 + y^2 + z^2 + 1) dz*dx - y*z/(x^2 + y^2 + z^2 + 1) dz*dy + (x^2 + y^2 + 1)/(x^2 + y^2 + z^2 + 1) dz*dz" ] }, "execution_count": 244, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.add_comp_by_continuation(X.frame(), U, X)\n", "g.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Levi-Civita接続は、計量 $g$の変更後、自動的に再計算されます。\n", "\n", "

The Levi-Civita connection is automatically recomputed, after the change in $g$:

" ] }, { "cell_type": "code", "execution_count": 245, "metadata": {}, "outputs": [], "source": [ "nabla = g.connection()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "とくに、Christoffel 係数は、異なっています。\n", "

In particular, the Christoffel symbols are different:

" ] }, { "cell_type": "code", "execution_count": 246, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Gam^x_xx = -(x*y^2 + x*z^2 + x)/(x^2 + y^2 + z^2 + 1) \n", "Gam^x_xy = x^2*y/(x^2 + y^2 + z^2 + 1) \n", "Gam^x_xz = x^2*z/(x^2 + y^2 + z^2 + 1) \n", "Gam^x_yy = -(x^3 + x*z^2 + x)/(x^2 + y^2 + z^2 + 1) \n", "Gam^x_yz = x*y*z/(x^2 + y^2 + z^2 + 1) \n", "Gam^x_zz = -(x^3 + x*y^2 + x)/(x^2 + y^2 + z^2 + 1) \n", "Gam^y_xx = -(y^3 + y*z^2 + y)/(x^2 + y^2 + z^2 + 1) \n", "Gam^y_xy = x*y^2/(x^2 + y^2 + z^2 + 1) \n", "Gam^y_xz = x*y*z/(x^2 + y^2 + z^2 + 1) \n", "Gam^y_yy = -(y*z^2 + (x^2 + 1)*y)/(x^2 + y^2 + z^2 + 1) \n", "Gam^y_yz = y^2*z/(x^2 + y^2 + z^2 + 1) \n", "Gam^y_zz = -(y^3 + (x^2 + 1)*y)/(x^2 + y^2 + z^2 + 1) \n", "Gam^z_xx = -(z^3 + (y^2 + 1)*z)/(x^2 + y^2 + z^2 + 1) \n", "Gam^z_xy = x*y*z/(x^2 + y^2 + z^2 + 1) \n", "Gam^z_xz = x*z^2/(x^2 + y^2 + z^2 + 1) \n", "Gam^z_yy = -(z^3 + (x^2 + 1)*z)/(x^2 + y^2 + z^2 + 1) \n", "Gam^z_yz = y*z^2/(x^2 + y^2 + z^2 + 1) \n", "Gam^z_zz = -(x^2 + y^2 + 1)*z/(x^2 + y^2 + z^2 + 1) " ] }, "execution_count": 246, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nabla.display(only_nonredundant=True)" ] }, { "cell_type": "code", "execution_count": 247, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "Gam^r_r,r = -r/(r^2 + 1) \n", "Gam^r_th,th = -r^3 - r \n", "Gam^r_ph,ph = -(r^3 + r)*sin(th)^2 \n", "Gam^th_r,th = 1/r \n", "Gam^th_ph,ph = -cos(th)*sin(th) \n", "Gam^ph_r,ph = 1/r \n", "Gam^ph_th,ph = cos(th)/sin(th) " ] }, "execution_count": 247, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nabla.display(frame=Y.frame(), chart=Y, only_nonredundant=True)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Rimannテンソルは、今や:\n", "

The Riemann tensor is now

" ] }, { "cell_type": "code", "execution_count": 248, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field Riem(g) of type (1,3) on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Riem(g) = -r^2 d/dr*dth*dr*dth + r^2 d/dr*dth*dth*dr - r^2*sin(th)^2 d/dr*dph*dr*dph + r^2*sin(th)^2 d/dr*dph*dph*dr + 1/(r^2 + 1) d/dth*dr*dr*dth - 1/(r^2 + 1) d/dth*dr*dth*dr - r^2*sin(th)^2 d/dth*dph*dth*dph + r^2*sin(th)^2 d/dth*dph*dph*dth + 1/(r^2 + 1) d/dph*dr*dr*dph - 1/(r^2 + 1) d/dph*dr*dph*dr + r^2 d/dph*dth*dth*dph - r^2 d/dph*dth*dph*dth" ] }, "execution_count": 248, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Riem = nabla.riemann()\n", "print(Riem) ; Riem.display(Y.frame())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "リーマンテンソルは接続などを明示的に求めることなく、計量$g$から直接算出できます。\n", "\n", "

Note that it can be accessed directely via the metric, without any explicit mention of the connection:

" ] }, { "cell_type": "code", "execution_count": 249, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 249, "metadata": {}, "output_type": "execute_result" } ], "source": [ "g.riemann() is nabla.riemann()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Ricci テンソル** はこのようになります。\n", "\n", "

The Ricci tensor is

" ] }, { "cell_type": "code", "execution_count": 250, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Field of symmetric bilinear forms Ric(g) on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "Ric(g) = -2/(r^2 + 1) dr*dr - 2*r^2 dth*dth - 2*r^2*sin(th)^2 dph*dph" ] }, "execution_count": 250, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Ric = g.ricci()\n", "print(Ric) ; Ric.display(Y.frame())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Weyl テンソル** は:\n", "

The Weyl tensor is:

" ] }, { "cell_type": "code", "execution_count": 251, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field C(g) of type (1,3) on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "C(g) = 0" ] }, "execution_count": 251, "metadata": {}, "output_type": "execute_result" } ], "source": [ "C = g.weyl()\n", "print(C) ; C.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "多様体 $\\mathcal{M}$ の次元が 3 なので、**Weyl テンソル** は恒等的に0になります。\n", "最後に **Ricci スカラ(曲率)** を求めます。\n", "\n", "

The Weyl tensor vanishes identically because the dimension of $\\mathcal{M}$ is 3.

\n", "

Finally, the Ricci scalar is

" ] }, { "cell_type": "code", "execution_count": 252, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field r(g) on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "r(g): M --> R\n", " (x, y, z) |--> -6\n", "on U: (r, th, ph) |--> -6" ] }, "execution_count": 252, "metadata": {}, "output_type": "execute_result" } ], "source": [ "R = g.ricci_scalar()\n", "print(R) ; R.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "

We recover the fact that $\\mathbb{H}^3$ is a Riemannian manifold of constant negative curvature.

\n", "\n", "## 計量によって引き起こされるテンソル場の変形:Tensor transformations induced by a metric\n", "\n", "もっとも重要な軽量 $g$によって引き起こされるテンソル場の変形は、**musical isomorphism** あるいは **指標の引き上げ** および **指標の引き下げ**と呼ばれるものです。\n", "\n", "

The most important tensor transformation induced by the metric $g$ is the so-called musical isomorphism, or index raising and index lowering:

" ] }, { "cell_type": "code", "execution_count": 253, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field T of type (1,2) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(t)" ] }, { "cell_type": "code", "execution_count": 254, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "T = (r^2*cos(ph)^2*sin(th)^2 + 1) d/dx*dy*dx + r^3*cos(ph)*cos(th)*sin(ph)*sin(th)^2 d/dz*dy*dx" ] }, "execution_count": 254, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t.display()" ] }, { "cell_type": "code", "execution_count": 255, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "T = (x^2 + 1) d/dx*dy*dx + x*y*z d/dz*dy*dx" ] }, "execution_count": 255, "metadata": {}, "output_type": "execute_result" } ], "source": [ "t.display(X_U.frame(), X_U)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "テンソル場 $T$の最後の指標を計量 $g$ について、引き上げます。\n", "\n", "

Raising the last index of $T$ with $g$:

" ] }, { "cell_type": "code", "execution_count": 256, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (2,1) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "s = t.up(g, 2)\n", "print(s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "$T$の全ての共変な指標(この例では 位置 1と2)を引き上げます。\n", "\n", "

Raising all the covariant indices of $T$ (i.e. those at the positions 1 and 2):

" ] }, { "cell_type": "code", "execution_count": 257, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (3,0) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "s = t.up(g)\n", "print(s)" ] }, { "cell_type": "code", "execution_count": 258, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Tensor field of type (0,3) on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "s = t.down(g)\n", "print(s)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Hodge双対(星印演算子) :Hodge duality\n", "計量 $g$についての体積 3-形式(Levi-Civita テンソル )は\n", "\n", "

The volume 3-form (Levi-Civita tensor) associated with the metric $g$ is

" ] }, { "cell_type": "code", "execution_count": 259, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3-form eps_g on the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "eps_g = 1/sqrt(x^2 + y^2 + z^2 + 1) dx/\\dy/\\dz" ] }, "execution_count": 259, "metadata": {}, "output_type": "execute_result" } ], "source": [ "epsilon = g.volume_form()\n", "print(epsilon) ; epsilon.display()" ] }, { "cell_type": "code", "execution_count": 260, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "eps_g = r^2*sin(th)/sqrt(r^2 + 1) dr/\\dth/\\dph" ] }, "execution_count": 260, "metadata": {}, "output_type": "execute_result" } ], "source": [ "epsilon.display(Y.frame())" ] }, { "cell_type": "code", "execution_count": 261, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field f on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "f: U --> R\n", " (x, y, z) |--> z^3 + y^2 + x\n", " (r, th, ph) |--> r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th)" ] }, "execution_count": 261, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(f) ; f.display()" ] }, { "cell_type": "code", "execution_count": 262, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3-form *f on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "*f = (r^3*cos(th)^3 + r^2*sin(ph)^2*sin(th)^2 + r*cos(ph)*sin(th))/sqrt(r^2 + 1) dx/\\dy/\\dz" ] }, "execution_count": 262, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sf = f.hodge_dual(g)\n", "print(sf) ; sf.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "古典的な式$\\star f = f\\, \\epsilon_g$, より正確には$\\star f = f\\, \\epsilon_g|_U$を確かめてみましょう。\n", "$f$ は $U$ 上でのみ定義されていることに注意します。\n", "\n", "

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):

" ] }, { "cell_type": "code", "execution_count": 263, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 263, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sf == f * epsilon.restrict(U)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1-形式のHodge 双対は、2ー形式 です。(3次元多様体の場合);\n", "The Hodge dual of a 1-form is a 2-form:

" ] }, { "cell_type": "code", "execution_count": 264, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form omega on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "omega = r^2*sin(th)^2 dx + r*cos(th) dy + (r*cos(ph)*sin(th) - r*cos(th)) dz" ] }, "execution_count": 264, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(om) ; om.display()" ] }, { "cell_type": "code", "execution_count": 265, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2-form *omega on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "*omega = (r^4*cos(ph)*cos(th)*sin(th)^3 - r^3*cos(th)^3 - r*cos(th) + (r^3*(cos(ph) + sin(ph))*cos(th)^2 + r*cos(ph))*sin(th))/sqrt(r^2 + 1) dx/\\dy - (r^4*cos(ph)*sin(ph)*sin(th)^4 - r^3*cos(th)^2*sin(ph)*sin(th) + (cos(ph)*sin(ph) + sin(ph)^2)*r^3*cos(th)*sin(th)^2 + r*cos(th))/sqrt(r^2 + 1) dx/\\dz + (r^4*cos(ph)^2*sin(th)^4 - r^3*cos(ph)*cos(th)^2*sin(th) + ((cos(ph)^2 + cos(ph)*sin(ph))*r^3*cos(th) + r^2)*sin(th)^2)/sqrt(r^2 + 1) dy/\\dz" ] }, "execution_count": 265, "metadata": {}, "output_type": "execute_result" } ], "source": [ "som = om.hodge_dual(g)\n", "print(som) ; som.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "(3次元多様体上では)2ー形式のhodge 双対は 1ー形式になります。\n", "\n", "

The Hodge dual of a 2-form is a 1-form:

" ] }, { "cell_type": "code", "execution_count": 266, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2-form A on the Open subset U of the 3-dimensional differentiable manifold M\n" ] } ], "source": [ "print(a)" ] }, { "cell_type": "code", "execution_count": 267, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1-form *A on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "*A = (3*r^5*cos(th)^5 + 3*r^3*cos(th)^3 + (3*r^6*cos(ph)*cos(th)^2*sin(ph) - 2*r^5*cos(ph)*cos(th)*sin(ph) - 2*r^4*cos(ph)*sin(ph)^3)*sin(th)^4 + (2*r^4*cos(th)*sin(ph)^3 + (sin(ph)^3 - sin(ph))*r^3)*sin(th)^3 + (3*r^5*cos(th)^3*sin(ph)^2 - 2*r^4*cos(ph)*cos(th)^2*sin(ph) + r^3*cos(ph)*cos(th)*sin(ph) - 2*r^2*cos(ph)*sin(ph))*sin(th)^2 + (2*r^4*cos(th)^3*sin(ph) + r^3*cos(ph)*cos(th)^2 + 2*r^2*cos(th)*sin(ph))*sin(th))/sqrt(r^2 + 1) dx - (r^3*cos(th)^3 - (3*(sin(ph)^2 - 1)*r^6*cos(th)^2 - 2*r^5*cos(th)*sin(ph)^2 - 2*(sin(ph)^4 - sin(ph)^2)*r^4)*sin(th)^4 + (2*r^4*cos(ph)*cos(th)*sin(ph)^2 + (cos(ph)*sin(ph)^2 - cos(ph))*r^3)*sin(th)^3 + (3*r^6*cos(th)^4 + 3*r^5*cos(ph)*cos(th)^3*sin(ph) + 3*r^4*cos(th)^2 - (sin(ph)^2 - 1)*r^3*cos(th))*sin(th)^2 + r*cos(th) - (r^3*(cos(ph) + sin(ph))*cos(th)^2 + r*cos(ph))*sin(th))/sqrt(r^2 + 1) dy + (2*r^5*sin(ph)*sin(th)^5 + (3*r^6*cos(th)^3*sin(ph) + 2*r^4*cos(ph)^2*cos(th)*sin(ph) + 2*r^3*sin(ph))*sin(th)^3 - (2*r^4*cos(ph)*cos(th)^2*sin(ph) + (cos(ph)*sin(ph) + 1)*r^3*cos(th))*sin(th)^2 - r*cos(th) - (3*r^5*cos(ph)*cos(th)^4 - r^3*cos(th)^2*sin(ph))*sin(th))/sqrt(r^2 + 1) dz" ] }, "execution_count": 267, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sa = a.hodge_dual(g)\n", "print(sa) ; sa.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "最後に3ー形式のHodge 双対は 0-forms です。\n", "

Finally, the Hodge dual of a 3-form is a 0-form:

" ] }, { "cell_type": "code", "execution_count": 268, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3-form dA on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "dA = (-2*(3*r^3*cos(th)^2*sin(ph) + r*sin(ph))*sin(th) - 1) dx/\\dy/\\dz" ] }, "execution_count": 268, "metadata": {}, "output_type": "execute_result" } ], "source": [ "print(da) ; da.display()" ] }, { "cell_type": "code", "execution_count": 269, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Scalar field *dA on the Open subset U of the 3-dimensional differentiable manifold M\n" ] }, { "data": { "text/html": [ "" ], "text/plain": [ "*dA: U --> R\n", " (x, y, z) |--> -(6*y*z^2 + 2*y + 1)*sqrt(x^2 + y^2 + z^2 + 1)\n", " (r, th, ph) |--> -sqrt(r^2 + 1)*(2*(3*r^3*cos(th)^2*sin(ph) + r*sin(ph))*sin(th) + 1)" ] }, "execution_count": 269, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sda = da.hodge_dual(g)\n", "print(sda) ; sda.display()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "3次元のリーマン計量に対して、Hodge 双対はidempotent、つまり2回続けて作用させると元に戻ります。\n", "\n", "

In dimension 3 and for a Riemannian metric, the Hodge star is idempotent:

" ] }, { "cell_type": "code", "execution_count": 270, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 270, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sf.hodge_dual(g) == f" ] }, { "cell_type": "code", "execution_count": 271, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 271, "metadata": {}, "output_type": "execute_result" } ], "source": [ "som.hodge_dual(g) == om" ] }, { "cell_type": "code", "execution_count": 272, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 272, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sa.hodge_dual(g) == a" ] }, { "cell_type": "code", "execution_count": 273, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "True" ] }, "execution_count": 273, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sda.hodge_dual(g) == da" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 助けを求める:Getting help\n", "\n", "オブジェクトが呼び出すことのできる関数(メソッドを入手するには、オブジェクトの名前を入力したのち、\".\"とTABを入力します。\n", "つまり、`sa.`です。\n", "\n", "オブジェクトやメソッドについての情報を入手するために、疑問符 `?`をお使いください。\n", "\n", "

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.

\n", "

sa.

\n", "

To get information on an object or a method, use the question mark:

" ] }, { "cell_type": "code", "execution_count": 274, "metadata": {}, "outputs": [], "source": [ "nabla?" ] }, { "cell_type": "code", "execution_count": 275, "metadata": {}, "outputs": [], "source": [ "g.ricci_scalar?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "二つの疑問符 `??` はPythonソースコードに直接導かれます。SageMathはオープンソースです、そうでしょう?\n", "\n", "

Using a double question mark leads directly to the Python source code (SageMath is open source, isn't it?)

" ] }, { "cell_type": "code", "execution_count": 276, "metadata": {}, "outputs": [], "source": [ "g.ricci_scalar??" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## さらに先へ:Going further\n", "\n", "examples on SageManifolds pageをご覧ください。とくに、平行化不能な多様体(スカラー場は少なくとも二つの座標系で定義される必要があり、モジュール \n", "$\\mathfrak{X}(\\mathcal{M})$\n", "はもはやフリーではなく、テンソル場は少なくとも二つのフレームで定義される必要があります)\n", "での使い方については、\n", "2-dimensional sphere example \n", "が役に立つでしょう。\n", "\n", "

Have a look at the examples on SageManifolds page, especially the 2-dimensional sphere example for usage on a non-parallelizable manifold (each scalar field has to be defined in at least two coordinate charts, the module $\\mathfrak{X}(\\mathcal{M})$ is no longer free and each tensor field has to be defined in at least two vector frames).

" ] } ], "metadata": { "kernelspec": { "display_name": "SageMath 8.2", "language": "", "name": "sagemath" }, "language": "python", "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.14" } }, "nbformat": 4, "nbformat_minor": 1 }