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

Edit detail for Jet Differential revision 1 of 1

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

changed:
-
!Differential (DIFF)

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

\begin{spad}
)abb domain     DIFF     Differential

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"

++ Description:
++ \axiom{Differential(JB,D)} implements differentials (one-forms) over the jet
++ bundle \axiom{JB} with coefficients from \axiom{D}. The differentials operate
++ on \axiom{VectorField(JB,D)}.

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


  Cat ==> Module(D) with

    d : JB -> %
      ++ \axiom{d(jb)} returns the differential of \axiom{jb}.

    dX : PI -> %
      ++ \axiom{dX(i)} returns the differential of \axiom{X(i)}.

    dU : PI -> %
      ++ \axiom{dU(i)} returns the differential of \axiom{U(i)}.

    dP : (PI,L NNI) -> %
      ++ \axiom{dP(i,mu)} returns the differential of \axiom{P(i,mu)}.

    d : D -> %
      ++ \axiom{d(f)} computes the differential of \axiom{f}.

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

    differentials : % -> L JB
      ++ \axiom{directions(om)} yields the differentials where \axiom{om} has 
      ++ non-vanishing coefficients.

    coefficient : (%,JB) -> D
      ++ \axiom{coefficient(om,jb)} returns the coefficient of \axiom{om} for
      ++ the differential of \axiom{jb}.

    copy : % -> %
      ++ \axiom{copy(om)} returns a copy of the differential \axiom{om}.

    lie : (VF,%) -> %
      ++ \axiom{lie(v,om)} calculates the Lie derivative of \axiom{om} with
      ++ respect to \axiom{v}.

    contract : (VF,%) -> D
      ++ \axiom{contract(v,om)} computes the interior derivative of \axiom{om}
      ++ with respect to \axiom{v}.

    eval : (%,VF) -> D
      ++ \axiom{eval(om,v)} applies the differential \axiom{om} to the vector
      ++ field \axiom{v}.


  Def ==> add

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

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


    d(jb:JB):% == [[1],[jb]]


    dX(i:PI):% == d X(i)$JB


    dU(i:PI):% == d U(i)$JB


    dP(i:PI,mu:L NNI):% == d P(i,mu)$JB


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


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


    coefficients(om:%):L D == copy om.Coeff


    differentials(om:%):L JB == copy om.Diff


    coefficient(om:%,jb:JB):D ==
      pos := position(jb,om.Diff)
      pos < minIndex(om.Diff) => 0
      qelt(om.Coeff,pos)


    copy(om:%):% == [copy om.Coeff, copy om.Diff]


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

    0:% == [empty, empty]


    zero?(om:%):B == empty? om.Diff


    - om:% == [[-$D c  for c in om.Coeff], om.Diff]


    om1:% + om2:% ==
      zero? om1 => om2
      zero? om2 => om1
      lc2:= copy om2.Coeff
      lj2:= copy om2.Diff
      resC := empty()$L(D)
      resJ := empty()$L(JB)

      for c1 in om1.Coeff  for j1 in om1.Diff 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 * om:% ==
      zero? f => 0
      [[f *$D c  for c in om.Coeff], om.Diff]


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

    d(f:D):% ==
      JV := reverse! jetVariables f
      empty? JV => 0
      Co:L D := [differentiate(f,jv)  for jv in JV]
      [Co,JV]


    eval(om:%,v:VF):D ==
      zero? om => 0
      zero? v => 0
      lc2:L D := copy coefficients v 
      lj2:L JB := copy directions v 
      res:= 0$D

      for c1 in om.Coeff  for j1 in om.Diff repeat
        while not empty?(lj2) and first(lj2)<j1 repeat
          lc2 := rest lc2
          lj2 := rest lj2
        if not empty?(lj2) and first(lj2)=j1 then
          res := res + c1*first(lc2)
          lc2 := rest lc2
          lj2 := rest lj2

      res


    contract(v:VF,om:%):D == eval(om,v)
\end{spad}


Differential (DIFF)

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 VF
VectorField is now explicitly exposed in frame initial VectorField will be automatically loaded when needed from /var/zope2/var/LatexWiki/VF.NRLIB/code

spad
)abb domain     DIFF     Differential
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"
++ Description: ++ \axiom{Differential(JB,D)} implements differentials (one-forms) over the jet ++ bundle \axiom{JB} with coefficients from \axiom{D}. The differentials operate ++ on \axiom{VectorField(JB,D)}.
Differential(JB:JBC, D:JBFC JB) : Cat == Def where
Cat ==> Module(D) with
d : JB -> % ++ \axiom{d(jb)} returns the differential of \axiom{jb}.
dX : PI -> % ++ \axiom{dX(i)} returns the differential of \axiom{X(i)}.
dU : PI -> % ++ \axiom{dU(i)} returns the differential of \axiom{U(i)}.
dP : (PI,L NNI) -> % ++ \axiom{dP(i,mu)} returns the differential of \axiom{P(i,mu)}.
d : D -> % ++ \axiom{d(f)} computes the differential of \axiom{f}.
coefficients : % -> L D ++ \axiom{coefficients(om)} yields the coefficients of \axiom{om}.
differentials : % -> L JB ++ \axiom{directions(om)} yields the differentials where \axiom{om} has ++ non-vanishing coefficients.
coefficient : (%,JB) -> D ++ \axiom{coefficient(om,jb)} returns the coefficient of \axiom{om} for ++ the differential of \axiom{jb}.
copy : % -> % ++ \axiom{copy(om)} returns a copy of the differential \axiom{om}.
lie : (VF,%) -> % ++ \axiom{lie(v,om)} calculates the Lie derivative of \axiom{om} with ++ respect to \axiom{v}.
contract : (VF,%) -> D ++ \axiom{contract(v,om)} computes the interior derivative of \axiom{om} ++ with respect to \axiom{v}.
eval : (%,VF) -> D ++ \axiom{eval(om,v)} applies the differential \axiom{om} to the vector ++ field \axiom{v}.
Def ==> add
-- -------------- -- -- Representation -- -- -------------- --
Rep := Record(Coeff:L D, Diff:L JB)
d(jb:JB):% == [[1],[jb]]
dX(i:PI):% == d X(i)$JB
dU(i:PI):% == d U(i)$JB
dP(i:PI,mu:L NNI):% == d P(i,mu)$JB
monom(c:D,jb:JB):OUT == one? c => hconcat(message("d"),jb::OUT) c::OUT * hconcat(message("d"),jb::OUT)
coerce(om:%):OUT == empty? om.Diff => 0$D ::OUT one?(#om.Diff) => monom(first om.Coeff, first om.Diff) reduce("+", [monom(c,jb) for c in om.Coeff for jb in om.Diff])
coefficients(om:%):L D == copy om.Coeff
differentials(om:%):L JB == copy om.Diff
coefficient(om:%,jb:JB):D == pos := position(jb,om.Diff) pos < minIndex(om.Diff) => 0 qelt(om.Coeff,pos)
copy(om:%):% == [copy om.Coeff, copy om.Diff]
-- ---------- -- -- Arithmetic -- -- ---------- --
0:% == [empty, empty]
zero?(om:%):B == empty? om.Diff
- om:% == [[-$D c for c in om.Coeff], om.Diff]
om1:% + om2:% == zero? om1 => om2 zero? om2 => om1 lc2:= copy om2.Coeff lj2:= copy om2.Diff resC := empty()$L(D) resJ := empty()$L(JB)
for c1 in om1.Coeff for j1 in om1.Diff 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 * om:% == zero? f => 0 [[f *$D c for c in om.Coeff], om.Diff]
-- -------------------- -- -- Geometric Operations -- -- -------------------- --
d(f:D):% == JV := reverse! jetVariables f empty? JV => 0 Co:L D := [differentiate(f,jv) for jv in JV] [Co,JV]
eval(om:%,v:VF):D == zero? om => 0 zero? v => 0 lc2:L D := copy coefficients v lj2:L JB := copy directions v res:= 0$D
for c1 in om.Coeff for j1 in om.Diff repeat while not empty?(lj2) and first(lj2)<j1 repeat lc2 := rest lc2 lj2 := rest lj2 if not empty?(lj2) and first(lj2)=j1 then res := res + c1*first(lc2) lc2 := rest lc2 lj2 := rest lj2
res
contract(v:VF,om:%):D == eval(om,v)
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/4404916714033905575-25px002.spad using 
      old system compiler.
   DIFF abbreviates domain Differential 
   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 DIFF for Differential compiling into NRLIB DIFF compiling exported d : JB -> $ Time: 0.03 SEC.
compiling exported dX : PositiveInteger -> $ Time: 0.01 SEC.
compiling exported dU : PositiveInteger -> $ Time: 0.06 SEC.
compiling exported dP : (PositiveInteger,List NonNegativeInteger) -> $ Time: 0.01 SEC.
compiling local monom : (D,JB) -> OutputForm Time: 0 SEC.
compiling exported coerce : $ -> OutputForm Time: 0.15 SEC.
compiling exported coefficients : $ -> List D Time: 0.01 SEC.
compiling exported differentials : $ -> List JB Time: 0 SEC.
compiling exported coefficient : ($,JB) -> D Time: 0.11 SEC.
compiling exported copy : $ -> $ Time: 0.02 SEC.
compiling exported Zero : () -> $ DIFF;Zero;$;11 is replaced by CONS Time: 0 SEC.
compiling exported zero? : $ -> Boolean Time: 0.01 SEC.
compiling exported - : $ -> $ Time: 0.01 SEC.
compiling exported + : ($,$) -> $ Time: 0.12 SEC.
compiling exported * : (D,$) -> $ Time: 0 SEC.
compiling exported d : D -> $ Time: 0.02 SEC.
compiling exported eval : ($,VectorField(JB,D)) -> D Time: 0.02 SEC.
compiling exported contract : (VectorField(JB,D),$) -> D Time: 0 SEC.
(time taken in buildFunctor: 0)
;;; *** |Differential| REDEFINED
;;; *** |Differential| REDEFINED Time: 0.01 SEC.
Cumulative Statistics for Constructor Differential Time: 0.59 seconds
finalizing NRLIB DIFF Processing Differential for Browser database: --------(d (% JB))--------- --------(dX (% PI))--------- --------(dU (% PI))--------- --------(dP (% PI (L NNI)))--------- --------(d (% D))--------- --------(coefficients ((L D) %))--------- --------(differentials ((L JB) %))--------- --------(coefficient (D % JB))--------- --------(copy (% %))--------- --------(lie (% VF %))--------- --------(contract (D VF %))--------- --------(eval (D % VF))--------- --------constructor--------- ------------------------------------------------------------------------ Differential is now explicitly exposed in frame initial Differential will be automatically loaded when needed from /var/zope2/var/LatexWiki/DIFF.NRLIB/code