## `linalg::curl` -- curl of a vector field

#### Introduction

`linalg::curl``(v, x)` computes the curl of the three-dimensional vector field v with respect to the three-dimensional vector x in Cartesian coordinates. This is the vector field

    curl(v) = [diff(x[2],v[3]) - diff(x[3],v[2]), diff(x[3],v[1]) -
                     diff(x[1],v[3]), diff(x[1],v[2]) - diff(x[2],v[1])].

#### Call(s)

`linalg::curl(v, x)`
`linalg::curl(v, x, ogCoord)`

#### Parameters

`v` | - | a list of three arithmetical expressions, or a 3-dimensional vector (i.e., a 3 x 1 or 1 x 3 matrix of a domain of category `Cat::Matrix`)
`x` | - | a list of three (indexed) identifiers
`ogCoord` | - | a list, or a name (identifier) of a predefined coordinate system

#### Returns

a column vector.

#### Related Functions

`linalg::divergence`, `linalg::grad`, `linalg::ogCoordTab`

#### Details

- `linalg::curl``(v, x, ogCoord)` computes the curl of `v` with respect to `x` in the orthogonally curvilinear coordinate system specified by `ogCoord`.

  The scaling factors of the specified coordinate system must be the value of the index `ogCoord` of the table `linalg::ogCoordTab` (see example 2).

- If `ogCoord` is given as a list then the curl of `v` is computed in the orthogonal curvilinear coordinates, whose scaling factors are given in `ogCoord` (see example 3).
- If `v` is a vector then the component ring of `v` must be a field (i.e., a domain of category `Cat::Field`) for which differentiation with respect to `x` is defined.
- `linalg::curl` returns a vector of the domain `Dom::Matrix()` if `v` is given as a list of arithmetical expressions.

#### Example 1

We compute the curl of the vector field v((x,y,z)=(xy, 2y, z) in Cartesian coordinates:

    >> delete x, y, z:
       linalg::curl([x*y, 2*y, z], [x, y, z])

                                     +-    -+
                                     |   0  |
                                     |      |
                                     |   0  |
                                     |      |
                                     |  -x  |
                                     +-    -+

#### Example 2

We compute the curl of the vector field v(r,phi,z)=(r,cos(phi),z) (0<=phi<=2*PI) in cylindrical coordinates:

    >> delete r, phi, z: V := matrix([r, cos(phi), z]):

    >> linalg::curl(V, [r, phi, z], Cylindrical)

                                  +-          -+
                                  |      0     |
                                  |            |
                                  |      0     |
                                  |            |
                                  |  cos(phi)  |
                                  |  --------  |
                                  |     r      |
                                  +-          -+

The following relations between Cartesian and cylindrical coordinates hold:

    x=r*cos(phi), y=r*sin(phi), z=z.

Other predefined orthogonal coordinate systems can be found in the table `linalg::ogCoordTab`.

#### Example 3

We want to compute the curl of the vector field v(r,theta,phi)=(0,r^2,0) (0<=theta<=PI, 0<=phi<=2*PI) in spherical coordinates.

The vectors

            e_r = [sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta)],
            e_theta = [cos(theta)*cos(phi), cos(theta)*sin(phi),-sin(theta)],
            e_phi = [-sin(phi), cos(phi), 0],

form an orthogonal system in spherical coordinates.

The scaling factors of the corresponding coordinate transformation (see `linalg::ogCoordTab`) are: g1=|e_r|=1, g2=|e_theta|=r, g3=|e_phi|=r*sin(theta), which we use in the following example to compute the curl of the above vector field in spherical coordinates:

    >> delete r, theta, phi:
       linalg::curl([0, r^2, 0], [r, theta, phi], [1, r, r*sin(theta)])

                                     +-     -+
                                     |   0   |
                                     |       |
                                     |   0   |
                                     |       |
                                     |  3 r  |
                                     +-     -+

Note that the spherical coordinates are already defined in `linalg::ogCoordTab`, i.e., the last result can also be achieved with the input `linalg::curl([0, r^2, 0], [r, theta, phi], Spherical)`.

#### Changes

- The result is a vector even if the vector field is given as a list of expressions.

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000