%%
%
%% 1.1  Vectors and Metric
% A first step to theoretical physics is the mathematical description of space and time. This is based on coordinate systems consisting of an origin, basis vectors and coordinates.
% The basis vectors determine directions or axis in space, the coordinates are the distance along these axes from the origin to a space point.
% First, there is the space vector with three basis vectors and coordinates for x, y and z. To take the invariance of the speed of light into account, a fourth component is needed. In the case of the spacetime vector, this component is the product of the imaginary unit i, the speed of light c, and time t.
%
% (1‑1)
%% Invariance
% Physical laws are objective or context independent, their formulation cannot depend on the arbitrary choice of a coordinate system. The representation of a vector, however, depends on such a choice. Independent or invariant or objective is the length of a vector, the scalar product of two vectors respectively the angle between them, or the scalar triple product of three vectors.
%
% (1‑2)
%% Generalized coordinates
% By choosing a suitable coordinate system,  physical problems can be simplified or even solved. Therefore, we consider generalized coordinates, their basis vectors and metric. We do not normalize the basis vectors and call them ground vectors. This way, we can treat non-orthogonal coordinates and perform calculations on curved subspaces, for example two-dimensional planes in 3-space.
%
% (1‑3)
%  Example (for orthogonal coordinates):
%
%         (1‑4)
%% Contravariant ground vectors
% The scalar product of two vectors is based on the orthogonality of left and right ground vectors. For non-orthogonal coordinates, a distinction must be made between covariant (right) and contravariant (left) ground vectors. A contravariant ground vector can be constructed as gradient of the corresponding generalized coordinate, since this gradient is orthogonal to the level surface of the other ground vectors.
%
% (1‑5)
%
% Construction of a contravariant ground vector. The ground vectors of r and φ span the plane with a=constant. The gradient of a(x_i) is orthogonal to this plane and therefore also to the relevant covariant ground vectors.
%%
%% Covariant and contravariant expansion
% Vectors can be represented with both systems of ground vectors \vec {g_i} and \vec {g^i}. We consider the scalar product of a vector with a ground vector, use the orthonormality of the ground vectors, and compare the coefficients.
%
% (1‑6)
%% Metric und scalar product
% The metric of the contravariant ground vectors can be calculated by inversion of the covariant metric.  Therefore, contravariant ground vectors are not explicitly required in the rest of this script.
%
% (1‑7)
%% Raising and lowering of indices
% The metric allows to change between covariant and contravariant ground vectors and coordinates. This is done by raising and lowering of indices.
%
% (1‑8)
%% Total differential and gradient
% The differential of the space vector is directly connected to the definition of the ground vectors. The differential of a scalar field leads to the gradient of the field. It becomes clear that the space vector is covariant, and that the field gradient is contravariant.
%
% (1‑9)
% This brings us to the central point of theoretical physics. The scalar product of the space vector  and the momentum vector  defines a scalar quantity, the action S. The so-called canonical momentum is the gradient of the action, and is thus contravariant. Relativity of space and time lead to four-space and four-momentum, therefore the action includes contributions of space and time .
%
% (1‑10)
%% Proceeding
% Once appropriate coordinates have been chosen,  the Jacobian can be derived. Its rows are the ground vectors. From the Jacobi matrix, the metric is obtained through matrix multiplication and the contravariant metric through matrix inversion.
%
% (1‑11)
%% Example: Cylindrical coordinates
%
% (1‑12)