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

Edit detail for IndexedJetBundle revision 1 of 1

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

changed:
-
!IndexedJetBundle (IJB)

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

\begin{spad}
)abb domain     IJB    IndexedJetBundle
++ Description: 
++ \axiomType{JetBundle} provides the standard implementation for a jet bundle
++ with a given number of dependent and independent variables.

V    ==> Vector
B    ==> Boolean
Sy   ==> Symbol
BOP  ==> BasicOperator
I    ==> Integer
PI   ==> PositiveInteger
NNI  ==> NonNegativeInteger
L    ==> List
EI   ==> Expression Integer
OUT  ==> OutputForm
JBC  ==> JetBundleCategory

Const    ==> "Const"::Sy
Indep    ==> "Indep"::Sy
Dep      ==> "Dep"::Sy
Deriv    ==> "Deriv"::Sy
Multi    ==> "Multi"::Sy
Repeated ==> "Repeated"::Sy
DerMode  ==> [Multi,Repeated]@L Sy


IndexedJetBundle(x,u,p,n,m) : Cat == Def where

  x,u,p : Sy
  m,n   : PI


  Cat ==> JBC


  Def ==> add

    Rep := L NNI
      -- The list has length 2 for independent variables, length n+2 for 
      -- derivatives and dependent variables. The first entry is zero for 1, 
      -- one for independent, two for dependent variables and three for 
      -- derivatives.  The second entry is the upper index, the rest the 
      -- multi-index.

    notation:Sy := Repeated
      -- Global variable for notation.


    setNotation(s:Sy):Sy ==
      not member?(s,DerMode) => error "Unknown notation"
      t := notation
      notation := s
      t


    getNotation():Sy == notation


    multiIndex(jv:$):L NNI == copy rest rest jv::Rep


    index(jv:$):PI == first(rest jv)::PI


    type(jv:$):Sy ==
      t := first jv
      zero? t => Const
      one? t => Indep
      t=2 => Dep
      Deriv


    CheckZeroIndex(il:L NNI):B ==
      -- Local function; checks, whether multi-index is zero.
      for i in il repeat
        if not zero? i then return false
      true


    X(up:PI):$ == 
      up>n => error errmsg2
      [1,up::NNI]


    U(up:PI):$ == 
      up>m => error errmsg2
      cons(2, cons(up::NNI, [0$NNI  for i in 1..n]))


    Pm(up:PI,lo:L NNI):$ ==
      up>m => error errmsg2
      #lo^=n => error errmsg1
      CheckZeroIndex(lo) => U(up) 
      cons(3,cons(up::NNI,lo))


    1 : $ == [0,1]


    numIndVar():PI == n


    numDepVar():PI == m


    -- ----------- --
    -- Output Form --
    -- ----------- --

    name(jv:$):Sy ==
      (jt:=type(jv))=Const => "1"::Sy
      jt=Indep =>
        n>1 => superscript(x,[index(jv)::OUT])
        x
      jt=Dep =>
        m>1 => superscript(u,[index(jv)::OUT])
        u
      getNotation()=Multi =>
        m>1 => script(p, _
               [[bracket commaSeparate [i::OUT  for i in multiIndex jv]], _
                [index(jv)::OUT], [], [], []])
        subscript(p, _
                  [bracket commaSeparate [i::OUT  for i in multiIndex jv]])
      m>1 => script(p, _
               [[blankSeparate [j::OUT  for j in repeatedIndex jv]], _
                [index(jv)::OUT], [], [], []])
      subscript(p, [blankSeparate [j::OUT  for j in repeatedIndex jv]])
        

    -- Coerce to Symbol looses all information; therefore
    -- all important data like type and indices are saved
    -- as arguments of an operator

    opdisp(l:L OUT):OUT == first l


    coerce(jv:$):EI ==
      -- Name of operator must be unique and the same as jv::Sy
      -- to allow to differentiate and substitute in EI.
      type(jv)=Const => 1
      opname:Sy := name jv
      jop := operator(opname)$BOP
      display(jop,opdisp)
      tmp:None := coerce(jv)$NoneFunctions1($)
      jop := setProperty(jop,"%symbol",tmp)$BOP
      tmp := coerce(weight(jv))$NoneFunctions1(NNI)
      jop := setProperty(jop,"%weight",tmp)$BOP
      tmp := coerce(type(jv))$NoneFunctions1(Sy)
      jop := setProperty(jop,"%jet",tmp)$BOP
      if getNotation()=Multi then
        arg := [i::EI  for i in multiIndex jv]
      else
        arg := [j::EI  for j in repeatedIndex jv]
      arg := concat!([opname::EI,index(jv)::EI], arg)
      kernel(jop,arg)
\end{spad}


IndexedJetBundle (IJB)

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

spad
)abb domain     IJB    IndexedJetBundle
++ Description: 
++ \axiomType{JetBundle} provides the standard implementation for a jet bundle
++ with a given number of dependent and independent variables.
V ==> Vector B ==> Boolean Sy ==> Symbol BOP ==> BasicOperator I ==> Integer PI ==> PositiveInteger NNI ==> NonNegativeInteger L ==> List EI ==> Expression Integer OUT ==> OutputForm JBC ==> JetBundleCategory
Const ==> "Const"::Sy Indep ==> "Indep"::Sy Dep ==> "Dep"::Sy Deriv ==> "Deriv"::Sy Multi ==> "Multi"::Sy Repeated ==> "Repeated"::Sy DerMode ==> [Multi,Repeated]@L Sy
IndexedJetBundle(x,u,p,n,m) : Cat == Def where
x,u,p : Sy m,n : PI
Cat ==> JBC
Def ==> add
Rep := L NNI -- The list has length 2 for independent variables, length n+2 for -- derivatives and dependent variables. The first entry is zero for 1, -- one for independent, two for dependent variables and three for -- derivatives. The second entry is the upper index, the rest the -- multi-index.
notation:Sy := Repeated -- Global variable for notation.
setNotation(s:Sy):Sy == not member?(s,DerMode) => error "Unknown notation" t := notation notation := s t
getNotation():Sy == notation
multiIndex(jv:$):L NNI == copy rest rest jv::Rep
index(jv:$):PI == first(rest jv)::PI
type(jv:$):Sy == t := first jv zero? t => Const one? t => Indep t=2 => Dep Deriv
CheckZeroIndex(il:L NNI):B == -- Local function; checks, whether multi-index is zero. for i in il repeat if not zero? i then return false true
X(up:PI):$ == up>n => error errmsg2 [1,up::NNI]
U(up:PI):$ == up>m => error errmsg2 cons(2, cons(up::NNI, [0$NNI for i in 1..n]))
Pm(up:PI,lo:L NNI):$ == up>m => error errmsg2 #lo^=n => error errmsg1 CheckZeroIndex(lo) => U(up) cons(3,cons(up::NNI,lo))
1 : $ == [0,1]
numIndVar():PI == n
numDepVar():PI == m
-- ----------- -- -- Output Form -- -- ----------- --
name(jv:$):Sy == (jt:=type(jv))=Const => "1"::Sy jt=Indep => n>1 => superscript(x,[index(jv)::OUT]) x jt=Dep => m>1 => superscript(u,[index(jv)::OUT]) u getNotation()=Multi => m>1 => script(p, _ [[bracket commaSeparate [i::OUT for i in multiIndex jv]], _ [index(jv)::OUT], [], [], []]) subscript(p, _ [bracket commaSeparate [i::OUT for i in multiIndex jv]]) m>1 => script(p, _ [[blankSeparate [j::OUT for j in repeatedIndex jv]], _ [index(jv)::OUT], [], [], []]) subscript(p, [blankSeparate [j::OUT for j in repeatedIndex jv]])
-- Coerce to Symbol looses all information; therefore -- all important data like type and indices are saved -- as arguments of an operator
opdisp(l:L OUT):OUT == first l
coerce(jv:$):EI == -- Name of operator must be unique and the same as jv::Sy -- to allow to differentiate and substitute in EI. type(jv)=Const => 1 opname:Sy := name jv jop := operator(opname)$BOP display(jop,opdisp) tmp:None := coerce(jv)$NoneFunctions1($) jop := setProperty(jop,"%symbol",tmp)$BOP tmp := coerce(weight(jv))$NoneFunctions1(NNI) jop := setProperty(jop,"%weight",tmp)$BOP tmp := coerce(type(jv))$NoneFunctions1(Sy) jop := setProperty(jop,"%jet",tmp)$BOP if getNotation()=Multi then arg := [i::EI for i in multiIndex jv] else arg := [j::EI for j in repeatedIndex jv] arg := concat!([opname::EI,index(jv)::EI], arg) kernel(jop,arg)
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/2771267939938826525-25px002.spad using 
      old system compiler.
   IJB abbreviates domain IndexedJetBundle 
   processing macro definition V ==> Vector 
processing macro definition B ==> Boolean
processing macro definition Sy ==> Symbol
processing macro definition BOP ==> BasicOperator
processing macro definition I ==> Integer
processing macro definition PI ==> PositiveInteger
processing macro definition NNI ==> NonNegativeInteger
processing macro definition L ==> List
processing macro definition EI ==> Expression Integer
processing macro definition OUT ==> OutputForm
processing macro definition JBC ==> JetBundleCategory
processing macro definition Const ==> ::(Const,Sy)
processing macro definition Indep ==> ::(Indep,Sy)
processing macro definition Dep ==> ::(Dep,Sy)
processing macro definition Deriv ==> ::(Deriv,Sy)
processing macro definition Multi ==> ::(Multi,Sy)
processing macro definition Repeated ==> ::(Repeated,Sy)
processing macro definition DerMode ==> @(construct(Multi,Repeated),L Sy)
processing macro definition Cat ==> JetBundleCategory processing macro definition Def ==> -- the constructor capsule ------------------------------------------------------------------------ initializing NRLIB IJB for IndexedJetBundle compiling into NRLIB IJB compiling exported setNotation : Symbol -> Symbol Time: 0.13 SEC.
compiling exported getNotation : () -> Symbol Time: 0 SEC.
compiling exported multiIndex : $ -> List NonNegativeInteger Time: 0 SEC.
compiling exported index : $ -> PositiveInteger Time: 0 SEC.
compiling exported type : $ -> Symbol Time: 0.01 SEC.
compiling local CheckZeroIndex : List NonNegativeInteger -> Boolean Time: 0.01 SEC.
compiling exported X : PositiveInteger -> $ Time: 0.01 SEC.
compiling exported U : PositiveInteger -> $ Time: 0.08 SEC.
compiling exported Pm : (PositiveInteger,List NonNegativeInteger) -> $ Time: 0.04 SEC.
compiling exported One : () -> $ IJB;One;$;10 is replaced by LIST01 Time: 0 SEC.
compiling exported numIndVar : () -> PositiveInteger Time: 0 SEC.
compiling exported numDepVar : () -> PositiveInteger Time: 0 SEC.
compiling exported name : $ -> Symbol Time: 0.08 SEC.
compiling local opdisp : List OutputForm -> OutputForm IJB;opdisp is replaced by SPADfirst Time: 0.02 SEC.
compiling exported coerce : $ -> Expression Integer Time: 0.38 SEC.
(time taken in buildFunctor: 0)
;;; *** |IndexedJetBundle| REDEFINED
;;; *** |IndexedJetBundle| REDEFINED Time: 0 SEC.
Cumulative Statistics for Constructor IndexedJetBundle Time: 0.76 seconds
finalizing NRLIB IJB Processing IndexedJetBundle for Browser database: --->-->IndexedJetBundle(): Missing Description ------------------------------------------------------------------------ IndexedJetBundle is now explicitly exposed in frame initial IndexedJetBundle will be automatically loaded when needed from /var/zope2/var/LatexWiki/IJB.NRLIB/code