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

Edit detail for Aldor JetBundle revision 1 of 1

1
Editor: 127.0.0.1
Time: 2007/11/11 11:56:29 GMT-8
Note: transferred from axiom-developer

changed:
-
!VectorField (VF)

Vector fields and one-form over jet bundles

\begin{axiom}
)lib JBC JBC-
)lib JBFC JBFC-
)lib SEM
\end{axiom}

\begin{spad}
)abb domain     VF       VectorField

I    ==> Integer
PI   ==> PositiveInteger
NNI  ==> NonNegativeInteger
Sy   ==> Symbol
L    ==> List
B    ==> Boolean
M    ==> Matrix
MD   ==> Matrix D
JBC  ==> JetBundleCategory
JBFC ==> JetBundleFunctionCategory
VF   ==> VectorField(JB,D)
OUT  ==> OutputForm

Indep  ==> "Indep"::Sy
Dep    ==> "Dep"::Sy
errmsg ==> "not base vector field in prolong"


-- ---------------- --
-- VectorField (VF) --
-- ---------------- --

++ Description:
++ \axiom{VectorField(JB,D)} implements vector fields over the jet bundle
++ \axiom{JB} with coefficients from \axiom{D}. The fields operate on functions
++ from \axiom{D}.

VectorField(JB:JBC, D:JBFC JB) : Cat == Def where


  Cat ==> Module(D) with

    diff : JB -> $
      ++ \axiom{diff(jb)} returns the base vector field in direction \axiom{jb}.

    diffX : PI -> $
      ++ \axiom{diffX(i)} returns the base vector field in direction \axiom{X(i)}.

    diffU : PI -> $
      ++ \axiom{diffU(i)} returns the base vector field in direction \axiom{U(i)}.

    diffP : (PI,L NNI) -> $
      ++ \axiom{diffP(i,mu)} returns the base vector field in direction 
      ++ \axiom{P(i,mu)}.

    coefficients : $ -> L D
      ++ \axiom{coefficients(v)} yields the coefficients of \axiom{v}.

    directions : $ -> L JB
      ++ \axiom{directions(v)} yields the directions of the base vectors where
      ++ \axiom{v} has non-vanishing coefficients.

    coefficient : ($,JB) -> D
      ++ \axiom{coefficient(v,jb)} returns the coefficient of \axiom{v} in
      ++ direction \axiom{jb}.

    copy : $ -> $
      ++ \axiom{copy(v)} returns a copy of the vector field \axiom{v}.

    commutator : ($,$) -> $
      ++ \axiom{commutator(v,w)} calculates the commutator of two vector fields.

    table : L $ -> M $
      ++ \axiom{table(lv)} computes the commutator table for a given list of
      ++ vector fields.

    lie : ($,$) -> $
      ++ \axiom{lie(v,w)} calculates the Lie derivative of \axiom{w} with
      ++ respect to \axiom{v}. (This yields the commutator of the fields.)

    eval : ($,D) -> D
      ++ \axiom{eval(v,f)} applies the vector field \axiom{v} to the function
      ++ \axiom{f}.

    prolong : ($,NNI) -> $
      ++ \axiom{prolong(v,q)} prolongs a vector field \axiom{v} defined on the
      ++ base space into the jet bundle of order \axiom{q}.


  Def ==> add

    nn:PI := numIndVar()$JB
    mm:PI := numDepVar()$JB
    -- global variables with the numbers of variables


    -- -------------- --
    -- Representation --
    -- -------------- --

    Rep := Record(Coeff:L D, Dir:L JB)


    diff(jb:JB):$ == [[1],[jb]]


    diffX(i:PI):$ == diff X(i)$JB


    diffU(i:PI):$ == diff U(i)$JB


    diffP(i:PI,mu:L NNI):$ == diff P(i,mu)$JB


    monom(c:D,jb:JB):OUT ==
      one? c => sub(message("D"),jb::OUT)
      c::OUT * sub(message("D"),jb::OUT)


    coerce(v:$):OUT ==
      empty? v.Dir => 0$D ::OUT
      one?(#v.Dir) => monom(first v.Coeff, first v.Dir)
      reduce("+", [monom(c,jb) for c in v.Coeff for jb in v.Dir])


    coefficients(v:$):L D == copy v.Coeff


    directions(v:$):L JB == copy v.Dir


    coefficient(v:$,jb:JB):D ==
      pos := position(jb,v.Dir)
      pos < minIndex(v.Dir) => 0
      qelt(v.Coeff,pos)


    copy(v:$):$ == [copy v.Coeff, copy v.Dir]


    -- ---------- --
    -- Arithmetic --
    -- ---------- --

    0:$ == [empty, empty]


    zero?(v:$):B == empty? v.Dir


    - v:$ == [[-$D c  for c in v.Coeff], v.Dir]


    v:$ + w:$ ==
      zero? v => w
      zero? w => v
      lc2:L D := copy w.Coeff
      lj2:L JB := copy w.Dir
      resC:L D := empty
      resJ:L JB := empty

      for c1 in v.Coeff  for j1 in v.Dir repeat
        while not empty?(lj2) and first(lj2)<j1 repeat
          resC := cons(first lc2, resC)
          resJ := cons(first lj2, resJ)
          lc2 := rest lc2
          lj2 := rest lj2
        if not empty?(lj2) and first(lj2)=j1 then
          sum := c1 +$D first lc2
          if not zero? sum then
            resC := cons(sum,resC)
            resJ := cons(j1,resJ)
          lc2 := rest lc2
          lj2 := rest lj2
        else
          resC := cons(c1,resC)
          resJ := cons(j1,resJ)

      [concat!(reverse! resC, lc2), concat!(reverse! resJ, lj2)]


    f:D * v:$ ==
      zero? f => 0
      [[f *$D c  for c in v.Coeff], v.Dir]


    -- ------------ --
    -- Prolongation --
    -- ------------ --

    prolong(v:$,q:NNI):$ ==
      zero? q => v
      dirs := directions v
      coeffs := coefficients v
      xi:L D := empty
      eta:L D := empty
      ind1:L PI := empty
      ind2:L PI := empty

      for jv in dirs  for co in coeffs repeat
        jt := type jv
        if jt=Indep then
          xi := cons(co,xi)
          ind1 := cons(index(jv),ind1)
        else if jt=Dep then
          eta := cons(co,eta)
          ind2 := cons(index(jv),ind2)
        else
          error errmsg

      dxi:MD := new(#xi,nn,0)
      for co in xi  for i in 1.. repeat
        jm := jacobiMatrix [co]
        for j in 1..nn repeat
          qsetelt!(dxi, i, j, formalDiff2(co,j::PI,jm).DPhi)

      j:I := mm
      oldCo:L D := empty
      for co in eta  for i in ind2 repeat
        while j>i repeat
          oldCo := cons(0,oldCo)
          j := j-1
        oldCo := cons(co,oldCo)
        j := j-1
      if not zero? j then
        for i in 1..j repeat
          oldCo := cons(0,oldCo)
      oldDir:L JB := [U(i::PI)  for i in 1..mm]

      res:$ := v
      for qq in 1..q repeat
        newCo:L D := empty
        newDir:L JB := empty
        for jv in oldDir  for co in oldCo repeat
          jm := jacobiMatrix [co]
          a := index jv
          mu := multiIndex jv
          for k in max(1,class(jv))..nn repeat
            newjv := differentiate(jv,k::PI)::JB
            newco := formalDiff2(co,k::PI,jm).DPhi
            for i in ind1  for j in 1.. repeat
              nu := copy mu
              qsetelt!(nu,i,qelt(nu,i)+1)
              newco := newco - qelt(dxi,j,k)*(Pm(a,nu)$JB::D)
            res := res + newco*diff(newjv)
            newCo := cons(newco,newCo)
            newDir := cons(newjv,newDir)
        oldCo := newCo
        oldDir := newDir

      res


    -- -------------------- --
    -- Geometric Operations --
    -- -------------------- --

    eval(v:$,f:D):D ==
      res:D := 0
      for c in v.Coeff  for jb in v.Dir repeat
        res := res + c*differentiate(f,jb)
      res


    commutator(v:$,w:$):$ ==
      rco:L D := empty
      rjb:L JB := empty
      for c1 in v.Coeff  for j1 in v.Dir repeat
        sum:D := 0
        for c2 in w.Coeff  for j2 in w.Dir repeat
          sum := sum + c2*differentiate(c1,j2)
        if not zero? sum then
          rco := cons(sum,rco)
          rjb := cons(j1,rjb)
      res1:$ := [reverse! rco, reverse! rjb]

      rco:L D := empty
      rjb:L JB := empty
      for c2 in w.Coeff  for j2 in w.Dir repeat
        sum:D := 0
        for c1 in v.Coeff  for j1 in v.Dir repeat
          sum := sum + c1*differentiate(c2,j1)
        if not zero? sum then
          rco := cons(sum,rco)
          rjb := cons(j2,rjb)
      res2:$ := [reverse! rco, reverse! rjb]
      res2 - res1


    table(lv:L $):M $ ==
      len := #lv
      zero? len => error "empty list in table"
      res:M $ := new(len,len,0)
      for i in 1..  until empty? lv repeat
        v1 := first lv
        lv := rest lv
        for v2 in lv  for j in (i+1).. repeat
          c := commutator(v1,v2)
          qsetelt!(res,i,j,c)
          qsetelt!(res,j,i,-c)
      res


    lie(v:$,w:$):$ == commutator(v,w)
\end{spad}


VectorField (VF)

Vector fields and one-form over jet bundles

axiom
)lib JBC JBC-
JetBundleCategory is now explicitly exposed in frame initial JetBundleCategory will be automatically loaded when needed from /var/zope2/var/LatexWiki/JBC.NRLIB/code JetBundleCategory& is now explicitly exposed in frame initial JetBundleCategory& will be automatically loaded when needed from /var/zope2/var/LatexWiki/JBC-.NRLIB/code
axiom
)lib JBFC JBFC-
JetBundleFunctionCategory is now explicitly exposed in frame initial
JetBundleFunctionCategory will be automatically loaded when needed from /var/zope2/var/LatexWiki/JBFC.NRLIB/code JetBundleFunctionCategory& is now explicitly exposed in frame initial JetBundleFunctionCategory& will be automatically loaded when needed from /var/zope2/var/LatexWiki/JBFC-.NRLIB/code
axiom
)lib SEM
SparseEchelonMatrix is now explicitly exposed in frame initial SparseEchelonMatrix will be automatically loaded when needed from /var/zope2/var/LatexWiki/SEM.NRLIB/code

spad
)abb domain     VF       VectorField
I ==> Integer PI ==> PositiveInteger NNI ==> NonNegativeInteger Sy ==> Symbol L ==> List B ==> Boolean M ==> Matrix MD ==> Matrix D JBC ==> JetBundleCategory JBFC ==> JetBundleFunctionCategory VF ==> VectorField(JB,D) OUT ==> OutputForm
Indep ==> "Indep"::Sy Dep ==> "Dep"::Sy errmsg ==> "not base vector field in prolong"
-- ---------------- -- -- VectorField (VF) -- -- ---------------- --
++ Description: ++ \axiom{VectorField(JB,D)} implements vector fields over the jet bundle ++ \axiom{JB} with coefficients from \axiom{D}. The fields operate on functions ++ from \axiom{D}.
VectorField(JB:JBC, D:JBFC JB) : Cat == Def where
Cat ==> Module(D) with
diff : JB -> $ ++ \axiom{diff(jb)} returns the base vector field in direction \axiom{jb}.
diffX : PI -> $ ++ \axiom{diffX(i)} returns the base vector field in direction \axiom{X(i)}.
diffU : PI -> $ ++ \axiom{diffU(i)} returns the base vector field in direction \axiom{U(i)}.
diffP : (PI,L NNI) -> $ ++ \axiom{diffP(i,mu)} returns the base vector field in direction ++ \axiom{P(i,mu)}.
coefficients : $ -> L D ++ \axiom{coefficients(v)} yields the coefficients of \axiom{v}.
directions : $ -> L JB ++ \axiom{directions(v)} yields the directions of the base vectors where ++ \axiom{v} has non-vanishing coefficients.
coefficient : ($,JB) -> D ++ \axiom{coefficient(v,jb)} returns the coefficient of \axiom{v} in ++ direction \axiom{jb}.
copy : $ -> $ ++ \axiom{copy(v)} returns a copy of the vector field \axiom{v}.
commutator : ($,$) -> $ ++ \axiom{commutator(v,w)} calculates the commutator of two vector fields.
table : L $ -> M $ ++ \axiom{table(lv)} computes the commutator table for a given list of ++ vector fields.
lie : ($,$) -> $ ++ \axiom{lie(v,w)} calculates the Lie derivative of \axiom{w} with ++ respect to \axiom{v}. (This yields the commutator of the fields.)
eval : ($,D) -> D ++ \axiom{eval(v,f)} applies the vector field \axiom{v} to the function ++ \axiom{f}.
prolong : ($,NNI) -> $ ++ \axiom{prolong(v,q)} prolongs a vector field \axiom{v} defined on the ++ base space into the jet bundle of order \axiom{q}.
Def ==> add
nn:PI := numIndVar()$JB mm:PI := numDepVar()$JB -- global variables with the numbers of variables
-- -------------- -- -- Representation -- -- -------------- --
Rep := Record(Coeff:L D, Dir:L JB)
diff(jb:JB):$ == [[1],[jb]]
diffX(i:PI):$ == diff X(i)$JB
diffU(i:PI):$ == diff U(i)$JB
diffP(i:PI,mu:L NNI):$ == diff P(i,mu)$JB
monom(c:D,jb:JB):OUT == one? c => sub(message("D"),jb::OUT) c::OUT * sub(message("D"),jb::OUT)
coerce(v:$):OUT == empty? v.Dir => 0$D ::OUT one?(#v.Dir) => monom(first v.Coeff, first v.Dir) reduce("+", [monom(c,jb) for c in v.Coeff for jb in v.Dir])
coefficients(v:$):L D == copy v.Coeff
directions(v:$):L JB == copy v.Dir
coefficient(v:$,jb:JB):D == pos := position(jb,v.Dir) pos < minIndex(v.Dir) => 0 qelt(v.Coeff,pos)
copy(v:$):$ == [copy v.Coeff, copy v.Dir]
-- ---------- -- -- Arithmetic -- -- ---------- --
0:$ == [empty, empty]
zero?(v:$):B == empty? v.Dir
- v:$ == [[-$D c for c in v.Coeff], v.Dir]
v:$ + w:$ == zero? v => w zero? w => v lc2:L D := copy w.Coeff lj2:L JB := copy w.Dir resC:L D := empty resJ:L JB := empty
for c1 in v.Coeff for j1 in v.Dir repeat while not empty?(lj2) and first(lj2)<j1 repeat resC := cons(first lc2, resC) resJ := cons(first lj2, resJ) lc2 := rest lc2 lj2 := rest lj2 if not empty?(lj2) and first(lj2)=j1 then sum := c1 +$D first lc2 if not zero? sum then resC := cons(sum,resC) resJ := cons(j1,resJ) lc2 := rest lc2 lj2 := rest lj2 else resC := cons(c1,resC) resJ := cons(j1,resJ)
[concat!(reverse! resC, lc2), concat!(reverse! resJ, lj2)]
f:D * v:$ == zero? f => 0 [[f *$D c for c in v.Coeff], v.Dir]
-- ------------ -- -- Prolongation -- -- ------------ --
prolong(v:$,q:NNI):$ == zero? q => v dirs := directions v coeffs := coefficients v xi:L D := empty eta:L D := empty ind1:L PI := empty ind2:L PI := empty
for jv in dirs for co in coeffs repeat jt := type jv if jt=Indep then xi := cons(co,xi) ind1 := cons(index(jv),ind1) else if jt=Dep then eta := cons(co,eta) ind2 := cons(index(jv),ind2) else error errmsg
dxi:MD := new(#xi,nn,0) for co in xi for i in 1.. repeat jm := jacobiMatrix [co] for j in 1..nn repeat qsetelt!(dxi, i, j, formalDiff2(co,j::PI,jm).DPhi)
j:I := mm oldCo:L D := empty for co in eta for i in ind2 repeat while j>i repeat oldCo := cons(0,oldCo) j := j-1 oldCo := cons(co,oldCo) j := j-1 if not zero? j then for i in 1..j repeat oldCo := cons(0,oldCo) oldDir:L JB := [U(i::PI) for i in 1..mm]
res:$ := v for qq in 1..q repeat newCo:L D := empty newDir:L JB := empty for jv in oldDir for co in oldCo repeat jm := jacobiMatrix [co] a := index jv mu := multiIndex jv for k in max(1,class(jv))..nn repeat newjv := differentiate(jv,k::PI)::JB newco := formalDiff2(co,k::PI,jm).DPhi for i in ind1 for j in 1.. repeat nu := copy mu qsetelt!(nu,i,qelt(nu,i)+1) newco := newco - qelt(dxi,j,k)*(Pm(a,nu)$JB::D) res := res + newco*diff(newjv) newCo := cons(newco,newCo) newDir := cons(newjv,newDir) oldCo := newCo oldDir := newDir
res
-- -------------------- -- -- Geometric Operations -- -- -------------------- --
eval(v:$,f:D):D == res:D := 0 for c in v.Coeff for jb in v.Dir repeat res := res + c*differentiate(f,jb) res
commutator(v:$,w:$):$ == rco:L D := empty rjb:L JB := empty for c1 in v.Coeff for j1 in v.Dir repeat sum:D := 0 for c2 in w.Coeff for j2 in w.Dir repeat sum := sum + c2*differentiate(c1,j2) if not zero? sum then rco := cons(sum,rco) rjb := cons(j1,rjb) res1:$ := [reverse! rco, reverse! rjb]
rco:L D := empty rjb:L JB := empty for c2 in w.Coeff for j2 in w.Dir repeat sum:D := 0 for c1 in v.Coeff for j1 in v.Dir repeat sum := sum + c1*differentiate(c2,j1) if not zero? sum then rco := cons(sum,rco) rjb := cons(j2,rjb) res2:$ := [reverse! rco, reverse! rjb] res2 - res1
table(lv:L $):M $ == len := #lv zero? len => error "empty list in table" res:M $ := new(len,len,0) for i in 1.. until empty? lv repeat v1 := first lv lv := rest lv for v2 in lv for j in (i+1).. repeat c := commutator(v1,v2) qsetelt!(res,i,j,c) qsetelt!(res,j,i,-c) res
lie(v:$,w:$):$ == commutator(v,w)
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/4786114993957910587-25px002.spad using 
      old system compiler.
   VF abbreviates domain VectorField 
   processing macro definition I ==> Integer 
processing macro definition PI ==> PositiveInteger
processing macro definition NNI ==> NonNegativeInteger
processing macro definition Sy ==> Symbol
processing macro definition L ==> List
processing macro definition B ==> Boolean
processing macro definition M ==> Matrix
processing macro definition MD ==> Matrix D
processing macro definition JBC ==> JetBundleCategory
processing macro definition JBFC ==> JetBundleFunctionCategory
processing macro definition VF ==> VectorField(JB,D)
processing macro definition OUT ==> OutputForm
processing macro definition Indep ==> ::(Indep,Sy)
processing macro definition Dep ==> ::(Dep,Sy)
processing macro definition errmsg ==> not base vector field in prolong
processing macro definition Cat ==> -- the constructor category processing macro definition Def ==> -- the constructor capsule ------------------------------------------------------------------------ initializing NRLIB VF for VectorField compiling into NRLIB VF compiling exported diff : JB -> $ Time: 0.12 SEC.
compiling exported diffX : PositiveInteger -> $ Time: 0 SEC.
compiling exported diffU : PositiveInteger -> $ Time: 0 SEC.
compiling exported diffP : (PositiveInteger,List NonNegativeInteger) -> $ Time: 0 SEC.
compiling local monom : (D,JB) -> OutputForm Time: 0.01 SEC.
compiling exported coerce : $ -> OutputForm Time: 0.16 SEC.
compiling exported coefficients : $ -> List D Time: 0.01 SEC.
compiling exported directions : $ -> List JB Time: 0 SEC.
compiling exported coefficient : ($,JB) -> D Time: 0.06 SEC.
compiling exported copy : $ -> $ Time: 0.01 SEC.
compiling exported Zero : () -> $ VF;Zero;$;11 is replaced by CONS Time: 0.02 SEC.
compiling exported zero? : $ -> Boolean Time: 0.01 SEC.
compiling exported - : $ -> $ Time: 0.01 SEC.
compiling exported + : ($,$) -> $ Time: 0.13 SEC.
compiling exported * : (D,$) -> $ Time: 0.02 SEC.
compiling exported prolong : ($,NonNegativeInteger) -> $ Time: 0.27 SEC.
compiling exported eval : ($,D) -> D Time: 0.02 SEC.
compiling exported commutator : ($,$) -> $ Time: 0.13 SEC.
compiling exported table : List $ -> Matrix $ Time: 0.04 SEC.
compiling exported lie : ($,$) -> $ Time: 0 SEC.
(time taken in buildFunctor: 1)
;;; *** |VectorField| REDEFINED
;;; *** |VectorField| REDEFINED Time: 0.01 SEC.
Warnings: [1] +: resC has no value [2] +: lc2 has no value [3] +: resJ has no value [4] +: lj2 has no value [5] prolong: xi has no value [6] prolong: not known that (Ring) is of mode (CATEGORY domain (SIGNATURE diff ($ JB)) (SIGNATURE diffX ($ (PositiveInteger))) (SIGNATURE diffU ($ (PositiveInteger))) (SIGNATURE diffP ($ (PositiveInteger) (List (NonNegativeInteger)))) (SIGNATURE coefficients ((List D) $)) (SIGNATURE directions ((List JB) $)) (SIGNATURE coefficient (D $ JB)) (SIGNATURE copy ($ $)) (SIGNATURE commutator ($ $ $)) (SIGNATURE table ((Matrix $) (List $))) (SIGNATURE lie ($ $ $)) (SIGNATURE eval (D $ D)) (SIGNATURE prolong ($ $ (NonNegativeInteger)))) [7] prolong: eta has no value [8] prolong: ind2 has no value [9] prolong: oldCo has no value [10] prolong: ind1 has no value [11] commutator: rco has no value [12] commutator: rjb has no value [13] table: not known that (Ring) is of mode (CATEGORY domain (SIGNATURE diff ($ JB)) (SIGNATURE diffX ($ (PositiveInteger))) (SIGNATURE diffU ($ (PositiveInteger))) (SIGNATURE diffP ($ (PositiveInteger) (List (NonNegativeInteger)))) (SIGNATURE coefficients ((List D) $)) (SIGNATURE directions ((List JB) $)) (SIGNATURE coefficient (D $ JB)) (SIGNATURE copy ($ $)) (SIGNATURE commutator ($ $ $)) (SIGNATURE table ((Matrix $) (List $))) (SIGNATURE lie ($ $ $)) (SIGNATURE eval (D $ D)) (SIGNATURE prolong ($ $ (NonNegativeInteger))))
Cumulative Statistics for Constructor VectorField Time: 1.03 seconds
finalizing NRLIB VF Processing VectorField for Browser database: --------(diff ($ JB))--------- --------(diffX ($ PI))--------- --------(diffU ($ PI))--------- --------(diffP ($ PI (L NNI)))--------- --------(coefficients ((L D) $))--------- --------(directions ((L JB) $))--------- --------(coefficient (D $ JB))--------- --------(copy ($ $))--------- --------(commutator ($ $ $))--------- --------(table ((M $) (L $)))--------- --------(lie ($ $ $))--------- --------(eval (D $ D))--------- --------(prolong ($ $ NNI))--------- --------constructor--------- ------------------------------------------------------------------------ VectorField is now explicitly exposed in frame initial VectorField will be automatically loaded when needed from /var/zope2/var/LatexWiki/VF.NRLIB/code