Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge #30473
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jul 7, 2021
2 parents 63c2cfe + f2ae50e commit 55240bb
Show file tree
Hide file tree
Showing 81 changed files with 2,791 additions and 2,654 deletions.
1 change: 1 addition & 0 deletions src/doc/en/reference/misc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Formatted Output
sage/typeset/character_art_factory
sage/typeset/ascii_art
sage/typeset/unicode_art
sage/typeset/unicode_characters
sage/misc/repr
sage/misc/sage_input
sage/misc/table
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ while there are five vector frames defined on `\mathbb{E}^3`::

sage: E.frames()
[Coordinate frame (E^3, (e_x,e_y,e_z)),
Coordinate frame (E^3, (d/dr,d/dth,d/dph)),
Coordinate frame (E^3, (∂/∂r,∂/∂th,∂/∂ph)),
Vector frame (E^3, (e_r,e_th,e_ph)),
Coordinate frame (E^3, (d/drh,d/dph,d/dz)),
Coordinate frame (E^3, (∂/∂rh,∂/∂ph,∂/∂z)),
Vector frame (E^3, (e_rh,e_ph,e_z))]

Indeed, there are two frames associated with each of the three coordinate
Expand All @@ -85,9 +85,9 @@ On the other side, the coordinate frames `\left(\frac{\partial}{\partial r},
coordinate charts::

sage: spherical.frame()
Coordinate frame (E^3, (d/dr,d/dth,d/dph))
Coordinate frame (E^3, (∂/∂r,∂/∂th,∂/∂ph))
sage: cylindrical.frame()
Coordinate frame (E^3, (d/drh,d/dph,d/dz))
Coordinate frame (E^3, (∂/∂rh,∂/∂ph,∂/∂z))


Charts as maps `\mathbb{E}^3 \rightarrow \mathbb{R}^3`
Expand Down Expand Up @@ -128,7 +128,7 @@ The default metric tensor of `\mathbb{E}^3` is::
sage: g
Riemannian metric g on the Euclidean space E^3
sage: g.display()
g = dx*dx + dy*dy + dz*dz
g = dxdx + dydy + dzdz
sage: g[:]
[1 0 0]
[0 1 0]
Expand All @@ -139,7 +139,7 @@ Cartesian one. Of course, we may ask for display with respect to other
frames::

sage: g.display(spherical_frame)
g = e^r*e^r + e^th*e^th + e^ph*e^ph
g = e^re^r + e^the^th + e^phe^ph
sage: g[spherical_frame, :]
[1 0 0]
[0 1 0]
Expand All @@ -159,20 +159,20 @@ contrary, in the coordinate frame
which is not orthonormal, some components differ from 0 or 1::

sage: g.display(spherical.frame())
g = dr*dr + (x^2 + y^2 + z^2) dth*dth + (x^2 + y^2) dph*dph
g = drdr + (x^2 + y^2 + z^2) dthdth + (x^2 + y^2) dphdph

Note that the components are expressed in terms of the default chart, namely
the Cartesian one. To have them displayed in terms of the spherical chart, we
have to provide the latter as the second argument of the method
``display()``::

sage: g.display(spherical.frame(), spherical)
g = dr*dr + r^2 dth*dth + r^2*sin(th)^2 dph*dph
g = drdr + r^2 dthdth + r^2*sin(th)^2 dphdph

Since SageMath 8.8, a shortcut is::

sage: g.display(spherical)
g = dr*dr + r^2 dth*dth + r^2*sin(th)^2 dph*dph
g = drdr + r^2 dthdth + r^2*sin(th)^2 dphdph

The matrix view of the components is obtained via the square bracket operator::

Expand All @@ -184,9 +184,9 @@ The matrix view of the components is obtained via the square bracket operator::
Similarly, for cylindrical coordinates, we have::

sage: g.display(cylindrical_frame)
g = e^rh*e^rh + e^ph*e^ph + e^z*e^z
g = e^rhe^rh + e^phe^ph + e^ze^z
sage: g.display(cylindrical)
g = drh*drh + rh^2 dph*dph + dz*dz
g = drhdrh + rh^2 dphdph + dzdz
sage: g[cylindrical.frame(), :, cylindrical]
[ 1 0 0]
[ 0 rh^2 0]
Expand Down Expand Up @@ -232,38 +232,38 @@ Levi-Civita tensor (also called *volume form*) associated with `g`
sage: epsilon is E.volume_form()
True
sage: epsilon.display()
epsilon = dx/\dy/\dz
epsilon = dx∧dy∧dz
sage: epsilon.display(spherical)
epsilon = r^2*sin(th) dr/\dth/\dph
epsilon = r^2*sin(th) drdthdph
sage: epsilon.display(cylindrical)
epsilon = rh drh/\dph/\dz
epsilon = rh drhdphdz

Checking that all orthonormal frames introduced above are right-handed::

sage: ex, ey, ez = E.cartesian_frame()[:]
sage: epsilon(ex, ey, ez).display()
epsilon(e_x,e_y,e_z): E^3 --> R
(x, y, z) |--> 1
(r, th, ph) |--> 1
(rh, ph, z) |--> 1
epsilon(e_x,e_y,e_z): E^3 → ℝ
(x, y, z) 1
(r, th, ph) 1
(rh, ph, z) 1

::

sage: epsilon(*spherical_frame)
Scalar field epsilon(e_r,e_th,e_ph) on the Euclidean space E^3
sage: epsilon(*spherical_frame).display()
epsilon(e_r,e_th,e_ph): E^3 --> R
(x, y, z) |--> 1
(r, th, ph) |--> 1
(rh, ph, z) |--> 1
epsilon(e_r,e_th,e_ph): E^3 → ℝ
(x, y, z) 1
(r, th, ph) 1
(rh, ph, z) 1

::

sage: epsilon(*cylindrical_frame).display()
epsilon(e_rh,e_ph,e_z): E^3 --> R
(x, y, z) |--> 1
(r, th, ph) |--> 1
(rh, ph, z) |--> 1
epsilon(e_rh,e_ph,e_z): E^3 → ℝ
(x, y, z) 1
(r, th, ph) 1
(rh, ph, z) 1


Vector fields as derivations
Expand All @@ -273,20 +273,20 @@ Let `f` be a scalar field on `\mathbb{E}^3`::

sage: f = E.scalar_field(x^2+y^2 - z^2, name='f')
sage: f.display()
f: E^3 --> R
(x, y, z) |--> x^2 + y^2 - z^2
(r, th, ph) |--> -2*r^2*cos(th)^2 + r^2
(rh, ph, z) |--> rh^2 - z^2
f: E^3 → ℝ
(x, y, z) x^2 + y^2 - z^2
(r, th, ph) -2*r^2*cos(th)^2 + r^2
(rh, ph, z) rh^2 - z^2

Vector fields act as derivations on scalar fields::

sage: v(f)
Scalar field v(f) on the Euclidean space E^3
sage: v(f).display()
v(f): E^3 --> R
(x, y, z) |--> -2*z^3
(r, th, ph) |--> -2*r^3*cos(th)^3
(rh, ph, z) |--> -2*z^3
v(f): E^3 → ℝ
(x, y, z) -2*z^3
(r, th, ph) -2*r^3*cos(th)^3
(rh, ph, z) -2*z^3
sage: v(f) == v.dot(f.gradient())
True

Expand Down Expand Up @@ -346,9 +346,9 @@ vector frames defined on `\mathbb{E}^3`::

sage: XE.bases()
[Coordinate frame (E^3, (e_x,e_y,e_z)),
Coordinate frame (E^3, (d/dr,d/dth,d/dph)),
Coordinate frame (E^3, (∂/∂r,∂/∂th,∂/∂ph)),
Vector frame (E^3, (e_r,e_th,e_ph)),
Coordinate frame (E^3, (d/drh,d/dph,d/dz)),
Coordinate frame (E^3, (∂/∂rh,∂/∂ph,∂/∂z)),
Vector frame (E^3, (e_rh,e_ph,e_z))]


Expand Down Expand Up @@ -385,9 +385,9 @@ The bases on `T_p\mathbb{E}^3` are inherited from the vector frames of

sage: Tp.bases()
[Basis (e_x,e_y,e_z) on the Tangent space at Point p on the Euclidean space E^3,
Basis (d/dr,d/dth,d/dph) on the Tangent space at Point p on the Euclidean space E^3,
Basis (∂/∂r,∂/∂th,∂/∂ph) on the Tangent space at Point p on the Euclidean space E^3,
Basis (e_r,e_th,e_ph) on the Tangent space at Point p on the Euclidean space E^3,
Basis (d/drh,d/dph,d/dz) on the Tangent space at Point p on the Euclidean space E^3,
Basis (∂/∂rh,∂/∂ph,∂/∂z) on the Tangent space at Point p on the Euclidean space E^3,
Basis (e_rh,e_ph,e_z) on the Tangent space at Point p on the Euclidean space E^3]

For instance, we have::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ which admits ``dot()`` as a shortcut alias::
sage: s
Scalar field u.v on the Euclidean space E^3
sage: s.display()
u.v: E^3 --> R
(x, y, z) |--> -y*u_x(x, y, z) + x*u_y(x, y, z) + sin(x*y*z)*u_z(x, y, z)
u.v: E^3 → ℝ
(x, y, z) -y*u_x(x, y, z) + x*u_y(x, y, z) + sin(x*y*z)*u_z(x, y, z)

It maps points of `\mathbb{E}^3` to real numbers::

Expand Down Expand Up @@ -181,8 +181,8 @@ It is a scalar field on `\mathbb{E}^3`::
sage: s
Scalar field |u| on the Euclidean space E^3
sage: s.display()
|u|: E^3 --> R
(x, y, z) |--> sqrt(u_x(x, y, z)^2 + u_y(x, y, z)^2 + u_z(x, y, z)^2)
|u|: E^3 → ℝ
(x, y, z) sqrt(u_x(x, y, z)^2 + u_y(x, y, z)^2 + u_z(x, y, z)^2)
sage: s.expr()
sqrt(u_x(x, y, z)^2 + u_y(x, y, z)^2 + u_z(x, y, z)^2)

Expand Down Expand Up @@ -272,8 +272,8 @@ function of `(x,y,z)`::

sage: F = E.scalar_field(function('f')(x,y,z), name='F')
sage: F.display()
F: E^3 --> R
(x, y, z) |--> f(x, y, z)
F: E^3 → ℝ
(x, y, z) f(x, y, z)

The value of `F` at a point::

Expand All @@ -287,8 +287,8 @@ The gradient of `F`::
sage: grad(F).display()
grad(F) = d(f)/dx e_x + d(f)/dy e_y + d(f)/dz e_z
sage: norm(grad(F)).display()
|grad(F)|: E^3 --> R
(x, y, z) |--> sqrt((d(f)/dx)^2 + (d(f)/dy)^2 + (d(f)/dz)^2)
|grad(F)|: E^3 → ℝ
(x, y, z) sqrt((d(f)/dx)^2 + (d(f)/dy)^2 + (d(f)/dz)^2)


Divergence
Expand All @@ -298,8 +298,8 @@ The divergence of the vector field `u`::

sage: s = div(u)
sage: s.display()
div(u): E^3 --> R
(x, y, z) |--> d(u_x)/dx + d(u_y)/dy + d(u_z)/dz
div(u): E^3 → ℝ
(x, y, z) d(u_x)/dx + d(u_y)/dy + d(u_z)/dz

For `v` and `w`, we have::

Expand Down Expand Up @@ -360,8 +360,8 @@ The curl of a gradient is always zero::
The divergence of a curl is always zero::

sage: div(curl(u)).display()
div(curl(u)): E^3 --> R
(x, y, z) |--> 0
div(curl(u)): E^3 → ℝ
(x, y, z) 0

An identity valid for any scalar field `F` and any vector field `u` is

Expand All @@ -382,8 +382,8 @@ The Laplacian `\Delta F` of a scalar field `F` is another scalar field::

sage: s = laplacian(F)
sage: s.display()
Delta(F): E^3 --> R
(x, y, z) |--> d^2(f)/dx^2 + d^2(f)/dy^2 + d^2(f)/dz^2
Delta(F): E^3 → ℝ
(x, y, z) d^2(f)/dx^2 + d^2(f)/dy^2 + d^2(f)/dz^2

The following identity holds:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ At this stage, `\mathbb{E}^3` is endowed with three vector frames::

sage: E.frames()
[Coordinate frame (E^3, (e_x,e_y,e_z)),
Coordinate frame (E^3, (d/dr,d/dth,d/dph)),
Coordinate frame (E^3, (∂/∂r,∂/∂th,∂/∂ph)),
Vector frame (E^3, (e_r,e_th,e_ph))]

The second one is the *coordinate* frame `\left(\frac{\partial}{\partial r},
Expand Down Expand Up @@ -254,9 +254,9 @@ chart ``spherical``)::

sage: for vec in spherical_frame:
....: vec.display(spherical.frame(), spherical)
e_r = d/dr
e_th = 1/r d/dth
e_ph = 1/(r*sin(th)) d/dph
e_r = ∂/∂r
e_th = 1/r ∂/∂th
e_ph = 1/(r*sin(th)) ∂/∂ph


Introducing cylindrical coordinates
Expand Down Expand Up @@ -299,9 +299,9 @@ There are now five vector frames defined on `\mathbb{E}^3`::

sage: E.frames()
[Coordinate frame (E^3, (e_x,e_y,e_z)),
Coordinate frame (E^3, (d/dr,d/dth,d/dph)),
Coordinate frame (E^3, (∂/∂r,∂/∂th,∂/∂ph)),
Vector frame (E^3, (e_r,e_th,e_ph)),
Coordinate frame (E^3, (d/drh,d/dph,d/dz)),
Coordinate frame (E^3, (∂/∂rh,∂/∂ph,∂/∂z)),
Vector frame (E^3, (e_rh,e_ph,e_z))]

The orthonormal frame associated with cylindrical coordinates is
Expand Down Expand Up @@ -359,9 +359,9 @@ chart ``cylindrical``)::

sage: for vec in cylindrical_frame:
....: vec.display(cylindrical.frame(), cylindrical)
e_rh = d/drh
e_ph = 1/rh d/dph
e_z = d/dz
e_rh = ∂/∂rh
e_ph = 1/rh ∂/∂ph
e_z = ∂/∂z


How to evaluate the coordinates of a point in various systems
Expand Down Expand Up @@ -423,19 +423,19 @@ transformations, the expression of `f` in terms of other coordinates is
automatically computed::

sage: f.display()
f: E^3 --> R
(x, y, z) |--> x^2 + y^2 - z^2
(r, th, ph) |--> -2*r^2*cos(th)^2 + r^2
(rh, ph, z) |--> rh^2 - z^2
f: E^3 → ℝ
(x, y, z) x^2 + y^2 - z^2
(r, th, ph) -2*r^2*cos(th)^2 + r^2
(rh, ph, z) rh^2 - z^2

We can limit the output to a single coordinate system::

sage: f.display(cartesian)
f: E^3 --> R
(x, y, z) |--> x^2 + y^2 - z^2
f: E^3 → ℝ
(x, y, z) x^2 + y^2 - z^2
sage: f.display(cylindrical)
f: E^3 --> R
(rh, ph, z) |--> rh^2 - z^2
f: E^3 → ℝ
(rh, ph, z) rh^2 - z^2

The coordinate expression in a given coordinate system is obtained via the
method :meth:`~sage.manifolds.scalarfield.ScalarField.expr`::
Expand Down Expand Up @@ -468,10 +468,10 @@ The computation of the expressions of `g` in the other coordinate systems is
triggered by the method ``display()``::

sage: g.display()
g: E^3 --> R
(x, y, z) |--> x^2 + y^2 + z^2
(r, th, ph) |--> r^2
(rh, ph, z) |--> rh^2 + z^2
g: E^3 → ℝ
(x, y, z) x^2 + y^2 + z^2
(r, th, ph) r^2
(rh, ph, z) rh^2 + z^2


How to express a vector field in various frames
Expand Down
Loading

0 comments on commit 55240bb

Please sign in to comment.