# Simple Differential Forms Calculator

Document Version 1.2 -- FORMS.M Version 4.0

These notes describe a calculator implemented in Mathematica to simplify expressions involving differential forms. As the name implies, the intent was to make a minimal implementation, with little attention paid to efficient input or pretty output. It will get the signs right for you, and the simplicity of the implementation will demonstrate the efficiency of a rule-based system for this kind of programming. Setting up such a system is a good way to debug your understanding of forms.

Material below here is unreconstructed TeX input, to be moved above this line as legit hypertext as time permits.
The key idea behind all of this is that Mathematica manipulates expressions as trees. It looks for patterns, and when it finds a match, substitutes something else for the pattern. When it finds no further matches, or none at all, it returns the expression. I will use the fallen tree'' representation for drawing trees in ascii text streams. This is the style used in the trn newsreader. The trees are written on their sides, hence my name for it. The vector expression $${\smpartial\over\smpartial x} + 2 {\smpartial\over\smpartial y} + {\smpartial\over\smpartial z}$$ would be written as an expression tree in Mathematica which I will write in this notation þ Plus--Vector--x |-Times--2 | \-Vector--y \-Vector--z þ \ssec{ Coordinates } You might want to start working with forms in three dimensional Euclidean space. There are special definitions to simplify the input and output for this case in the file þeuclid3.mþ\. The coordinates there are $x$, $y$, and $z$. It is surprising how many of the rules for forms do not depend on any knowledge of the full list of coordinates. I didn't realize this until I developed this system. The shorthand names for the basis forms defined in þeuclid3.mþ\ are þdxþ, þdxdyþ, þdxdydzþ\ and so on. No spaces here, Mathematica treats these as a single symbol. The basis vectors are given by þpxþ, and so on. The "absent" symbol $\hat{dx}$ is denoted by þtxþ. There is also an output function þEfilterþ\ that you can use to beautify the output, setting þ In[]:= $Post = Efilter þ \ssec{ Vectors } A vector will be a linear combination of monomial terms. Each of these monomials will be a tree with one branch. The head of the tree is a node labeled Vector''. The symbol on the branch indicates the direction of the vector relative to the coordinate system. No rules are needed for these monomials to form a vector space. \ssec{ Forms } Differential forms will be linear combinations of monomial terms. This time there will be a number of branches; an$r$-form will have$r$branches below a node labeled Form''. The 2-form$dx\,dy$would be represented by the tree þ Form--x \-y þ and written þForm[x,y]þ. The shorthand in þeuclid3.mþ\ would let you write this þdxdyþ, no space. We need to explicitly accomodate the fact that a$0$-form is a number with a rule þ Form[] := 1 þ The antisymmetry allows us to simplify expressions involving forms. This is not done continually, in the interests of efficiency, but the following rule is invoked as needed: þ FSimp := Form[ a__] :> Signature[ Form[a]] Sort[Form[a]] þ \ssec{ Duality } The operation which contracts a vector with a form is denoted by the operator angle''. The expression $$a {\smpartial\over\smpartial x} \angle b \, dx \, dy \, dz$$ is represented by þ angle--Times--a | \-Vector--x \-Times--b \-Form--x |-y \-z þ There are rules needed to enforce the bilinearity of this operation, such as þ angle[ a_, b_ + c_] := angle[a,b] + angle[a,c] þ which is the replacement þ angle--a Plus--angle--a \-Plus--b -> | \-b \-c \-angle--a \-c þ The essential rule replaces þ angle--Vector--u \-Form--u -> \-Form--a |-a \-b \-b þ with due attention to the signs. There are also rules needed to take care of the fact that we represent the zero vector and the zero forms by the number zero. \ssec{ Wedge Product } The wedge produce is denoted by the tree þ wedge--Form |-Form ... \-Form þ I have put in some rules that let you denote the wedge product with þNonCommutativeMultiplyþ, þ**þ, but these are not fool proof at present. Intuitively you expect þ**þ\ to bind more weakly than þ*þ, but that can't be done in Mma as I understand it. So it gets confused on þ dx ** 3 dy þ \ssec{ Exterior Derivative } The exterior derivative operator is denoted þd[.]þ. Functions need to have their arguments explicitly indicated, since the differentiations are done by the Mathematica operator þDtþ. Thus þ In := d[ f[x,y] ] (1,0) (0,1) Out = f [x,y] Form[x] + f [x,y] Form[y] þ \ssec{ Lie Bracket } The Lie bracket (Jacobi bracket) is represented by þ Lie--Vector \-Vector þ and linear combinations. \ssec{ Lie Derivative of Forms } This is represented by þ Lie--Vector \-Form þ and linear combinations. \ssec{ Twisted Forms } These are put in using the absent symbol'' notation. The twisted form $$\hat{dx}\hat{dy}$$ will be represented by the expression tree þ TForm--x \-y þ and written þTForm[x,y]þ. The shorthand in þeuclid3.mþ\ would allow you to write this þtxtyþ. The unit pseudoscalar is called þtmaxþ, and in Euclidean 3-space we have þ tmax = TForm[x,y,z] þ The þLengthþ\ of the variable þtmaxþ\ is used whenever a result depends upon the dimension of the space. The wedge of an ordinary form with a twisted form in that order does not depend upon the dimension of the space, but the other two products do. Thus the exterior derivative of a twisted form can be computed without knowing the dimension of the space or the names of any coordinates beyond those given. \ssec{ Pullback } Defined so far only for ordinary forms: þ Pullback--Form \-Rule þ where the second argument is the set of rules that describe the map. For the$x$-axis as a parametrized curve, the rules would be þ pc = {x->s, y->0, z->0} þ The points on the curve are found from the replacement þ {x,y,z} /. pc þ and the pullback of a form alpha onto the$x$-axis would be found from þ Pullback[pc, alpha] þ \ssec{ Hodge Star } The present implementation is rather simple minded. It assumes that the coordinates are orthonormal, and that the coordinate$t\$, if present, is timelike. Also both star and it's inverse are denoted by star: þ star--Form and star--TForm þ \ssec{ Testing } There is a file of test expressions that has been used to validate the system, and that should be used if you modify the rules to ensure that you have not broken anything. The file is called þtrip.mþ, and will run when you load it after þforms.mþ. \bye