{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Sage多様体演習 Manifold tutorial\n", "\n", "このワークシートはSageMathにおける微分可能多様体の取り扱いについての簡単な紹介です。以下で紹介するツールは[SageManifolds](https://sagemanifolds.obspm.fr) プロジェクト (version 1.3, included in SageMath 8.3).を通じて実装されました。\n", "ipnyb形式のワークシートファイルは[ここ](https://raw.githubusercontent.com/sagemanifolds/SageManifolds/master/Worksheets/v1.3/SM_tutorial-J.ipynb) からダウンロード可能です。このワークシートを実行するには、コマンド`sage -n jupyter`などを使ってSageMathのJupyterノートブックインタフェースを起動する必要があります。\n", "[訳注:この日本語版翻訳は山本 昇によって作成されました。翻訳者へのご連絡は、https://souran.kek.jp/kss/top/ を経由して、 職員情報詳細ページ内の「メール送信」リンクをご利用ください。この翻訳版作成にあたり、東海大学理学部北林さんには貴重なコメントをいただきました。この場を借りてお礼申しあげます。]\n", "\n", "This notebook provides a short introduction to differentiable manifolds in SageMath. The tools described below have been implemented through the\n", "[SageManifolds](https://sagemanifolds.obspm.fr) project (version 1.3, included in SageMath 8.3).\n", "\n", "Click [here](https://raw.githubusercontent.com/sagemanifolds/SageManifolds/master/Worksheets/v1.3/SM_tutorial-J.ipynb) to download the notebook 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.]\n", "\n", "このワークシートは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.3, Release Date: 2018-08-03'" ] }, "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))" ] },