% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\DeRhamComplexXmpTitle}{DeRhamComplex}
\newcommand{\DeRhamComplexXmpNumber}{9.14}
%
% =====================================================================
\begin{page}{DeRhamComplexXmpPage}{9.14 DeRhamComplex}
% =====================================================================
\beginscroll
 
The domain constructor \spadtype{DeRhamComplex} creates the
class of differential forms of arbitrary degree over a coefficient ring.
The De Rham complex constructor takes two arguments: a ring, \spad{coefRing,}
and a list of coordinate variables.
 
\xtc{
This is the ring of coefficients.
}{
\spadpaste{coefRing := Integer \bound{coefRing}}
}
\xtc{
These are the coordinate variables.
}{
\spadpaste{lv : List Symbol := [x,y,z] \bound{lv}}
}
\xtc{
This is the De Rham complex of Euclidean three-space using
coordinates \spad{x, y} and \spad{z.}
}{
\spadpaste{der := DERHAM(coefRing,lv) \free{coefRing}\free{lv}\bound{der}}
}
 
This complex allows us to describe differential forms having
expressions of integers as coefficients.
These coefficients can involve any number of variables, for example,
\spad{f(x,t,r,y,u,z).}
As we've chosen to work with ordinary
Euclidean three-space, expressions involving these forms
are treated as functions of
\spad{x, y} and \spad{z} with the additional arguments
\spad{t, r} and \spad{u} regarded as symbolic constants.
\xtc{
Here are some examples of coefficients.
}{
\spadpaste{R := Expression coefRing \free{coefRing}\bound{R}}
}
\xtc{
}{
\spadpaste{f : R := x**2*y*z-5*x**3*y**2*z**5 \free{R}\bound{f}}
}
\xtc{
}{
\spadpaste{g : R := z**2*y*cos(z)-7*sin(x**3*y**2)*z**2 \free{R}\bound{g}}
}
\xtc{
}{
\spadpaste{h : R :=x*y*z-2*x**3*y*z**2 \free{R}\bound{h}}
}
\xtc{
We now define
the multiplicative basis elements for the exterior algebra over \spad{R}.
}{
\spadpaste{dx : der := generator(1) \free{der}\bound{dx}}
}
\xtc{
}{
\spadpaste{dy : der := generator(2)\free{der}\bound{dy}}
}
\xtc{
}{
\spadpaste{dz : der := generator(3)\free{der}\bound{dz}}
}
\xtc{
This is an alternative way to give the above assignments.
}{
\spadpaste{[dx,dy,dz] := [generator(i)\$der for i in 1..3] \free{der}\bound{dxyz}}
}
\xtc{
Now we define some one-forms.
}{
\spadpaste{alpha : der := f*dx + g*dy + h*dz \bound{alpha}\free{der f g h dxyz}}
}
\xtc{
}{
\spadpaste{beta  : der := cos(tan(x*y*z)+x*y*z)*dx + x*dy \bound{beta}\free{der f g h dxyz}}
}
\xtc{
A well-known theorem states that the composition of
\spadfunFrom{exteriorDifferential}{DeRhamComplex}
with itself is the zero map for continuous forms.
Let's verify this theorem for \spad{alpha}.
}{
\spadpaste{exteriorDifferential alpha; \free{alpha}\bound{ed}}
}
\xtc{
We suppressed the lengthy output of the last expression, but nevertheless, the
composition is zero.
}{
\spadpaste{exteriorDifferential \% \free{ed}}
}
 
\xtc{
Now we check that \spadfunFrom{exteriorDifferential}{DeRhamComplex}
is a ``graded derivation'' \spad{D,} that is, \spad{D} satisfies:
\begin{verbatim}
D(a*b) = D(a)*b + (-1)**degree(a)*a*D(b)
\end{verbatim}
}{
\spadpaste{gamma := alpha * beta \bound{gamma}\free{alpha}\free{beta}}
}
\xtc{
We try this for the one-forms \spad{alpha} and \spad{beta}.
}{
\spadpaste{exteriorDifferential(gamma) - (exteriorDifferential(alpha)*beta - alpha * exteriorDifferential(beta)) \free{alpha beta gamma}}
}
\xtc{
Now we define some ``basic operators'' (see \downlink{`Operator'}{OperatorXmpPage}\ignore{Operator}).
%-% \HDindex{operator}{DeRhamComplexXmpPage}{9.14}{DeRhamComplex}
}{
\spadpaste{a : BOP := operator('a) \bound{ao}}
}
\xtc{
}{
\spadpaste{b : BOP := operator('b) \bound{bo}}
}
\xtc{
}{
\spadpaste{c : BOP := operator('c) \bound{co}}
}
\xtc{
We also define
some indeterminate one- and two-forms using these operators.
}{
\spadpaste{sigma := a(x,y,z) * dx + b(x,y,z) * dy + c(x,y,z) * dz \bound{sigma}\free{ao bo co dxyz}}
}
\xtc{
}{
\spadpaste{theta  := a(x,y,z) * dx * dy + b(x,y,z) * dx * dz + c(x,y,z) * dy * dz \bound{theta}\free{ao bo co dxyz}}
}
 
\xtc{
This allows us to get formal definitions for the ``gradient'' \ldots
}{
\spadpaste{totalDifferential(a(x,y,z))\$der \free{ao der}}
}
\xtc{
the ``curl'' \ldots
}{
\spadpaste{exteriorDifferential sigma \free{sigma}}
}
\xtc{
and the ``divergence.''
}{
\spadpaste{exteriorDifferential theta \free{theta}}
}
 
\xtc{
Note that the De Rham complex is an algebra with unity.
This element \spad{1} is the basis for elements for zero-forms, that is,
functions in our space.
}{
\spadpaste{one : der := 1 \bound{one}\free{der}}
}
 
\xtc{
To convert a function to a function lying in the De Rham complex,
multiply the function by ``one.''
}{
\spadpaste{g1 : der := a([x,t,y,u,v,z,e]) * one \free{der one ao}\bound{g1}}
}
\xtc{
A current limitation of \Language{} forces you to write
functions with more than four arguments using square brackets in this way.
}{
\spadpaste{h1 : der := a([x,y,x,t,x,z,y,r,u,x]) * one \free{der one ao}\bound{h1}}
}
 
\xtc{
Now note how the system keeps track of where your coordinate functions
are located in expressions.
}{
\spadpaste{exteriorDifferential g1 \free{g1}}
}
\xtc{
}{
\spadpaste{exteriorDifferential h1 \free{h1}}
}
 
\xtc{
In this example of Euclidean three-space, the basis for the De Rham complex
consists of the eight forms: \spad{1}, \spad{dx}, \spad{dy}, \spad{dz},
\spad{dx*dy}, \spad{dx*dz}, \spad{dy*dz}, and \spad{dx*dy*dz}.
}{
\spadpaste{coefficient(gamma, dx*dy) \free{gamma dxyz}}
}
\xtc{
}{
\spadpaste{coefficient(gamma, one) \free{gamma one}}
}
\xtc{
}{
\spadpaste{coefficient(g1,one) \free{g1 one}}
}
\endscroll
\autobuttons
\end{page}
%