Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/sage/SageManifolds/SM_sphere_S2.sagews
Views: 1045
Sphere
This worksheet demonstrates a few capabilities of SageManifolds (version 0.8) on the example of the 2-dimensional sphere.
The whole worksheet file can be downloaded from here.
as a 2-dimensional differentiable manifold
We start by declaring as a differentiable manifold of dimension 2 over :
The first argument, 2, is the dimension of the manifold, while the second argument is the symbol used to label the manifold.
The argument start_index sets the index range to be used on the manifold for labelling components w.r.t. a basis or a frame: start_index=1 corresponds to ; the default value is start_index=0 and yields to .
The manifold is a Sage Parent object:
Coordinate charts on
The sphere cannot be covered by a single chart. At least two charts are necessary, for instance the charts associated with the stereographic projections from the North pole and the South pole respectively. Let us introduce the open subsets covered by these two charts: where is a point of , which we shall call the North pole, and is the point of of stereographic coordinates , which we call the South pole:
We declare that :
Then we declare the stereographic chart on , denoting by the coordinates resulting from the stereographic projection from the North pole:
Similarly, we introduce on the coordinates corresponding to the stereographic projection from the South pole:
At this stage, the user's atlas on the manifold has two charts:
We have to specify the transition map between the charts 'stereoN' = and 'stereoS' = ; it is given by the standard inversion formulas:
In the above declaration, 'W' is the name given to the chart-overlap subset: the condition defines as a subset of , and the condition defines as a subset of .
The inverse coordinate transformation is computed by means of the method inverse():
In the present case, the situation is of course perfectly symmetric regarding the coordinates and .
At this stage, the user's atlas has four charts:
Let us store into a Python variable for future use:
Similarly we store the charts (the restriction of to ) and (the restriction of to ) into Python variables:
We may plot the chart in terms of itself, as a grid:
More interestingly, let us plot the stereographic chart in terms of the stereographic chart on the domain where both systems overlap (we split the plot in four parts to avoid the singularity at ):
Spherical coordinates
The standard spherical (or polar) coordinates are defined on the open domain that is the complement of the "origin meridian"; since the latter is the half-circle defined by and , we declare:
The restriction of the stereographic chart from the North pole to is
We then declare the chart by specifying the intervals and spanned by respectively and :
The specification of the spherical coordinates is completed by providing the transition map with the stereographic chart :
We also provide the inverse transition map:
The check is passed, up to some lack of simplification in the functions atan and atan2.
The user atlas of is now
Let us draw the grid of spherical coordinates in terms of stereographic coordinates from the North pole :
Conversly, we may represent the grid of the stereographic coordinates restricted to in terms of the spherical coordinates . We limit ourselves to one quarter (cf. the argument ranges):
Points on
We declare the North pole (resp. the South pole) as the point of coordinates in the chart (resp. in the chart ):
Since points are Sage Element's, the corresponding (facade) Parent being the manifold subsets, an equivalent writing of the above declarations is
Moreover, since stereoS in the default chart on and stereoN is the default one on , their mentions can be omitted, so that the above can be shortened to
We have of course
Let us introduce some point at the equator:
The point is in the open subset :
We may then ask for its spherical coordinates :
which is not possible for the point :
Mappings between manifolds: the embedding of into
Let us first declare as a 3-dimensional manifold covered by a single chart (the so-called Cartesian coordinates):
The embedding of the sphere is defined as a differential mapping :
maps points of to points of :
has been defined in terms of the stereographic charts and , but we may ask its expression in terms of spherical coordinates. The latter is then computed by means of the transition map :
Let us use to draw the grid of spherical coordinates in terms of the Cartesian coordinates of :
For future use, let us store a version without any label on the axes:
We may also use the embedding to display the stereographic coordinate grid in terms of the Cartesian coordinates in . First for the stereographic coordinates from the North pole:
and then have a view with the stereographic coordinates from the South pole superposed (in green):
We may also add the two poles to the graphic:
Tangent spaces
The tangent space to the manifold at the point is
is a vector space over (represented here by Sage's symbolic ring SR):
Its dimension equals the manifold's dimension:
is endowed with a basis inherited from the coordinate frame defined around , namely the frame associated with the chart :
is the only chart defined so far around the point . If various charts have been defined around a point, then the tangent space at this point is automatically endowed with the bases inherited from the coordinate frames associated to all these charts. For instance, for the equator point :
An element of :
Differential of a smooth mapping
The differential of the mapping at the point is
The image by of the vector introduced above is
Algebra of scalar fields
The set of all smooth functions has naturally the structure of a commutative algebra over . is obtained via the method scalar_field_algebra() applied to the manifold :
Since the algebra internal product is the pointwise multiplication, it is clearly commutative, so that belongs to Sage's category of commutative algebras:
The base ring of the algebra is the field , which is represented here by Sage's Symbolic Ring (SR):
Elements of are of course (smooth) scalar fields:
This example element is the constant scalar field that takes the value 2:
A specific element is the zero one:
Scalar fields map points of to real numbers:
Another specific element is the algebra unit element, i.e. the constant scalar field 1:
Let us define a scalar field by its coordinate expression in the two stereographic charts:
Instead of using CS() (i.e. the Parent __call__ function), we may invoke the scalar_field method on the manifold to create ; this allows to pass the name of the scalar field:
Internally, the various coordinate expressions of the scalar field are stored in the dictionary _express, whose keys are the charts:
The expression in a specific chart is recovered by passing the chart as the argument of the method display():
Scalar fields map the manifold's points to real numbers:
We may define the restrictions of to the open subsets and :
A scalar field on can be coerced to a scalar field on , the coercion being simply the restriction:
The arithmetic of scalar fields:
Module of vector fields
The set of all smooth vector fields on is a module over the algebra (ring) . It is obtained by the method vector_field_module():
is not a free module:
because is not a parallelizable manifold:
On the contrary, the set of smooth vector fields on is a free module:
because is parallelizable:
Due to the introduction of the stereographic coordinates on , a basis has already been defined on the free module , namely the coordinate basis :
Similarly
From the point of view of the open set , eU is also the default vector frame:
It is also the default vector frame on (although not defined on the whole ), for it is the first vector frame defined on an open subset of :
Let us introduce a vector field on :
We extend the definition of to thanks to the above expression:
At this stage, the vector field is defined on the whole manifold ; it has expressions in each of the two frames eU and eV which cover :
According to the hairy ball theorem, has to vanish somewhere. This occurs at the North pole:
is the zero vector of the tangent vector space :
On the contrary, is non-zero at the South pole:
Let us plot the vector field is terms of the stereographic chart , with the South pole superposed:
The vector field appears homogeneous because its components w.r.t. the frame are constant:
On the contrary, once drawn in terms of the stereographic chart , does no longer appears homogeneous:
Finally, a 3D view of the vector field is obtained via the embedding :
Similarly, let us draw the first vector field of the stereographic frame from the North pole, namely :
For the second vector field of the stereographic frame from the North pole, namely , we get
We may superpose the two graphs, to get a 3D view of the frame associated with the stereographic coordinates from the North pole:
A Tachyon view of the same frame:
Vector fields acting on scalar fields
and are both fields defined on the whole sphere (respectively a vector field and a scalar field). By the very definition of a vector field, acts on :
Values of at the North pole, at the equator point and at the South pole:
1-forms
A 1-form on is a field of linear forms on the tangent spaces. For instance it can the differential of a scalar field:
The 1-form acting on a vector field:
Let us check the identity :
Similarly, we have :
Curves in
In order to define curves in , we first introduce the field of real numbers as a 1-dimensional smooth manifold with a canonical coordinate chart:
Let us define a loxodrome of the sphere in terms of its parametric equation with respect to the chart spher =
Curves in are considered as morphisms from the manifold to the manifold :
The curve can be plotted in terms of stereographic coordinates :
We recover the well-known fact that the graph of a loxodrome in terms of stereographic coordinates is a logarithmic spiral.
Thanks to the embedding , we may also plot in terms of the Cartesian coordinates of :
The tangent vector field (or velocity vector) to the curve is
is a vector field along taking its values in tangent spaces to :
The set of vector fields along taking their values on via the differential mapping is denoted by ; it is a module over the algebra :
A coordinate view of :
Let us plot the vector field in terms of the stereographic chart :
A 3D view of is obtained via the embedding :
Riemannian metric on
The standard metric on is that induced by the Euclidean metric of . Let us start by defining the latter:
The metric on is the pullback of associated with the embedding :
Note that we could have defined intrinsically, i.e. by providing its components in the two frames stereoN and stereoS, as we did for the metric on . Instead, we have chosen to get it as the pullback of , as an example of pullback associated with some differential map.
The metric is a symmetric tensor field of type (0,2):
The expression of the metric in terms of the default frame on (stereoN):
We may factorize the metric components:
A matrix view of the components of in the manifold's default frame:
Display in terms of the vector frame :
The metric acts on vector field pairs, resulting in a scalar field:
The Levi-Civitation connection associated with the metric :
As a test, we verify that acting on results in zero:
The nonzero Christoffel symbols of (skipping those that can be deduced by symmetry on the last two indices) w.r.t. two charts:
acting on the vector field :
Curvature
The Riemann tensor associated with the metric :
The components of the Riemann tensor in the default frame on :
The components in the frame associated with spherical coordinates:
The Riemann tensor associated with the Euclidean metric on :
The Ricci tensor and the Ricci scalar:
Hence we recover the fact that is a Riemannian manifold of constant positive curvature.
In dimension 2, the Riemann curvature tensor is entirely determined by the Ricci scalar according to
Let us check this formula here, under the form :
Similarly the relation must hold:
The Levi-Civita tensor associated with :
The exterior derivative of the 2-form :
Of course, since has dimension 2, all 3-forms vanish identically:
Non-holonomic frames
Up to know, all the vector frames introduced on have been coordinate frames. Let us introduce a non-coordinate frame on the open subset . To ease the notations, we change first the default chart and default frame on to the spherical coordinate ones:
We define the new frame by relating it the coordinate frame via a field of tangent-space automorphisms:
The new frame is an orthonormal frame for the metric :
It is non-holonomic: its structure coefficients are not identically zero:
while we have of course