linalg::ogCoordTab
-- table
of orthogonal coordinate transformationslinalg::ogCoordTab
is a table of predefined orthogonal
coordinate transformations in R^3.
linalg::ogCoordTab
[ogCoord <, Scales>](u1, u2, u3 <, c...>)
ogCoord |
- | the name of a predefined coordinate system (an identifier) |
u1,u2,u3 |
- | names of the coordinates of the specified coordinate system (identifiers) |
c |
- | an arithmetical expression |
Scales |
- | returns the scaling factors of the coordinate system
ogCoord . |
a function in the coordinates u1,u2,u3
of the specified
coordinate system. The function returns a list of the three vectors
e_u1, e_u2, e_u3, where each vector is a list of three
arithmetical expressions.
linalg::curl
, linalg::divergence
, linalg::grad
, linalg::hessian
, linalg::jacobian
ogCoord
defines a coordinate
transformation X = T(U), which maps the vector U =
[u1,u2,u3] in the corresponding orthogonal coordinate system to a
vector X = [x,y,z] in Cartesian coordinates.u1,u2,u3
.linalg::ogCoordTab
is used by functions such as
linalg::curl
, linalg::divergence
and
linalg::grad
to perform
computations with respect to other coordinates than Cartesian
coordinates.linalg::ogCoordTab
defines the following coordinate
transformations with the implicit assumptions 0 <= theta <
PI and 0 <= phi < 2*PI:
Cartesian
Spherical
x = r*sin(theta)*cos(phi) y = r*sin(theta)*sin(phi) z = r*cos(theta).
Cylindrical
x = r*cos(phi) y = r*sin(phi) z = z
ParabolicCylindrical
x = 1/2*(u^2 + v^2) y = u*v z = z
Torus
x = (c - r*cos(theta))*cos(phi) y = (c - r*cos(theta))*sin(phi) z = r*sin(theta), 0 <= r < c (c a real constant)
RotationParabolic
x = u*v*cos(phi) y = u*v*sin(phi) z = 1/2*(u^2 - v^2)
EllipticCylindrical
x = c*cosh(u)*cos(v) y = c*sinh(u)*sin(v) z = z (c a real constant)
The following call returns the vector [x,y,z] in spherical coordinates, expressed in terms of r, theta and phi:
>> delete r, theta, phi: linalg::ogCoordTab[Spherical](r, theta, phi)
[[cos(phi) sin(theta), sin(phi) sin(theta), cos(theta)], [cos(phi) cos(theta), sin(phi) cos(theta), -sin(theta)], [-sin(phi), cos(phi), 0]]
The scaling factors of the corresponding coordinate transformation are:
>> linalg::ogCoordTab[Spherical,Scales](r, theta, phi)
[1, r, r sin(theta)]
We express the Cartesian coordinates [x,y,z] in elliptic cylindrical coordinates written in terms of u, v and z, choosing c=1:
>> delete u, v, z: linalg::ogCoordTab[EllipticCylindrical](u, v, z, 1)
-- -- cos(v) sinh(u) sin(v) cosh(u) -- | | -----------------------, -----------------------, 0 |, | | 2 2 1/2 2 2 1/2 | -- -- (cosh(u) - cos(v) ) (cosh(u) - cos(v) ) -- -- sin(v) cosh(u) cos(v) sinh(u) -- | - -----------------------, -----------------------, 0 | | 2 2 1/2 2 2 1/2 | -- (cosh(u) - cos(v) ) (cosh(u) - cos(v) ) -- -- , [0, 0, 1] | | --
To compute the gradient of the vector function 2*x*y+z in elliptic cylindrical coordinates with c=1 we enter:
>> delete x, y, z: linalg::grad(2*x*y + z, [x, y, z], linalg::ogCoordTab[EllipticCylindrical,Scales](u, v, z, 1) )
+- -+ | 2 y | | ------------------------- | | 2 2 1/2 | | (- cos(v) + cosh(u) ) | | | | 2 x | | ------------------------- | | 2 2 1/2 | | (- cos(v) + cosh(u) ) | | | | 1 | +- -+