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

JetBundleCategory (JBC)

spad
)abb category   JBC    JetBundleCategory
V ==> Vector B ==> Boolean Sy ==> Symbol BOP ==> BasicOperator I ==> Integer PI ==> PositiveInteger NNI ==> NonNegativeInteger L ==> List EI ==> Expression Integer OUT ==> OutputForm JBC ==> JetBundleCategory
errmsg1 ==> "Improper multi-index" errmsg2 ==> "Improper upper index" errmsg3 ==> "Integration not possible" errmsg4 ==> "illegal symbol in JetBundle" Const ==> "Const"::Sy Indep ==> "Indep"::Sy Dep ==> "Dep"::Sy Deriv ==> "Deriv"::Sy Multi ==> "Multi"::Sy Repeated ==> "Repeated"::Sy DerMode ==> [Multi,Repeated]@L Sy
++ Description: ++ \axiomType{JetBundleCategory} provides basic data structures and ++ procedures for jet bundles. Nearly all necessary functions are implemented ++ already here. Only the representation and functions which direct access ++ to it must be implemented in a domain. ++ Two notations of derivatives are supported. Default is multi-index ++ notation, where the i-th entry of the index denotes the number of ++ differentiations taken with respect to \axiom{x^i}. In repeated index ++ notation each entry \axiom{i} in the index denotes a differentiation ++ with respect to \axiom{x^i}. The choice affects, however, only in- ++ and output. Internally, multi-index notation is used throughout.
JetBundleCategory() : Category == Def where
Def ==> Join(OrderedSet,CoercibleTo EI) with
setNotation : Sy -> Sy ++ \axiom{setNotation(s)} chooses the notation used for derivatives. ++ Returns the old value.
getNotation : () -> Sy ++ \axiom{getNotation()} shows the currently used notation.
multiIndex : $ -> L NNI ++ \axiom{multiIndex(jv)} returns the multi-index of the jet ++ variable \axiom{jv}.
repeatedIndex : $ -> L PI ++ \axiom{repeatedIndex(jv)} returns the multi-index of the jet ++ variable \axiom{jv} in repeated index notation.
r2m : L PI -> L NNI ++ \axiom{r2m(ind)} transforms a repeated index into a multi-index.
m2r : L NNI -> L PI ++ \axiom{m2r(ind)} transforms a multi-index into a repeated index.
allRepeated : L NNI -> L L PI ++ \axiom{allRepeated(ind)} returns a list of all possible realizations ++ of a given multi-index as repeated index.
index : $ -> PI ++ \axiom{index(jv)} yields number of the jet variable \axiom{jv}.
type : $ -> Sy ++ \axiom{type(jv)} yields the type (\axiom{Const,Indep,Dep,Deriv}) ++ of the jet variable \axiom{jv}.
name : $ -> Sy ++ \axiom{name(jv)} yields the name of the jet variable \axiom{jv}.
class : L NNI -> NNI ++ \axiom{class(ind)} yields the class of the multi-index \axiom{ind} ++ (Position for first non-vanishing entry).
class : $ -> NNI ++ \axiom{class(jv)} yields the class of the jet variable \axiom{jv} ++ (Class of multi-index for derivative, 0 else).
order : $ -> NNI ++ \axiom{order(jv)} yields the order of the jet variable \axiom{jv} ++ (Order as derivative).
weight : $ -> NNI ++ \axiom{weight(jv)} assigns each jet variable a unique integer ++ reflecting its position in the internal ordering. The variable with ++ the greater weight is also greater in this ordering.
">" : ($,$) -> B ++ \axiom{jv1>jv2} checks whether \axiom{jv1} is greater than ++ \axiom{jv2} in the internal ordering.
differentiate : ($,PI) -> Union($,"0") ++ \axiom{differentiate(jv,i)} differentiates \axiom{jv} wrt the ++ \axiom{i}-th independent variable.
derivativeOf? : ($,$) -> L NNI ++ \axiom{derivativeOf?(jv1,jv2)} checks whether \axiom{jv1} is a ++ derivative of \axiom{jv2}. In this case, the difference of their ++ multi-indices is returned. Otherwise, an empty list is returned.
integrateIfCan : ($,PI) -> Union($,"failed") ++ \axiom{integrate(jv,i)} integrated \axiom{jv} wrt the \axiom{i}-th ++ independent variable, if possible.
integrate : ($,PI) -> $ ++ \axiom{integrate(jv,i)} is like \axiom{integrateIfCan(jv,i)} but ++ yields an error, if the integration is not possible.
X : PI -> $ ++ \axiom{X(i)} generates the \axiom{i}-th independent variable. U : PI -> $ ++ \axiom{U(i)} generates the \axiom{i}-th dependent variable. P : (PI,L NNI) -> $ ++ \axiom{P(i,ind)} generates the derivative of the \axiom{i}-th ++ dependent variable wrt the index \axiom{ind}. Whether \axiom{ind} ++ is interpreted as multi-index or as repeated index depends on the ++ chosen notation. Pm : (PI,L NNI) -> $ ++ \axiom{Pm(i,ind)} is like \axiom{P(i,ind)} but \axiom{ind} is ++ always a multi-index. Pr : (PI,L PI) -> $ ++ \axiom{Pr(i,ind)} is like \axiom{P(i,ind)} but \axiom{ind} is ++ always a repeated index.
1 : () -> $ ++ \axiom{1} generates the special "jet variable" 1, which is ++ needed for the representation of linear functions.
one? : $ -> B ++ \axiom{one?(jv)} checks whether the jet variables \axiom{jv} ++ is the special variable 1.
-- For the special cases of only one independent or only one dependent -- variable simpler calls are provided. X : () -> $ ++ \axiom{X()} generates the only independent variable. U : () -> $ ++ \axiom{U()} generates the only dependent variable. P : L NNI -> $ ++ \axiom{P(ind)} generates the derivative of the only dependent ++ variable wrt the index \axiom{ind}. P : (PI,NNI) -> $ ++ \axiom{P(i,j)} generates the \axiom{j}-th derivative of the ++ \axiom{i}-th independent variable wrt the only independent ++ variable. P : NNI -> $ ++ \axiom{P(i)} generates the \axiom{i}-th derivative of the only ++ dependent variable wrt the only independent variable.
variables : NNI -> L $ ++ \axiom{variables(q)} computes the list of all jet variables up to ++ order \axiom{q}.
variables : (NNI,PI) -> L $ ++ \axiom{variables(q,c)} computes all jet variables of order \axiom{q} ++ whose class is greater than or equal to \axiom{c}.
dimJ : NNI -> NNI ++ \axiom{dimJ(q)} computes the (fibre) dimension of the \axiom{q}-th ++ order jet bundle.
dimS : NNI -> NNI ++ \axiom{dimS(q)} computes dimension of SqT x VE ++ (= number of derivatives of order \axiom{q}).
numIndVar : () -> PI ++ \axiom{numIndVar} returns the number of independent variables.
numDepVar : () -> PI ++ \axiom{numDepVar} returns the number of dependent variables.
add
-- Default section. -- The only procedures not implemented are: -- multiIndex, index, type, name, X, U, Pm (generic case) -- coerce, numIndVar, numDepVar, setNotation, getNotation
-- global constants for parameters of jet bundle nn:PI := numIndVar() mm:PI := numDepVar()
m2r(mi:L NNI):L PI == ri:L PI := empty k:PI := 1 for i in mi repeat for j in 1..i repeat ri := cons(k,ri) k := k+1 ri
r2m(ri:L PI):L NNI == mi:L NNI := new(numIndVar(),0) for i in ri repeat i>nn => error errmsg1 mi.i := 1 + mi.i mi
allRepeated(mu:L NNI):L L PI == res:L L PI := empty for i in 1..nn for k in mu repeat if not zero? k then nu := copy mu nu.i := (k - 1)::NNI tmp := allRepeated nu res := concat!(res, map(cons(i::PI,#1),tmp)) empty? res => [empty$(L PI)] res
repeatedIndex(jv:$):L PI == m2r multiIndex jv
-- ---------------- -- -- Simple Functions -- -- ---------------- --
class(l:L NNI):NNI == res:PI := 1 for i in l while zero? i repeat res := res+1 res
class(jv:$):NNI == type(jv)^=Deriv => 0 class multiIndex jv
order(jv:$):NNI == type(jv)^=Deriv => 0 sum:NNI := 0 for i in multiIndex jv repeat sum := sum+i sum
dimJ(q:NNI):NNI == mm*binomial(q+nn,nn)$Integer ::NNI
dimS(q:NNI):NNI == mm*binomial(q+nn-1,nn-1)$Integer ::NNI
X():$ == X(1)
U():$ == U(1)
P(lo:L NNI):$ == P(1,lo)
P(up:PI,lo:NNI):$ == Pm(up,[lo])
P(lo:NNI):$ == Pm(1,[lo])
P(up:PI,lo:L NNI):$ == getNotation()=Multi => Pm(up,lo) lop:L PI := empty for i in lo repeat zero? i => error errsmg1 lop := cons(i::PI,lop) Pr(up,reverse! lop)
Pr(up:PI,lo:L PI):$ == Pm(up,r2m lo)
coerce(jv:$):OUT == name(jv)::OUT
-- ---------- -- -- Dimensions -- -- ---------- --
dimJV:V NNI := new(1,mm) dimSV:V NNI := new(1,mm) mn:Integer := minIndex dimJV -- global vectors with already computed dimensions
dimJ(q:NNI):NNI == q<#dimJV => res := qelt(dimJV,mn+q) res>0 => res res := mm*binomial(q+nn,nn)$Integer ::NNI qsetelt!(dimJV,mn+q,res) res oldJV := copy dimJV dimJV := new(q+1,0) for qq in mn..mn+#oldJV-1 repeat qsetelt!(dimJV,qq,qelt(oldJV,qq)) res := mm*binomial(q+nn,nn)$Integer ::NNI qsetelt!(dimJV,mn+q,res) res
dimS(q:NNI):NNI == q<#dimSV => res := qelt(dimSV,mn+q) res>0 => res res := mm*binomial(q+nn-1,nn-1)$Integer ::NNI qsetelt!(dimSV,mn+q,res) res oldSV := copy dimSV dimSV := new(q+1,0) for qq in mn..mn+#oldSV-1 repeat qsetelt!(dimSV,qq,qelt(oldSV,qq)) res := mm*binomial(q+nn-1,nn-1)$Integer ::NNI qsetelt!(dimSV,mn+q,res) res
-- --------------- -- -- Differentiation -- -- --------------- --
differentiate(jv:$,i:PI):Union($,"0") == i>nn => error errmsg2 jt := type jv jt=Const => "0" jt=Indep => index(jv)=i => 1 "0" getNotation()=Multi => mind := multiIndex jv setelt(mind,i,elt(mind,i-1+minIndex(mind))+1) Pm(index jv, mind) rind := repeatedIndex jv empty? rind => Pr(index jv,[i]) nind:L PI := empty while not empty? rind while first(rind)>i repeat nind := cons(first(rind),nind) rind := rest rind nind := concat!(reverse!(nind),cons(i,rind)) Pr(index jv,nind)
derivativeOf?(jv1:$,jv2:$):L NNI == type(jv1)^=Deriv => empty jt := type jv2 jt^=Deriv and jt^=Dep => empty index(jv1)^=index(jv2) => empty res:L NNI := empty for i1 in multiIndex(jv1) for i2 in multiIndex(jv2) repeat i1<i2 => return empty res := cons((i1-i2)::NNI,res) reverse! res
integrateIfCan(jv:$,i:PI):Union($,"failed") == i>nn => error errmsg2 type(jv)^=Deriv => "failed" getNotation()=Multi => mind := multiIndex jv pos := i-1+minIndex mind mi := qelt(mind,pos) zero? mi => "failed" setelt(mind,pos,(mi-1)::NNI) Pm(index jv, mind) rind := repeatedIndex jv pos := position(i,rind) pos < minIndex rind => "failed" rind := delete(rind,pos) Pr(index jv, rind)
integrate(jv:$,i:PI):$ == ji := integrateIfCan(jv,i) ji case "failed" => error errmsg3 ji::$
-- -------- -- -- Ordering -- -- -------- --
weight(jv:$):NNI == t := type jv t=Const => 0 t=Indep => index jv t=Dep => (nn+1)*index(jv) pos := nn+1 res := pos*index(jv) for i in repeatedIndex jv repeat pos := pos*(nn+1) res := res + i*pos res
one?(jv:$) == type(jv)=Const
jv1:$ = jv2:$ == t1 := type jv1 t1=Const => type(jv2)=Const t1=Indep => type(jv2)=Indep => index(jv1)=index(jv2) false index(jv1)=index(jv2) and multiIndex(jv1)=multiIndex(jv2)
jv1:$ < jv2:$ == -- Implements a total degree and class respecting ordering. -- More efficient than weight(jv1)<weight(jv2). t1 := type jv1 t2 := type jv2 t2=Const => false t1=Const => true t1=Indep => t2=Indep => index(jv1)<index(jv2) true t1=Dep => t2=Indep => false t2=Dep => index(jv1)<index(jv2) true (t2=Indep) or (t2=Dep) => false o1 := order jv1 o2 := order jv2 o1=o2 => for i1 in multiIndex(jv1) for i2 in multiIndex(jv2) repeat if i1^=i2 then return i1>i2 index(jv1)<index(jv2) o1<o2
jv1:$ > jv2:$ == jv2<jv1
-- --------- -- -- Variables -- -- --------- --
variables(q:NNI):L $ == -- Generates all jet variables up to order q with the exception of 1. zero? q => [X(i::PI) for i in nn..1 by -1]
OIndList:L L PI := [[i::PI] for i in 1..nn] IndList:L L PI := [[i::PI] for i in nn..1 by -1]
for qq in 2..q repeat NIndList:L L PI := empty for ind in OIndList repeat for j in first(ind)..nn repeat NIndList := cons(cons(j::PI,ind),NIndList) OIndList := reverse NIndList IndList := concat!(NIndList,IndList)
JV:L $ := empty for ind in IndList repeat for k in 1..mm repeat JV := cons(Pr(k::PI,ind),JV) concat!(concat!([X(i::PI) for i in 1..nn], _ [U(i::PI) for i in 1..mm]), JV)
variables(q:NNI,c:PI):L $ == zero? q => empty
OIndList:L L PI := [[i::PI] for i in c..nn] for qq in 2..q repeat NIndList:L L PI := empty for ind in OIndList repeat for j in first(ind)..nn repeat NIndList := cons(cons(j::PI,ind),NIndList) OIndList := reverse! NIndList
JV:L $ := empty for ind in OIndList repeat for k in 1..mm repeat JV := cons(Pr(k::PI,ind),JV) JV
spad
   Compiling FriCAS source code from file 
      /var/zope2/var/LatexWiki/5426965944036736280-25px001.spad using 
      old system compiler.
   JBC abbreviates category JetBundleCategory 
   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 errmsg1 ==> Improper multi-index
processing macro definition errmsg2 ==> Improper upper index
processing macro definition errmsg3 ==> Integration not possible
processing macro definition errmsg4 ==> illegal symbol in JetBundle
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 Def ==> -- the constructor capsule ------------------------------------------------------------------------ initializing NRLIB JBC for JetBundleCategory compiling into NRLIB JBC
;;; *** |JetBundleCategory| REDEFINED Time: 0.10 SEC.
JBC- abbreviates domain JetBundleCategory& ------------------------------------------------------------------------ initializing NRLIB JBC- for JetBundleCategory& compiling into NRLIB JBC- compiling exported m2r : List NonNegativeInteger -> List PositiveInteger Time: 0.23 SEC.
compiling exported r2m : List PositiveInteger -> List NonNegativeInteger Time: 0.06 SEC.
compiling exported allRepeated : List NonNegativeInteger -> List List PositiveInteger Time: 0.05 SEC.
compiling exported repeatedIndex : S -> List PositiveInteger Time: 0.01 SEC.
compiling exported class : List NonNegativeInteger -> NonNegativeInteger Time: 0 SEC.
compiling exported class : S -> NonNegativeInteger Time: 0.03 SEC.
compiling exported order : S -> NonNegativeInteger Time: 0.08 SEC.
compiling exported dimJ : NonNegativeInteger -> NonNegativeInteger Time: 0.01 SEC.
compiling exported dimS : NonNegativeInteger -> NonNegativeInteger Time: 0 SEC.
compiling exported X : () -> S Time: 0 SEC.
compiling exported U : () -> S Time: 0 SEC.
compiling exported P : List NonNegativeInteger -> S Time: 0.01 SEC.
compiling exported P : (PositiveInteger,NonNegativeInteger) -> S Time: 0 SEC.
compiling exported P : NonNegativeInteger -> S Time: 0 SEC.
compiling exported P : (PositiveInteger,List NonNegativeInteger) -> S Time: 0.03 SEC.
compiling exported Pr : (PositiveInteger,List PositiveInteger) -> S Time: 0.01 SEC.
compiling exported coerce : S -> OutputForm Time: 0.01 SEC.
compiling exported dimJ : NonNegativeInteger -> NonNegativeInteger Time: 0.03 SEC.
compiling exported dimS : NonNegativeInteger -> NonNegativeInteger Time: 0.11 SEC.
compiling exported differentiate : (S,PositiveInteger) -> Union(S,0) Time: 0.06 SEC.
compiling exported derivativeOf? : (S,S) -> List NonNegativeInteger Time: 0.02 SEC.
compiling exported integrateIfCan : (S,PositiveInteger) -> Union(S,failed) Time: 0.06 SEC.
compiling exported integrate : (S,PositiveInteger) -> S Time: 0.01 SEC.
compiling exported weight : S -> NonNegativeInteger Time: 0.01 SEC.
compiling exported one? : S -> Boolean Time: 0.01 SEC.
compiling exported = : (S,S) -> Boolean Time: 0.02 SEC.
compiling exported < : (S,S) -> Boolean Time: 0.10 SEC.
compiling exported > : (S,S) -> Boolean Time: 0.01 SEC.
compiling exported variables : NonNegativeInteger -> List S Time: 0.08 SEC.
compiling exported variables : (NonNegativeInteger,PositiveInteger) -> List S Time: 0.06 SEC.
(time taken in buildFunctor: 1)
;;; *** |JetBundleCategory&| REDEFINED Time: 0.01 SEC.
Warnings: [1] allRepeated: res has no value [2] P: lop has no value
Cumulative Statistics for Constructor JetBundleCategory& Time: 1.12 seconds
finalizing NRLIB JBC- Processing JetBundleCategory& for Browser database: --------(setNotation (Sy Sy))--------- --------(getNotation (Sy))--------- --------(multiIndex ((L NNI) $))--------- --------(repeatedIndex ((L PI) $))--------- --------(r2m ((L NNI) (L PI)))--------- --------(m2r ((L PI) (L NNI)))--------- --------(allRepeated ((L (L PI)) (L NNI)))--------- --------(index (PI $))--------- --------(type (Sy $))--------- --------(name (Sy $))--------- --------(class (NNI (L NNI)))--------- --------(class (NNI $))--------- --------(order (NNI $))--------- --------(weight (NNI $))--------- --------(> (B $ $))--------- --------(differentiate ((Union $ 0) $ PI))--------- --------(derivativeOf? ((L NNI) $ $))--------- --------(integrateIfCan ((Union $ failed) $ PI))--------- --------(integrate ($ $ PI))--------- --------(X ($ PI))--------- --------(U ($ PI))--------- --------(P ($ PI (L NNI)))--------- --------(Pm ($ PI (L NNI)))--------- --------(Pr ($ PI (L PI)))--------- --------((One) ($))--------- --------(one? (B $))--------- --------(X ($))--------- --------(U ($))--------- --------(P ($ (L NNI)))--------- --------(P ($ PI NNI))--------- --------(P ($ NNI))--------- --------(variables ((L $) NNI))--------- --------(variables ((L $) NNI PI))--------- --------(dimJ (NNI NNI))--------- --------(dimS (NNI NNI))--------- --------(numIndVar (PI))--------- --------(numDepVar (PI))--------- --------constructor--------- ------------------------------------------------------------------------ JetBundleCategory& is now explicitly exposed in frame initial JetBundleCategory& will be automatically loaded when needed from /var/zope2/var/LatexWiki/JBC-.NRLIB/code finalizing NRLIB JBC Processing JetBundleCategory for Browser database: --------(setNotation (Sy Sy))--------- --------(getNotation (Sy))--------- --------(multiIndex ((L NNI) $))--------- --------(repeatedIndex ((L PI) $))--------- --------(r2m ((L NNI) (L PI)))--------- --------(m2r ((L PI) (L NNI)))--------- --------(allRepeated ((L (L PI)) (L NNI)))--------- --------(index (PI $))--------- --------(type (Sy $))--------- --------(name (Sy $))--------- --------(class (NNI (L NNI)))--------- --------(class (NNI $))--------- --------(order (NNI $))--------- --------(weight (NNI $))--------- --------(> (B $ $))--------- --------(differentiate ((Union $ 0) $ PI))--------- --------(derivativeOf? ((L NNI) $ $))--------- --------(integrateIfCan ((Union $ failed) $ PI))--------- --------(integrate ($ $ PI))--------- --------(X ($ PI))--------- --------(U ($ PI))--------- --------(P ($ PI (L NNI)))--------- --------(Pm ($ PI (L NNI)))--------- --------(Pr ($ PI (L PI)))--------- --------((One) ($))--------- --------(one? (B $))--------- --------(X ($))--------- --------(U ($))--------- --------(P ($ (L NNI)))--------- --------(P ($ PI NNI))--------- --------(P ($ NNI))--------- --------(variables ((L $) NNI))--------- --------(variables ((L $) NNI PI))--------- --------(dimJ (NNI NNI))--------- --------(dimS (NNI NNI))--------- --------(numIndVar (PI))--------- --------(numDepVar (PI))--------- --------constructor--------- ------------------------------------------------------------------------ JetBundleCategory is now explicitly exposed in frame initial JetBundleCategory will be automatically loaded when needed from /var/zope2/var/LatexWiki/JBC.NRLIB/code




subject:
  ( 7 subscribers )  
Please rate this page: