login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

spad
)abbrev package DFORM DifferentialForms
++ Author: Kurt Pagani <nilqed@gmail.com>
++ Date Created: October 2014 
++ Revised: Sat Sep 17 17:10:00 CET 2016
++ License: FriCAS/BSD
++ Description: Basic differential form methods
++ Requirements: DeRhamComplex, FriCAS 1.3 or later.  
++ Documentation: Sphinx, folder doc and/or do 
++ - [pdf]latex dform.spad -> dvi or pdf file.
++ - run two times to get refs and labels correct.
++
DifferentialForms(R,v) : Exports == Implementation where
R: Join(IntegralDomain,Comparable) v: List Symbol
X ==> Expression R OF ==> OutputForm DRC ==> DeRhamComplex(R,v) CHC ==> ChainComplex(R,#v) BOP ==> BasicOperator NNI ==> NonNegativeInteger SMR ==> SquareMatrix(#v,X) EAB ==> ExtAlgBasis REA ==> Record(k : EAB, c : X) SGCF ==> SymmetricGroupCombinatoricFunctions
Exports == with
_* : (List X, List DRC) -> DRC ++ v*w computes the sum of the products v_i * w_i ++ where v_i is a scalar and w_i a differential form. ++ This is for convenience only, just to deal with ++ differential form valued vectors. _* : (List DRC, List DRC) -> DRC ++ w1*w2 computes the sum of the exterior products ++ w1_i * w2_i, where w1,w2 are differential forms. d : DRC -> DRC ++ d w computes the exterior derivative and is just an ++ abbreviation for the fucntion "exteriorDifferential" ++ defined in the domain "DeRhamComplex". one : -> DRC ++ one() gives 1@DeRhamComplex, i.e. "1" as a differential ++ form. This is useful to intern elements of the function ++ ring (just multiply them by one()$DFORM). zero : -> DRC ++ zero() gives the zero form, i.e. 0@DRC. baseForms : () -> List DRC ++ baseForms()$M returns a list of all base forms in the ++ space M=DFORM(Ring,Coordinates). coordVector : () -> List X ++ coordVector()$M returns a list of the coordinates in ++ the space M=DFORM(Ring,Coordinates). coordSymbols : () -> List Symbol ++ coordSymbols()$M returns a list of the coordinates as ++ symbols. This is useful for example if the differential ++ operators "D" are going to be used. vectorField : Symbol -> List X ++ vectorField(V) creates a vector (actually a list) whose ++ components are given by V[j](x[1],...,x[n]), j=1..n, ++ whereby "x" are the space coordinates (possibly not the ++ same symbol). scalarField : Symbol -> X ++ scalarField(s) creates a scalar function s(x[1],...,[n]), ++ whereby "x" are the space coordinates (possibly not the ++ same symbol). covectorField : Symbol -> List DRC ++ covectorField(Y) creates a covector (actually a list) ++ whose components are given by w[j](x[1],...,x[n]), ++ j=1..n. zeroForm : Symbol -> DRC ++ zeroForm(s) creates a zero form with symbol "s". This ++ is the same as scalarField(s)*one(). volumeForm : SMR -> DRC ++ volumeForm(g) returns the volume form with respect to ++ the (pseudo-) metric "g". conjBasisTerm : DRC -> DRC ++ Return the complement of a basis term w.r.t. volumeForm atomizeBasisTerm : DRC -> List DRC ++ Given a basis term, e.g. dx*dy*du, atomizeBasisTerm returns ++ a list of the generators (atoms), i.e. [dx,dy,du] for our example. monomials : NNI -> List DRC ++ List of all monomials of degree p (p in 1..n). ++ This is a basis for Lambda(n,p). hodgeStar : (SMR,DRC) -> DRC ++ computes the Hodge dual of the differential form % with respect ++ to a metric g. dot : (SMR,DRC,DRC) -> X ++ computes the inner product of two differential forms w.r.t. g proj : (NNI,DRC) -> DRC ++ projection to homogeneous terms of degree p interiorProduct : (Vector(X),DRC) -> DRC ++ Calculates the interior product i_X(a) of the vector field X ++ with the differential form a. lieDerivative : (Vector(X),DRC) -> DRC ++ Calculates the Lie derivative L_X(a) of the differential ++ form a with respect to the vector field X. s : SMR -> X ++ s(g) determines the sign of determinant(g) and is related to the ++ signature of g (n=p+q,t=p-q,s=(-)^(n-t)/2 => s=(-)^q. invHodgeStar : (SMR,DRC) -> DRC ++ invHodgeStar is the inverse of hodgeStar. codifferential : (SMR,DRC) -> DRC ++ codifferential(g,x), also known as "delta", computes the ++ co-differential of a form. hodgeLaplacian : (SMR,DRC) -> DRC ++ hodgeLaplacian(g,x) also known as "Laplace-de Rham operator" is ++ defined on any manifold equipped with a (pseudo-) Riemannian ++ metric and is given by d codifferential(g,x)+ codifferential(g, d x). ++ Note that in the Euclidean case hodgeLaplacian = - Laplacian.
Implementation == add
-- error messages err1:="Metric tensor must be symmetric" err2:="Degenerate metric" err3:="Index out of range" err4:="Not implemented" err5:="Basis term expected" err6:="Zero is not a basis term"
-- conversion functions (not very nice ;) eab2li(x:EAB):List(Integer) == x pretend List(Integer) drc2rea(x:DRC):List(REA) == x pretend List(REA)
n:NNI:=#v d(f) == exteriorDifferential(f) one () == 1@DRC zero() == 0@DRC baseForms() == [generator(j)$DRC for j in 1..n] coordVector() == [s::X for s in v] coordSymbols() == v
vectorField(s:Symbol):List X == ls:=[subscript(s,[j::OF]) for j in 1..n] op:=[operator t for t in ls] x:=[a::X for a in v] [f x for f in op]
scalarField(s:Symbol):X == f:=operator s f [a::X for a in v]
covectorField(s:Symbol):List DRC == vf:=vectorField(s) [a*1@DRC for a in vf]
zeroForm(s:Symbol):DRC == scalarField(s)*1@DRC
(l:List(X) * x:List DRC):DRC == l:List DRC:=[l.j * x.j for j in 1..n] reduce(_+,l)
(x:List DRC * y:List DRC):DRC == l:List DRC:=[x.j * y.j for j in 1..n] reduce(_+,l)
volumeForm(g:SMR):DRC == sqrt(abs(determinant(g)))*reduce(_*,baseForms())
monomials(p:NNI):List DRC == bf:=baseForms() p=0 => [1$DRC] p=1 => bf np:=[reverse subSet(n,p,i)$SGCF for i in 0..binomial(n,p)-1] [reduce(_*,[bf.(1+s.j) for j in 1..p]) for s in np]
-- flip 0->1, 1->0 flip(b:EAB):EAB == --bl := convert(b)$EAB bl:=eab2li(b) [(i+1) rem 2 for i in bl]::EAB
-- list the positions of a's (a=0,1) in x pos(x:EAB, a:Integer):List(Integer) == y:List(Integer):=eab2li(x) [j for j in 1..#y | y.j=a]
-- compute dot of singletons, diagonal g dot1(g:SMR,r:REA, s:REA):X == test(r.k ~= s.k) => 0::X idx := pos(r.k,1) idx = [] => r.c * s.c reduce("*",[1/g(j,j) for j in idx]::List(X)) * r.c * s.c
-- compute dot of singleton terms, general symmetric g dot2(g:SMR,r:REA, s:REA):X == pr := pos(r.k,1) -- list positions of 1 in r ps := pos(s.k,1) -- list positions of 1 in s test(#pr ~= #ps) => 0::X -- not same degree => 0 pr = [] => r.c * s.c -- empty pr,ps => product of coefs G := inverse(g)::SMR -- compute the inverse of the metric g test(#pr = 1) => G(pr.1,ps.1)::X * r.c * s.c -- only one element M:Matrix(X) -- the minor M := matrix([[G(pr.i,ps.j)::X for j in 1..#ps] for i in 1..#pr]) determinant(M)::X * r.c * s.c
-- export dot(g:SMR,x:DRC,y:DRC):X == not symmetric? g => error(err1) tx:List REA := drc2rea(x) ty:List REA := drc2rea(y) tx = [] or ty = [] => 0::X if diagonal? g then -- better performance a:List(X):=concat[[dot1(g,tx.j,ty.l)::X for j in 1..#tx] for l in 1..#ty] reduce(_+,a) else b:List(X):=concat[[dot2(g,tx.j,ty.l)::X for j in 1..#tx] for l in 1..#ty] reduce(_+,b)
proj(p,x) == x=0 => x homogeneous? x and degree(x)=p => x a:=leadingBasisTerm(x) if degree(a)=p then leadingCoefficient(x)*a + proj(p, reductum x) else proj(p, reductum x)
conjBasisTerm(x:DRC):DRC == x=0$DRC => error(err6) x ~= leadingBasisTerm(x) => error(err5) t:EAB:=drc2rea(x).1.k l:List(Integer):=exponents(t) m:List(DRC):=[generator(i)$DRC for i in 1..#l | l.i=0] m=[] => 1$DRC reduce(_*,m)
atomizeBasisTerm(x:DRC):List(DRC) == x=0$DRC => error(err6) x ~= leadingBasisTerm(x) => error(err5) t:EAB:=drc2rea(x).1.k l:List(Integer):=exponents(t) [generator(i)$DRC for i in 1..#l | l.i=1]
intProdBasisTerm(w:Vector X, x:DRC):DRC == x ~= leadingBasisTerm(x) => error(err5) degree(x)=0 => 0$DRC degree(x)=1 => w.position(x,baseForms()) * 1$DRC a:List(DRC):=atomizeBasisTerm(x) b:DRC:=reduce(_*,rest a) -- i_w is an antiderivative => intProdBasisTerm(w,a.1)*b - a.1 * intProdBasisTerm(w,b)
interiorProduct(w:Vector X, x:DRC):DRC == x=0$DRC => x leadingCoefficient(x)*intProdBasisTerm(w,leadingBasisTerm(x)) + _ interiorProduct(w, reductum(x))
lieDerivative(w:Vector X,x:DRC):DRC == a := exteriorDifferential(interiorProduct(w,x)) b := interiorProduct(w, exteriorDifferential(x)) a+b
eps(x:DRC):X == leadingCoefficient(x*conjBasisTerm(x))
hodgeStarBT(g:SMR,x:DRC):DRC == q:=sqrt(abs(determinant(g))) p:=degree(x) J:=monomials(p) s:=[eps(y)*dot(g,y,x)*conjBasisTerm(y) for y in J] q*reduce(_+,s)
hodgeStar(g:SMR,x:DRC):DRC == x=0$DRC => x leadingCoefficient(x)*hodgeStarBT(g,leadingBasisTerm(x)) + _ hodgeStar(g, reductum(x))
s(g:SMR):X == det:X:=determinant g sd:Union(Integer,"failed"):=sign(det)$ElementaryFunctionSign(Integer,X) sd case "failed" => 's?::X sd case Integer => coerce(sd)$X
invHodgeStar(g:SMR,x:DRC):DRC == x=0$DRC => x y:DRC:=leadingBasisTerm(x) k:X:=coerce(degree y)$X c:X:=s(g)*(-1)^(k*(coerce(n)$X-k)) leadingCoefficient(x)*hodgeStarBT(g,c*y) + _ invHodgeStar(g, reductum(x))
codifferential(g:SMR,x:DRC):DRC == x=0$DRC => 0 y:DRC:=leadingBasisTerm(x) k:X:=coerce(degree y)$X c:X:=s(g)*(-1)^(coerce(n)$X*(k-1)+1) c*hodgeStar(g,d hodgeStar(g,leadingCoefficient(x)*y)) + _ codifferential(g,reductum(x))
hodgeLaplacian(g:SMR,x:DRC):DRC == d codifferential(g,x)+ codifferential(g, d x)
spad
   Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7780364366861049302-25px001.spad
      using old system compiler.
   DFORM abbreviates package DifferentialForms 
------------------------------------------------------------------------
   initializing NRLIB DFORM for DifferentialForms 
   compiling into NRLIB DFORM 
****** Domain: R already in scope
   compiling local eab2li : ExtAlgBasis -> List Integer
      DFORM;eab2li is replaced by x 
Time: 0.02 SEC.
compiling local drc2rea : DeRhamComplex(R,v) -> List Record(k: ExtAlgBasis,c: Expression R) DFORM;drc2rea is replaced by x Time: 0 SEC.
compiling exported d : DeRhamComplex(R,v) -> DeRhamComplex(R,v) Time: 0.02 SEC.
compiling exported one : () -> DeRhamComplex(R,v) Time: 0 SEC.
compiling exported zero : () -> DeRhamComplex(R,v) Time: 0 SEC.
compiling exported baseForms : () -> List DeRhamComplex(R,v) Time: 0.01 SEC.
compiling exported coordVector : () -> List Expression R Time: 0 SEC.
compiling exported coordSymbols : () -> List Symbol Time: 0 SEC.
compiling exported vectorField : Symbol -> List Expression R Time: 0.02 SEC.
compiling exported scalarField : Symbol -> Expression R Time: 0 SEC.
compiling exported covectorField : Symbol -> List DeRhamComplex(R,v) Time: 0 SEC.
compiling exported zeroForm : Symbol -> DeRhamComplex(R,v) Time: 0.01 SEC.
compiling exported * : (List Expression R,List DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.02 SEC.
compiling exported * : (List DeRhamComplex(R,v),List DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.03 SEC.
compiling exported volumeForm : SquareMatrix(# v,Expression R) -> DeRhamComplex(R,v) Time: 0.08 SEC.
compiling exported monomials : NonNegativeInteger -> List DeRhamComplex(R,v) Time: 0.01 SEC.
compiling local flip : ExtAlgBasis -> ExtAlgBasis Time: 0 SEC.
compiling local pos : (ExtAlgBasis,Integer) -> List Integer Time: 0.02 SEC.
compiling local dot1 : (SquareMatrix(# v,Expression R),Record(k: ExtAlgBasis,c: Expression R),Record(k: ExtAlgBasis,c: Expression R)) -> Expression R Time: 0.46 SEC.
compiling local dot2 : (SquareMatrix(# v,Expression R),Record(k: ExtAlgBasis,c: Expression R),Record(k: ExtAlgBasis,c: Expression R)) -> Expression R Time: 0.80 SEC.
compiling exported dot : (SquareMatrix(# v,Expression R),DeRhamComplex(R,v),DeRhamComplex(R,v)) -> Expression R Time: 0.01 SEC.
compiling exported proj : (NonNegativeInteger,DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.01 SEC.
compiling exported conjBasisTerm : DeRhamComplex(R,v) -> DeRhamComplex(R,v) Time: 0.02 SEC.
compiling exported atomizeBasisTerm : DeRhamComplex(R,v) -> List DeRhamComplex(R,v) Time: 0.02 SEC.
compiling local intProdBasisTerm : (Vector Expression R,DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.07 SEC.
compiling exported interiorProduct : (Vector Expression R,DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0 SEC.
compiling exported lieDerivative : (Vector Expression R,DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.01 SEC.
compiling local eps : DeRhamComplex(R,v) -> Expression R Time: 0 SEC.
compiling local hodgeStarBT : (SquareMatrix(# v,Expression R),DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.07 SEC.
compiling exported hodgeStar : (SquareMatrix(# v,Expression R),DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.01 SEC.
compiling exported s : SquareMatrix(# v,Expression R) -> Expression R Time: 0.04 SEC.
compiling exported invHodgeStar : (SquareMatrix(# v,Expression R),DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.15 SEC.
compiling exported codifferential : (SquareMatrix(# v,Expression R),DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0.74 SEC.
compiling exported hodgeLaplacian : (SquareMatrix(# v,Expression R),DeRhamComplex(R,v)) -> DeRhamComplex(R,v) Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |DifferentialForms| REDEFINED
;;; *** |DifferentialForms| REDEFINED Time: 0 SEC.
Semantic Errors: [1] invHodgeStar: k is BOTH a variable and a literal [2] invHodgeStar: c is BOTH a variable and a literal [3] codifferential: k is BOTH a variable and a literal [4] codifferential: c is BOTH a variable and a literal
Warnings: [1] dot1: k has no value [2] dot1: c has no value [3] dot2: k has no value [4] dot2: c has no value [5] conjBasisTerm: k has no value [6] atomizeBasisTerm: k has no value [7] s: not known that (AlgebraicallyClosedField) is of mode (CATEGORY domain (IF (has R (IntegralDomain)) (PROGN (ATTRIBUTE (AlgebraicallyClosedFunctionSpace R)) (ATTRIBUTE (TranscendentalFunctionCategory)) (ATTRIBUTE (CombinatorialOpsCategory)) (ATTRIBUTE (LiouvillianFunctionCategory)) (ATTRIBUTE (SpecialFunctionCategory)) (SIGNATURE reduce ($ $)) (SIGNATURE number? ((Boolean) $)) (IF (has R (PolynomialFactorizationExplicit)) (ATTRIBUTE (PolynomialFactorizationExplicit)) noBranch) (SIGNATURE setSimplifyDenomsFlag ((Boolean) (Boolean))) (SIGNATURE getSimplifyDenomsFlag ((Boolean)))) noBranch)) [8] s: not known that (TranscendentalFunctionCategory) is of mode (CATEGORY domain (IF (has R (IntegralDomain)) (PROGN (ATTRIBUTE (AlgebraicallyClosedFunctionSpace R)) (ATTRIBUTE (TranscendentalFunctionCategory)) (ATTRIBUTE (CombinatorialOpsCategory)) (ATTRIBUTE (LiouvillianFunctionCategory)) (ATTRIBUTE (SpecialFunctionCategory)) (SIGNATURE reduce ($ $)) (SIGNATURE number? ((Boolean) $)) (IF (has R (PolynomialFactorizationExplicit)) (ATTRIBUTE (PolynomialFactorizationExplicit)) noBranch) (SIGNATURE setSimplifyDenomsFlag ((Boolean) (Boolean))) (SIGNATURE getSimplifyDenomsFlag ((Boolean)))) noBranch)) [9] s: not known that (FunctionSpace (Integer)) is of mode (CATEGORY domain (IF (has R (IntegralDomain)) (PROGN (ATTRIBUTE (AlgebraicallyClosedFunctionSpace R)) (ATTRIBUTE (TranscendentalFunctionCategory)) (ATTRIBUTE (CombinatorialOpsCategory)) (ATTRIBUTE (LiouvillianFunctionCategory)) (ATTRIBUTE (SpecialFunctionCategory)) (SIGNATURE reduce ($ $)) (SIGNATURE number? ((Boolean) $)) (IF (has R (PolynomialFactorizationExplicit)) (ATTRIBUTE (PolynomialFactorizationExplicit)) noBranch) (SIGNATURE setSimplifyDenomsFlag ((Boolean) (Boolean))) (SIGNATURE getSimplifyDenomsFlag ((Boolean)))) noBranch))
Cumulative Statistics for Constructor DifferentialForms Time: 2.65 seconds
finalizing NRLIB DFORM Processing DifferentialForms for Browser database: --------constructor--------- --------(* ((DeRhamComplex R v) (List (Expression R)) (List (DeRhamComplex R v))))--------- --------(* ((DeRhamComplex R v) (List (DeRhamComplex R v)) (List (DeRhamComplex R v))))--------- --------(d ((DeRhamComplex R v) (DeRhamComplex R v)))--------- --------(one ((DeRhamComplex R v)))--------- --------(zero ((DeRhamComplex R v)))--------- --------(baseForms ((List (DeRhamComplex R v))))--------- --------(coordVector ((List (Expression R))))--------- --------(coordSymbols ((List (Symbol))))--------- --------(vectorField ((List (Expression R)) (Symbol)))--------- --------(scalarField ((Expression R) (Symbol)))--------- --------(covectorField ((List (DeRhamComplex R v)) (Symbol)))--------- --------(zeroForm ((DeRhamComplex R v) (Symbol)))--------- --------(volumeForm ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R))))--------- --------(conjBasisTerm ((DeRhamComplex R v) (DeRhamComplex R v)))--------- --->-->DifferentialForms((conjBasisTerm ((DeRhamComplex R v) (DeRhamComplex R v)))): Improper first word in comments: Return "Return the complement of a basis term \\spad{w}.\\spad{r}.\\spad{t}. volumeForm" --------(atomizeBasisTerm ((List (DeRhamComplex R v)) (DeRhamComplex R v)))--------- --->-->DifferentialForms((atomizeBasisTerm ((List (DeRhamComplex R v)) (DeRhamComplex R v)))): Improper first word in comments: Given "Given a basis term,{} \\spadignore{e.g.} dx*dy*du,{} atomizeBasisTerm returns a list of the generators (atoms),{} \\spadignore{i.e.} [\\spad{dx},{}dy,{}du] for our example." --------(monomials ((List (DeRhamComplex R v)) (NonNegativeInteger)))--------- --->-->DifferentialForms((monomials ((List (DeRhamComplex R v)) (NonNegativeInteger)))): Improper first word in comments: List "List of all monomials of degree \\spad{p} (\\spad{p} in 1..\\spad{n}). This is a basis for Lambda(\\spad{n},{}\\spad{p})." --------(hodgeStar ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v)))--------- --->-->DifferentialForms((hodgeStar ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v)))): Improper first word in comments: computes "computes the Hodge dual of the differential form \\% with respect to a metric \\spad{g}." --------(dot ((Expression R) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v) (DeRhamComplex R v)))--------- --->-->DifferentialForms((dot ((Expression R) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v) (DeRhamComplex R v)))): Improper first word in comments: computes "computes the inner product of two differential forms \\spad{w}.\\spad{r}.\\spad{t}. \\spad{g}" --------(proj ((DeRhamComplex R v) (NonNegativeInteger) (DeRhamComplex R v)))--------- --->-->DifferentialForms((proj ((DeRhamComplex R v) (NonNegativeInteger) (DeRhamComplex R v)))): Improper first word in comments: projection "projection to homogeneous terms of degree \\spad{p}" --------(interiorProduct ((DeRhamComplex R v) (Vector (Expression R)) (DeRhamComplex R v)))--------- --->-->DifferentialForms((interiorProduct ((DeRhamComplex R v) (Vector (Expression R)) (DeRhamComplex R v)))): Improper first word in comments: Calculates "Calculates the interior product i_X(a) of the vector field \\spad{X} with the differential form a." --------(lieDerivative ((DeRhamComplex R v) (Vector (Expression R)) (DeRhamComplex R v)))--------- --->-->DifferentialForms((lieDerivative ((DeRhamComplex R v) (Vector (Expression R)) (DeRhamComplex R v)))): Improper first word in comments: Calculates "Calculates the Lie derivative \\spad{L_X}(a) of the differential form a with respect to the vector field \\spad{X}." --------(s ((Expression R) (SquareMatrix (# v) (Expression R))))--------- --->-->DifferentialForms((s ((Expression R) (SquareMatrix (# v) (Expression R))))): Missing right pren "\\spad{s(g)} determines the sign of determinant(\\spad{g}) and is related to the signature of \\spad{g} (n=p+q,{}\\spad{t=p}-\\spad{q},{}\\spad{s=}(-)^(\\spad{n}-\\spad{t})\\spad{/2} \\spad{=>} \\spad{s=}(-)\\spad{^q}." --------(invHodgeStar ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v)))--------- --->-->DifferentialForms((invHodgeStar ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v)))): Improper initial operator in comments: is "invHodgeStar is the inverse of hodgeStar." --------(codifferential ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v)))--------- --------(hodgeLaplacian ((DeRhamComplex R v) (SquareMatrix (# v) (Expression R)) (DeRhamComplex R v)))--------- ; compiling file "/var/aw/var/LatexWiki/DFORM.NRLIB/DFORM.lsp" (written 16 JUL 2018 09:49:30 PM):
; /var/aw/var/LatexWiki/DFORM.NRLIB/DFORM.fasl written ; compilation finished in 0:00:00.232 ------------------------------------------------------------------------ DifferentialForms is now explicitly exposed in frame initial DifferentialForms will be automatically loaded when needed from /var/aw/var/LatexWiki/DFORM.NRLIB/DFORM

Test flavours

fricas
-- =======================================
DFORM tests (package DifferentialForms) -- ======================================= -- Requires: -- .... DeRhamComplex (src/derham.spad) or FriCAS 1.3 or later. -- .... DifferentialForms (dform.spad). -- Version 1.1: 09-ARP-2016 -- Version 1.2: 17-DEC-2016 -- -- FriCAS Computer Algebra System -- Version: FriCAS 1.3.0 -- Timestamp: Don Sep 29 21:26:01 CEST 2016
fricas
)set break resume
 
fricas
)expose UnittestCount UnittestAux Unittest
UnittestCount is now explicitly exposed in frame initial UnittestAux is now explicitly exposed in frame initial Unittest is now explicitly exposed in frame initial
fricas
)expose DFORM
DifferentialForms is already explicitly exposed in frame initial
----------------- testsuite "dform"
All user variables and function definitions have been cleared.
Type: Void
fricas
testcase  "all"
All user variables and function definitions have been cleared.
Type: Void
fricas
-----------------
----------- -- Setup -- -----------
n:=7 -- dim of base space (n>=2 !), may change in course

\label{eq1}7(1)
Type: PositiveInteger?
fricas
N:=91 -- number of tests

\label{eq2}91(2)
Type: PositiveInteger?
fricas
O ==> OutputForm
Type: Void
fricas
-- HodgeStar package for DERHAM(R,v)
R:=Integer  -- Ring

\label{eq3}\hbox{\axiomType{Integer}\ }(3)
Type: Type
fricas
v:=[subscript(x,[j::OutputForm]) for j in 1..n] -- (x_1,..,x_n)

\label{eq4}\left[{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}\right](4)
Type: List(Symbol)
fricas
M:=DFORM(R,v)

\label{eq5}\hbox{\axiomType{DifferentialForms}\ } (\hbox{\axiomType{Integer}\ } , [ x [ 1 ] , x [ 2 ] , x [ 3 ] , x [ 4 ] , x [ 5 ] , x [ 6 ] , x [ 7 ] ])(5)
Type: Type
fricas
-- basis 1-forms and coordinate vector
dx:=baseForms()$M     -- [dx[1],...,dx[n]]

\label{eq6}\left[{dx_{1}}, \:{dx_{2}}, \:{dx_{3}}, \:{dx_{4}}, \:{dx_{5}}, \:{dx_{6}}, \:{dx_{7}}\right](6)
Type: List(DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4],x[5],x[6],x[7]]))
fricas
x:=coordVector()$M    -- [x[1],...,x[n]]

\label{eq7}\left[{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}\right](7)
Type: List(Expression(Integer))
fricas
xs:=coordSymbols()$M  -- as above but as List Symbol (for differentiate, D)

\label{eq8}\left[{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}\right](8)
Type: List(Symbol)
fricas
-- operator, vector field, scalar field, symbol
a:=operator 'a         -- operator

\label{eq9}a(9)
Type: BasicOperator?
fricas
b:=vectorField(b)$M    -- generic vector field [b1(x1..xn),...,bn(x1..xn)]

\label{eq10}\begin{array}{@{}l}
\displaystyle
\left[{{b_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{b_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{b_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{5}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{b_{6}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{7}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}\right] 
(10)
Type: List(Expression(Integer))
fricas
c:=vectorField(c)$M

\label{eq11}\begin{array}{@{}l}
\displaystyle
\left[{{c_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{c_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{c_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{c_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{c_{5}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{c_{6}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{c_{7}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}\right] 
(11)
Type: List(Expression(Integer))
fricas
P:=scalarField(P)$M    -- scalar field P(x1,..,xn)

\label{eq12}P \left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)(12)
Type: Expression(Integer)
fricas
-- (pseudo-) random form & zeroForm
rd:=reduce(_*,[dx.j for j in 1..random(n)$NNI+1])

\label{eq13}{dx_{1}}\ {dx_{2}}\ {dx_{3}}\ {dx_{4}}\ {dx_{5}}(13)
Type: DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4],x[5],x[6],x[7]])
fricas
nf:=zeroForm(nf)$M

\label{eq14}nf \left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)(14)
Type: DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4],x[5],x[6],x[7]])
fricas
-- metric
g:=diagonalMatrix([1 for i in 1..n])$SquareMatrix(n,EXPR R)  -- Euclidean

\label{eq15}\left[ 
\begin{array}{ccccccc}
1 & 0 & 0 & 0 & 0 & 0 & 0 
\
0 & 1 & 0 & 0 & 0 & 0 & 0 
\
0 & 0 & 1 & 0 & 0 & 0 & 0 
\
0 & 0 & 0 & 1 & 0 & 0 & 0 
\
0 & 0 & 0 & 0 & 1 & 0 & 0 
\
0 & 0 & 0 & 0 & 0 & 1 & 0 
\
0 & 0 & 0 & 0 & 0 & 0 & 1 
(15)
Type: SquareMatrix?(7,Expression(Integer))
fricas
h:=diagonalMatrix(c)$SquareMatrix(n,EXPR R)

\label{eq16}\left[ 
\begin{array}{ccccccc}
{{c_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}& 0 & 0 & 0 & 0 & 0 & 0 
\
0 &{{c_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}& 0 & 0 & 0 & 0 & 0 
\
0 & 0 &{{c_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}& 0 & 0 & 0 & 0 
\
0 & 0 & 0 &{{c_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}& 0 & 0 & 0 
\
0 & 0 & 0 & 0 &{{c_{5}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}& 0 & 0 
\
0 & 0 & 0 & 0 & 0 &{{c_{6}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}& 0 
\
0 & 0 & 0 & 0 & 0 & 0 &{{c_{7}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}
(16)
Type: SquareMatrix?(7,Expression(Integer))
fricas
-- vector field
vf:=vector b

\label{eq17}\begin{array}{@{}l}
\displaystyle
\left[{{b_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{b_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{b_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{5}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \:{{b_{6}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{7}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}, \:{x_{5}}, \:{x_{6}}, \:{x_{7}}}\right)}\right] 
(17)
Type: Vector(Expression(Integer))
fricas
-- Result list  
res:List(Boolean):=[false for j in 1..N]

\label{eq18}\begin{array}{@{}l}
\displaystyle
\left[  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \:  \mbox{\rm false} , \: \right.
\
\
\displaystyle
\left. \mbox{\rm false} \right] 
(18)
Type: List(Boolean)
fricas
-- 
res.1 := test (dx.1=d(x.1*one()$M))

\label{eq19} \mbox{\rm true} (19)
Type: Boolean
fricas
res.2 := test (#dx = n)

\label{eq20} \mbox{\rm true} (20)
Type: Boolean
fricas
res.3 := test (#x = n)

\label{eq21} \mbox{\rm true} (21)
Type: Boolean
fricas
res.4 := test (a x = a(x))

\label{eq22} \mbox{\rm true} (22)
Type: Boolean
fricas
res.5 := test (#b = n)

\label{eq23} \mbox{\rm true} (23)
Type: Boolean
fricas
-- null Form (i.e. degree 0)
res.6 := test (zeroForm('a)$M = a(x)*one()$M)

\label{eq24} \mbox{\rm true} (24)
Type: Boolean
fricas
res.7 := test (d zeroForm('a)$M = reduce(_+,[D(a(x),xs.i)*dx.i for i in 1..n]))

\label{eq25} \mbox{\rm true} (25)
Type: Boolean
fricas
-- products (à la Flanders, vector forms)
res.8 := test ( x*dx = reduce(_+,[x.i*dx.i for i in 1..n]))

\label{eq26} \mbox{\rm true} (26)
Type: Boolean
fricas
res.9 := test ( dx * dx = 0)

\label{eq27} \mbox{\rm true} (27)
Type: Boolean
fricas
res.10 := test ( (x*dx)*dx = -dx*(x*dx))

\label{eq28} \mbox{\rm true} (28)
Type: Boolean
fricas
-- (co-)vector field
res.11 := test (vectorField(W)$M * dx = dx * vectorField(W)$M)

\label{eq29} \mbox{\rm true} (29)
Type: Boolean
fricas
res.12 := test (typeOf(vectorField(S)$M)::O=List(Expression(R))::O)

\label{eq30} \mbox{\rm true} (30)
Type: Boolean
fricas
res.13 := test (typeOf(covectorField(K)$M)::O=List(DERHAM(R,v))::O)

\label{eq31} \mbox{\rm true} (31)
Type: Boolean
fricas
res.14 := test (typeOf(vectorField(W)$M * covectorField(K)$M)::O=DERHAM(R,v)::O)

\label{eq32} \mbox{\rm true} (32)
Type: Boolean
fricas
-- dot products w.r.t. g
res.15 := reduce(_and,[test ( dot(g,dx.j,dx.j)$M = 1) for j in 1..n])

\label{eq33} \mbox{\rm true} (33)
Type: Boolean
fricas
res.16 := reduce(_and,[test ( dot(g,dx.j,dx.(j+1))$M = 0) for j in 1..n-1])

\label{eq34} \mbox{\rm true} (34)
Type: Boolean
fricas
res.17 := reduce(_and,[test ( dot(g,dx.1*dx.j,dx.1*dx.j)$M = 1) for j in 2..n])

\label{eq35} \mbox{\rm true} (35)
Type: Boolean
fricas
res.18 := reduce(_and,[test ( dot(h,dx.j,dx.j)$M = 1/c.j) for j in 1..n])

\label{eq36} \mbox{\rm true} (36)
Type: Boolean
fricas
res.19 := reduce(_and,[test ( dot(h,dx.j,dx.(j+1))$M = 0) for j in 1..n-1])

\label{eq37} \mbox{\rm true} (37)
Type: Boolean
fricas
res.20 := reduce(_and,[test ( dot(h,dx.1*dx.j,dx.1*dx.j)$M = 1/(c.1*c.j)) _
                                  for j in 2..n])

\label{eq38} \mbox{\rm true} (38)
Type: Boolean
fricas
-- Hodge star
res.21 := test (one()$M*hodgeStar(g,1)$M = dot(g,1,1)$M * volumeForm(g)$M)

\label{eq39} \mbox{\rm true} (39)
Type: Boolean
fricas
res.22 := test (rd*hodgeStar(g,rd)$M = dot(g,rd,rd)$M * volumeForm(g)$M)

\label{eq40} \mbox{\rm true} (40)
Type: Boolean
fricas
res.23 := test (degree(hodgeStar(g,dx.n)$M) = n-1)

\label{eq41} \mbox{\rm true} (41)
Type: Boolean
fricas
res.24 := test (one()$M*hodgeStar(h,1)$M = dot(h,1,1)$M * volumeForm(h)$M)

\label{eq42} \mbox{\rm true} (42)
Type: Boolean
fricas
res.25 := test (rd*hodgeStar(h,rd)$M = dot(h,rd,rd)$M * volumeForm(h)$M)

\label{eq43} \mbox{\rm true} (43)
Type: Boolean
fricas
res.26 := test (degree(hodgeStar(h,dx.n)$M) = n-1)

\label{eq44} \mbox{\rm true} (44)
Type: Boolean
fricas
-- Projections
res.27 := test (proj(0,nf+b*dx+d(b*dx))$M = nf)

\label{eq45} \mbox{\rm true} (45)
Type: Boolean
fricas
res.28 := test (proj(1,nf+b*dx+d(b*dx))$M = b*dx)

\label{eq46} \mbox{\rm true} (46)
Type: Boolean
fricas
res.29 := test (proj(2,nf+b*dx+d(b*dx))$M = d(b*dx))

\label{eq47} \mbox{\rm true} (47)
Type: Boolean
fricas
res.30 := test (proj(n,volumeForm(g)$M)$M = volumeForm(g)$M)

\label{eq48} \mbox{\rm true} (48)
Type: Boolean
fricas
res.31 := test (proj(random(n)$NNI,volumeForm(g)$M)$M = 0)

\label{eq49} \mbox{\rm true} (49)
Type: Boolean
fricas
-- Interior product
res.32 := test (interiorProduct(vf,dx.1)$M = b.1)

\label{eq50} \mbox{\rm true} (50)
Type: Boolean
fricas
res.33 := test (interiorProduct(vf,dx.n)$M = b.n)

\label{eq51} \mbox{\rm true} (51)
Type: Boolean
fricas
res.34 := test (d interiorProduct(vf, volumeForm(g)$M)$M =  _
                 reduce(_+,[D(b.j,xs.j) for j in 1..n])*volumeForm(g)$M)

\label{eq52} \mbox{\rm true} (52)
Type: Boolean
fricas
-- Lie derivative
res.35 := test ( d interiorProduct(vf,b*dx)$M + _
                interiorProduct(vf,d(b*dx))$M = lieDerivative(vf,b*dx)$M)

\label{eq53} \mbox{\rm true} (53)
Type: Boolean
fricas
-- Version 1.2
fricas
)clear values n R v M x xs dx a b c p g h P vf 
n:=4 -- dim of base space (n>=2 !)

\label{eq54}4(54)
Type: PositiveInteger?
fricas
O ==> OutputForm
Type: Void
fricas
-- HodgeStar package for DERHAM(R,v)
R:=Integer  -- Ring

\label{eq55}\hbox{\axiomType{Integer}\ }(55)
Type: Type
fricas
v:=[subscript(x,[j::OutputForm]) for j in 1..n] -- (x_1,..,x_n)

\label{eq56}\left[{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}\right](56)
Type: List(Symbol)
fricas
M:=DFORM(R,v)

\label{eq57}\hbox{\axiomType{DifferentialForms}\ } (\hbox{\axiomType{Integer}\ } , [ x [ 1 ] , x [ 2 ] , x [ 3 ] , x [ 4 ] ])(57)
Type: Type
fricas
-- basis 1-forms and coordinate vector
dx:=baseForms()$M     -- [dx[1],...,dx[n]]

\label{eq58}\left[{dx_{1}}, \:{dx_{2}}, \:{dx_{3}}, \:{dx_{4}}\right](58)
Type: List(DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4]]))
fricas
x:=coordVector()$M    -- [x[1],...,x[n]]

\label{eq59}\left[{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}\right](59)
Type: List(Expression(Integer))
fricas
xs:=coordSymbols()$M  -- as above but as List Symbol (for differentiate, D)

\label{eq60}\left[{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}\right](60)
Type: List(Symbol)
fricas
-- operator, vector field, scalar field, symbol
a:=operator 'a         -- operator

\label{eq61}a(61)
Type: BasicOperator?
fricas
b:=vectorField(b)$M    -- generic vector field [b1(x1..xn),...,bn(x1..xn)]

\label{eq62}\begin{array}{@{}l}
\displaystyle
\left[{{b_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \:{{b_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \:{{b_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}\right] (62)
Type: List(Expression(Integer))
fricas
c:=vectorField(c)$M

\label{eq63}\begin{array}{@{}l}
\displaystyle
\left[{{c_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \:{{c_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \:{{c_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{c_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}\right] (63)
Type: List(Expression(Integer))
fricas
P:=scalarField(P)$M -- scalar field P(x1,..,xn)

\label{eq64}P \left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)(64)
Type: Expression(Integer)
fricas
-- metric
g:=diagonalMatrix([1 for i in 1..n])$SquareMatrix(n,EXPR R)  -- Euclidean

\label{eq65}\left[ 
\begin{array}{cccc}
1 & 0 & 0 & 0 
\
0 & 1 & 0 & 0 
\
0 & 0 & 1 & 0 
\
0 & 0 & 0 & 1 
(65)
Type: SquareMatrix?(4,Expression(Integer))
fricas
h:=diagonalMatrix(c)$SquareMatrix(n,EXPR R)

\label{eq66}\left[ 
\begin{array}{cccc}
{{c_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}& 0 & 0 & 0 
\
0 &{{c_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}& 0 & 0 
\
0 & 0 &{{c_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}& 0 
\
0 & 0 & 0 &{{c_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}
(66)
Type: SquareMatrix?(4,Expression(Integer))
fricas
eta:=diagonalMatrix(concat(1,[-1 for i in 2..n]))$SquareMatrix(n,EXPR R)

\label{eq67}\left[ 
\begin{array}{cccc}
1 & 0 & 0 & 0 
\
0 & - 1 & 0 & 0 
\
0 & 0 & - 1 & 0 
\
0 & 0 & 0 & - 1 
(67)
Type: SquareMatrix?(4,Expression(Integer))
fricas
-- vector field
vf:=vector b

\label{eq68}\begin{array}{@{}l}
\displaystyle
\left[{{b_{1}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \:{{b_{2}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \:{{b_{3}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}, \: \right.
\
\
\displaystyle
\left.{{b_{4}}\left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}\right] (68)
Type: Vector(Expression(Integer))
fricas
-- macros
dV(g) ==> volumeForm(g)$M
Type: Void
fricas
i(X,w) ==> interiorProduct(X,w)$M
Type: Void
fricas
L(X,w) ==> lieDerivative(X,w)$M
Type: Void
fricas
** w ==> hodgeStar(g,w)$M
Type: Void
fricas
---
w:=x.1*dx.2-x.2*dx.1

\label{eq69}{{x_{1}}\ {dx_{2}}}-{{x_{2}}\ {dx_{1}}}(69)
Type: DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4]])
fricas
res.36 := test(d w = 2*dx.1*dx.2)

\label{eq70} \mbox{\rm true} (70)
Type: Boolean
fricas
res.37 := test(w*w = zero()$M)

\label{eq71} \mbox{\rm true} (71)
Type: Boolean
fricas
res.38 := test(i(vf,w) = x.1*b.2-x.2*b.1)

\label{eq72} \mbox{\rm true} (72)
Type: Boolean
fricas
res.39 := test(L(vf,w) = d i(vf,w) + i(vf,d w))

\label{eq73} \mbox{\rm true} (73)
Type: Boolean
fricas
res.40 := test(d i(vf,w) + i(vf,d w) - L(vf,w) = zero()$M)

\label{eq74} \mbox{\rm true} (74)
Type: Boolean
fricas
res.41 := test(dot(g,w,w)$M = x.1^2+x.2^2)

\label{eq75} \mbox{\rm true} (75)
Type: Boolean
fricas
-- div(b) dV
res.41 := test(d i(vf,dV(g)) = reduce(_+,[D(b.j,xs.j) for j in 1..n])*dV(g))

\label{eq76} \mbox{\rm true} (76)
Type: Boolean
fricas
res.42 := test(d (P*one()$M) = reduce(_+,[D(P,xs.j)*dx.j for j in 1..n]))

\label{eq77} \mbox{\rm true} (77)
Type: Boolean
fricas
res.43 := test(i(vf,d (P*one()$M))= reduce(_+,[D(P,xs.j)*b.j for j in 1..n])*one()$M)

\label{eq78} \mbox{\rm true} (78)
Type: Boolean
fricas
res.44 := test(1/dot(g,w,w)$M*w =  w*(1/(x.1^2+x.2^2)))

\label{eq79} \mbox{\rm true} (79)
Type: Boolean
fricas
res.45 := test(d (1/dot(g,w,w)$M*w) = zero()$M)

\label{eq80} \mbox{\rm true} (80)
Type: Boolean
fricas
---
s:=zeroForm('s)$M

\label{eq81}s \left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)(81)
Type: DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4]])
fricas
res.46 := test(d s =  totalDifferential(retract s)$DeRhamComplex(Integer,v))

\label{eq82} \mbox{\rm true} (82)
Type: Boolean
fricas
res.47 := test(d s =  totalDifferential(retract s)$typeOf(s))

\label{eq83} \mbox{\rm true} (83)
Type: Boolean
fricas
res.48 := test(d (** s) = 0$typeOf(s))

\label{eq84} \mbox{\rm true} (84)
Type: Boolean
fricas
res.49 := test(dot(g,** ( d s),w*dx.2*dx.3)$M = x.2*D(retract s, xs.4))

\label{eq85} \mbox{\rm true} (85)
Type: Boolean
fricas
res.50 := test(d (** ( d s)) = reduce(_+,[D(retract s,xs.j,2) for j in 1..n])*dV(g))

\label{eq86} \mbox{\rm true} (86)
Type: Boolean
fricas
r:=sin(x.1*x.2)*one()$M

\label{eq87}\sin \left({{x_{1}}\ {x_{2}}}\right)(87)
Type: DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4]])
fricas
res.51 := test(d r = x.1*cos(x.1*x.2)*dx.2+x.2*cos(x.1*x.2)*dx.1)

\label{eq88} \mbox{\rm true} (88)
Type: Boolean
fricas
res.52 := test(d (** ( d r)) = -(x.1^2+x.2^2)*sin(x.1*x.2)*dV(g))

\label{eq89} \mbox{\rm true} (89)
Type: Boolean
fricas
res.53 := test(** (d (** ( d r))) = -(x.1^2+x.2^2)*sin(x.1*x.2))

\label{eq90} \mbox{\rm true} (90)
Type: Boolean
fricas
res.53 := test(** (d (** ( d r)))::EXPR INT = retract (** (d (** ( d r)))))

\label{eq91} \mbox{\rm true} (91)
Type: Boolean
fricas
res.54 := test(eval(** (d (** ( d r)))::EXPR INT,xs.1=%pi) = (-%pi^2-x.2^2)*sin(%pi*x.2))

\label{eq92} \mbox{\rm true} (92)
Type: Boolean
fricas
res.55 := test(eval(eval(** (d (** ( d r)))::EXPR INT,xs.1=%pi) ,xs.2=%pi)=-2*%pi^2*sin(%pi^2))

\label{eq93} \mbox{\rm true} (93)
Type: Boolean
fricas
a(P)*one()$M

\label{eq94}a \left({P \left({{x_{1}}, \:{x_{2}}, \:{x_{3}}, \:{x_{4}}}\right)}\right)(94)
Type: DeRhamComplex?(Integer,[x[1],x[2],x[3],x[4]])
fricas
-- chain diff
res.56 := test(d (a(P)*one()$M) =  eval(D(a(t),'t),t=P)*d (P*one()$M))

\label{eq95} \mbox{\rm true} (95)
Type: Boolean
fricas
res.57 := test(** invHodgeStar(g,w)$M = w)

\label{eq96} \mbox{\rm true} (96)
Type: Boolean
fricas
res.58 := test(invHodgeStar(g,** w)$M = w)

\label{eq97} \mbox{\rm true} (97)
Type: Boolean
fricas
res.59 := test(** invHodgeStar(g,** w + dx.1)$M = ** w + dx.1)

\label{eq98} \mbox{\rm true} (98)
Type: Boolean
fricas
res.60 := test( ** dV(g) = invHodgeStar(g,dV(g))$M)

\label{eq99} \mbox{\rm true} (99)
Type: Boolean
fricas
res.61 := test(** dV(h) ~= invHodgeStar(h,dV(g))$M)

\label{eq100} \mbox{\rm true} (100)
Type: Boolean
fricas
res.62 := test( dot(h,w,w)$M = (c.2*x.2^2+c.1*x.1^2)/(c.1*c.2))

\label{eq101} \mbox{\rm true} (101)
Type: Boolean
fricas
res.63 := test( s(g)$M = 1)

\label{eq102} \mbox{\rm true} (102)
Type: Boolean
fricas
res.64 := test( s(eta)$M = -1)

\label{eq103} \mbox{\rm true} (103)
Type: Boolean
fricas
res.65 := test( s(h)$M = 's? )

\label{eq104} \mbox{\rm true} (104)
Type: Boolean
fricas
-- https://en.wikipedia.org/wiki/Hodge_dual
-- Four dimensions
res.66 := test( hodgeStar(eta,dx.1)$M = dx.2*dx.3*dx.4)

\label{eq105} \mbox{\rm true} (105)
Type: Boolean
fricas
res.67 := test( hodgeStar(eta,dx.2)$M = dx.1*dx.3*dx.4)

\label{eq106} \mbox{\rm true} (106)
Type: Boolean
fricas
res.68 := test( hodgeStar(eta,dx.3)$M = dx.1*dx.4*dx.2)

\label{eq107} \mbox{\rm true} (107)
Type: Boolean
fricas
res.69 := test( hodgeStar(eta,dx.4)$M = dx.1*dx.2*dx.3)

\label{eq108} \mbox{\rm true} (108)
Type: Boolean
fricas
res.70 := test( hodgeStar(eta,dx.1*dx.2)$M = dx.4*dx.3)

\label{eq109} \mbox{\rm true} (109)
Type: Boolean
fricas
res.71 := test( hodgeStar(eta,dx.1*dx.3)$M = dx.2*dx.4)

\label{eq110} \mbox{\rm true} (110)
Type: Boolean
fricas
res.72 := test( hodgeStar(eta,dx.1*dx.4)$M = dx.3*dx.2)

\label{eq111} \mbox{\rm true} (111)
Type: Boolean
fricas
res.73 := test( hodgeStar(eta,dx.2*dx.3)$M = dx.1*dx.4)

\label{eq112} \mbox{\rm true} (112)
Type: Boolean
fricas
res.74 := test( hodgeStar(eta,dx.2*dx.4)$M = dx.3*dx.1)

\label{eq113} \mbox{\rm true} (113)
Type: Boolean
fricas
res.75 := test( hodgeStar(eta,dx.3*dx.4)$M = dx.1*dx.2)

\label{eq114} \mbox{\rm true} (114)
Type: Boolean
fricas
-- codifferential: (delta=(-)^degree(x)*invHodgeStar(g, d hodgeStar(g,x))
res.76 := test(codifferential(g,s*dx.1)$M = -D(retract s,xs.1)*one()$M)

\label{eq115} \mbox{\rm true} (115)
Type: Boolean
fricas
res.77 := test(codifferential(g,P*dx.2)$M = -D(P,xs.2)*one()$M)

\label{eq116} \mbox{\rm true} (116)
Type: Boolean
fricas
res.78 := test(codifferential(g,s*P*dx.1*dx.2)$M = _
    (-P*D(retract s,xs.1)-s*D(P,xs.1))*dx.2+_
    (P*D(retract s,xs.2)+s*D(P,xs.2))*dx.1)

\label{eq117} \mbox{\rm true} (117)
Type: Boolean
fricas
res.79 := test(codifferential(g,P*w)$M = x.2*D(P,xs.1)*one()$M -_
     x.1*D(P,xs.2)*one()$M)

\label{eq118} \mbox{\rm true} (118)
Type: Boolean
fricas
res.80 := test(codifferential(g,P*w)$M = _
    (-1)^degree(w)*invHodgeStar(g, d hodgeStar(g,P*w)$M)$M)

\label{eq119} \mbox{\rm true} (119)
Type: Boolean
fricas
res.81 := test(codifferential(eta,P*w)$M = _
    (-1)^degree(w)*invHodgeStar(eta, d hodgeStar(eta,P*w)$M)$M)

\label{eq120} \mbox{\rm true} (120)
Type: Boolean
fricas
res.82 := test(codifferential(h,P*w)$M = _
    (-1)^degree(w)*invHodgeStar(h, d hodgeStar(h,P*w)$M)$M)

\label{eq121} \mbox{\rm true} (121)
Type: Boolean
fricas
res.83 := test(codifferential(h,P*w*dx.3)$M = _
    (-1)^degree(w*dx.3)*invHodgeStar(h, d hodgeStar(h,P*w*dx.3)$M)$M)

\label{eq122} \mbox{\rm true} (122)
Type: Boolean
fricas
-- the codifferential \delta is (sort of) the adjoint to the differential.
-- This doesn’t quite hold, but we can show that it does hold “up to homology”.
-- We can calculate their difference times the canonical volume form:
res.84 := test((dot(g,d w, dx.1*dx.2)$M -_
    dot(g,w,codifferential(g,dx.1*dx.2)$M)$M)*dV(g)=
    d (w*hodgeStar(g,dx.1*dx.2)$M))

\label{eq123} \mbox{\rm true} (123)
Type: Boolean
fricas
res.85 := test((dot(eta,d w, dx.1*dx.2)$M -_
    dot(eta,w,codifferential(eta,dx.1*dx.2)$M)$M)*dV(eta)=
    d (w*hodgeStar(eta,dx.1*dx.2)$M))

\label{eq124} \mbox{\rm true} (124)
Type: Boolean
fricas
res.86 := test(hodgeLaplacian(g,w*(** w))$M = -4 * dV(g))

\label{eq125} \mbox{\rm true} (125)
Type: Boolean
fricas
res.87 := test(hodgeLaplacian(eta,w*(hodgeStar(eta,w)$M))$M = 4 * dV(eta))

\label{eq126} \mbox{\rm true} (126)
Type: Boolean
fricas
res.88 := test(hodgeLaplacian(h,w*(hodgeStar(h,w)$M))$M =_
    d codifferential(h,w*hodgeStar(h,w)$M)$M)

\label{eq127} \mbox{\rm true} (127)
Type: Boolean
fricas
res.89 := test(d(vf*dx) *  (** d(vf*dx))=dot(g,d(vf*dx),d(vf*dx))$M*dV(g))

\label{eq128} \mbox{\rm true} (128)
Type: Boolean
fricas
-- next is inequality because ** = hodgeStar w.r.t to metric g!
res.90 := test(d(vf*dx) *  (** d(vf*dx))~=dot(eta,d(vf*dx),d(vf*dx))$M*dV(eta))

\label{eq129} \mbox{\rm true} (129)
Type: Boolean
fricas
-- correct is:
res.91 := test(d(vf*dx)*hodgeStar(eta,d(vf*dx))$M=_
    dot(eta,d(vf*dx),d(vf*dx))$M*dV(eta))

\label{eq130} \mbox{\rm true} (130)
Type: Boolean
fricas
-------------
-- Results --
-------------
fricas
)version
Value = "FriCAS 1.3.4 compiled at Wed Jun 27 14:53:01 UTC 2018"
fricas
)lisp (lisp-implementation-type)
Value = "SBCL"
fricas
)lisp (lisp-implementation-version)
Value = "1.1.1"
res

\label{eq131}\begin{array}{@{}l}
\displaystyle
\left[  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} , \right.
\
\
\displaystyle
\left.\:  \mbox{\rm true} , \:  \mbox{\rm true} , \:  \mbox{\rm true} \right] (131)
Type: List(Boolean)
fricas
reduce(_and,res)

\label{eq132} \mbox{\rm true} (132)
Type: Boolean
fricas
-- dummy statistics
[testEquals("res." string(j),"true") for j in 1..N];
Type: List(Void)
fricas
statistics()
============================================================================= General WARNINGS: * do not use ')clear completely' before having used 'statistics()' It clears the statistics without warning! * do not forget to pass the arguments of the testXxxx functions as Strings! Otherwise, the test will fail and statistics() will not notice! * testLibraryError does not prevent FriCAS from aborting the current block. Thus, if a block contains other test functions, they will not be executed and statistics() will not notice!
============================================================================= Testsuite: dform failed (total): 0 (1)
============================================================================= testsuite | testcases: failed (total) | tests: failed (total) dform 0 (1) 0 (91) ============================================================================= File summary. unexpected failures: 0 expected failures: 0 unexpected passes: 0 total tests: 91
Type: Void

Some changes necessary: use vectors instead of lists, ...




  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: