====================================================================
DeRhamComplex examples
====================================================================

The domain constructor DeRhamComplex creates the class of differential
forms of arbitrary degree over a coefficient ring.  The De Rham
complex constructor takes two arguments: a ring, coefRing, and a list
of coordinate variables.

This is the ring of coefficients.

  coefRing := Integer
   Integer
                      Type: Domain

These are the coordinate variables.

  lv : List Symbol := [x,y,z] 
   [x,y,z]
                      Type: List Symbol


This is the De Rham complex of Euclidean three-space using coordinates
x, y and z.

  der := DERHAM(coefRing,lv) 
   DeRhamComplex(Integer,[x,y,z])
                      Type: Domain

This complex allows us to describe differential forms having
expressions of integers as coefficients.  These coefficients can
involve any number of variables, for example, 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 x, y and z with the
additional arguments t, r and u regarded as symbolic constants.

Here are some examples of coefficients.

  R := Expression coefRing
   Expression Integer
                     Type: Domain

  f : R := x**2*y*z-5*x**3*y**2*z**5
       3 2 5    2
   - 5x y z  + x y z
                     Type: Expression Integer

  g : R := z**2*y*cos(z)-7*sin(x**3*y**2)*z**2 
       2     3 2       2
   - 7z sin(x y ) + y z cos(z)
                     Type: Expression Integer

  h : R :=x*y*z-2*x**3*y*z**2 
       3   2
   - 2x y z  + x y z
                     Type: Expression Integer

We now define the multiplicative basis elements for the exterior
algebra over R.

  dx : der := generator(1)
   dx
                     Type: DeRhamComplex(Integer,[x,y,z])

  dy : der := generator(2)
   dy
                     Type: DeRhamComplex(Integer,[x,y,z])

  dz : der := generator(3)
   dz
                     Type: DeRhamComplex(Integer,[x,y,z])

This is an alternative way to give the above assignments.

  [dx,dy,dz] := [generator(i)$der for i in 1..3]
    [dx,dy,dz]
                     Type: List DeRhamComplex(Integer,[x,y,z])

Now we define some one-forms.

  alpha : der := f*dx + g*dy + h*dz
          3   2                   2     3 2       2
     (- 2x y z  + x y z)dz + (- 7z sin(x y ) + y z cos(z))dy
   + 
          3 2 5    2
     (- 5x y z  + x y z)dx
                     Type: DeRhamComplex(Integer,[x,y,z])

  beta  : der := cos(tan(x*y*z)+x*y*z)*dx + x*dy
    x dy + cos(tan(x y z) + x y z)dx
                     Type: DeRhamComplex(Integer,[x,y,z])

A well-known theorem states that the composition of exteriorDifferential 
with itself is the zero map for continuous forms. Let's verify this 
theorem for alpha.

  exteriorDifferential alpha
         2                  3 2                    3 2
     (y z sin(z) + 14z sin(x y ) - 2y z cos(z) - 2x z  + x z)dy dz
   + 
         3 2 4     2   2          2
     (25x y z  - 6x y z  + y z - x y)dx dz
   + 
           2 2 2     3 2       3   5    2
     (- 21x y z cos(x y ) + 10x y z  - x z)dx dy
                      Type: DeRhamComplex(Integer,[x,y,z])

We see a lengthy output of the last expression, but nevertheless, the
composition is zero.

  exteriorDifferential %
    0
                      Type: DeRhamComplex(Integer,[x,y,z])

Now we check that exteriorDifferential is a "graded derivation" D,
that is, D satisfies:

  D(a*b) = D(a)*b + (-1)**degree(a)*a*D(b)

  gamma := alpha * beta
        4   2    2               3   2
     (2x y z  - x y z)dy dz + (2x y z  - x y z)cos(tan(x y z) + x y z)dx dz
   + 
       2     3 2       2                                   4 2 5    3
   ((7z sin(x y ) - y z cos(z))cos(tan(x y z) + x y z) - 5x y z  + x y z)dx dy
                      Type: DeRhamComplex(Integer,[x,y,z])

We try this for the one-forms alpha and beta.

  exteriorDifferential(gamma) - (exteriorDifferential(alpha)*beta - alpha * exteriorDifferential(beta)) 
    0
                      Type: DeRhamComplex(Integer,[x,y,z])

Now we define some "basic operators"

  a : BOP := operator('a)
    a
                      Type: BasicOperator

  b : BOP := operator('b)
    b
                      Type: BasicOperator

  c : BOP := operator('c)
    c
                      Type: BasicOperator

We also define some indeterminate one- and two-forms using these
operators.

  sigma := a(x,y,z) * dx + b(x,y,z) * dy + c(x,y,z) * dz 
    c(x,y,z)dz + b(x,y,z)dy + a(x,y,z)dx
                      Type: DeRhamComplex(Integer,[x,y,z])

  theta  := a(x,y,z) * dx * dy + b(x,y,z) * dx * dz + c(x,y,z) * dy * dz 
    c(x,y,z)dy dz + b(x,y,z)dx dz + a(x,y,z)dx dy
                      Type: DeRhamComplex(Integer,[x,y,z])

This allows us to get formal definitions for the "gradient" ...

  totalDifferential(a(x,y,z))$der 
   (23)  a  (x,y,z)dz + a  (x,y,z)dy + a  (x,y,z)dx
          ,3             ,2             ,1
                      Type: DeRhamComplex(Integer,[x,y,z])
the "curl" ...

  exteriorDifferential sigma
     (c  (x,y,z) - b  (x,y,z))dy dz + (c  (x,y,z) - a  (x,y,z))dx dz
       ,2           ,3                  ,1           ,3
   + 
     (b  (x,y,z) - a  (x,y,z))dx dy
       ,1           ,2
                       Type: DeRhamComplex(Integer,[x,y,z])

and the "divergence."

  exteriorDifferential theta
    (c  (x,y,z) - b  (x,y,z) + a  (x,y,z))dx dy dz
      ,1           ,2           ,3
                       Type: DeRhamComplex(Integer,[x,y,z])

Note that the De Rham complex is an algebra with unity.  This element
1 is the basis for elements for zero-forms, that is, functions in our
space.

  one : der := 1
    1
                       Type: DeRhamComplex(Integer,[x,y,z])

To convert a function to a function lying in the De Rham complex,
multiply the function by "one."

  g1 : der := a([x,t,y,u,v,z,e]) * one 
    a(x,t,y,u,v,z,e)
                       Type: DeRhamComplex(Integer,[x,y,z])

A current limitation of Axiom forces you to write functions with more
than four arguments using square brackets in this way.

  h1 : der := a([x,y,x,t,x,z,y,r,u,x]) * one 
    a(x,y,x,t,x,z,y,r,u,x)
                        Type: DeRhamComplex(Integer,[x,y,z])

Now note how the system keeps track of where your coordinate functions
are located in expressions.

  exteriorDifferential g1 
    a  (x,t,y,u,v,z,e)dz + a  (x,t,y,u,v,z,e)dy + a  (x,t,y,u,v,z,e)dx
     ,6                     ,3                     ,1
                        Type: DeRhamComplex(Integer,[x,y,z])

  exteriorDifferential h1
     a  (x,y,x,t,x,z,y,r,u,x)dz
      ,6
   + 
     (a  (x,y,x,t,x,z,y,r,u,x) + a  (x,y,x,t,x,z,y,r,u,x))dy
       ,7                         ,2
   + 
         a   (x,y,x,t,x,z,y,r,u,x) + a  (x,y,x,t,x,z,y,r,u,x)
          ,10                         ,5
       + 
         a  (x,y,x,t,x,z,y,r,u,x) + a  (x,y,x,t,x,z,y,r,u,x)
          ,3                         ,1
    *
       dx
                       Type: DeRhamComplex(Integer,[x,y,z])

In this example of Euclidean three-space, the basis for the De Rham complex
consists of the eight forms: 1, dx, dy, dz, dx*dy, dx*dz, dy*dz, and dx*dy*dz.

  coefficient(gamma, dx*dy)
       2     3 2       2                                   4 2 5    3
    (7z sin(x y ) - y z cos(z))cos(tan(x y z) + x y z) - 5x y z  + x y z
                       Type: Expression Integer

  coefficient(gamma, one)
    0
                       Type: Expression Integer

  coefficient(g1,one)
    a(x,t,y,u,v,z,e)
                       Type: Expression Integer

See Also:
o )help Operator
o )show DeRhamComplex

