diff --git a/books/bookvol10.3.pamphlet b/books/bookvol10.3.pamphlet index b93650c..ae9d33f 100644 --- a/books/bookvol10.3.pamphlet +++ b/books/bookvol10.3.pamphlet @@ -89431,6 +89431,62 @@ SparseMultivariatePolynomial(R: Ring,VarSet: OrderedSet): C == T where @ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section{domain SMTS SparseMultivariateTaylorSeries} +<>= +)set break resume +)sys rm -f SparseMultivariateTaylorSeries.output +)spool SparseMultivariateTaylorSeries.output +)set message test on +)set message auto off +)clear all +--S 1 of 10 +xts:=x::TaylorSeries Fraction Integer +--E 1 + +--S 2 of 10 +yts:=y::TaylorSeries Fraction Integer +--E 2 + +--S 3 of 10 +zts:=z::TaylorSeries Fraction Integer +--E 3 + +--S 4 of 10 +t1:=sin(xts) +--E 4 + +--S 5 of 10 +coefficient(t1,3) +--E 5 + +--S 6 of 10 +coefficient(t1,monomial(3,x)$IndexedExponents Symbol) +--E 6 + +--S 7 of 10 +t2:=sin(xts + yts) +--E 7 + +--S 8 of 10 +coefficient(t2,3) +--E 8 + +--S 9 of 10 +coefficient(t2,monomial(3,x)$IndexedExponents Symbol) +--E 9 + +--S 10 of 10 +polynomial(t2,5) +--E 10 + + +)spool +)lisp (bye) +@ +<>= +==================================================================== +SparseMultivariateTaylorSeries examples +==================================================================== +@ \pagehead{SparseMultivariateTaylorSeries}{SMTS} \pagepic{ps/v103sparsemultivariatetaylorseries.ps}{SMTS}{1.00} {\bf See}\\ @@ -89581,14 +89637,29 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ evalstream:(%,L Var,L SMP) -> StS evalstream(s:%,lv:(L Var),lsmp:(L SMP)):(ST SMP) == - scan(0,_+$SMP,map(eval(#1,lv,lsmp),s pretend StS))$ST2(SMP,SMP) + scan(0,_+$SMP, + map((z1:SMP):SMP+->eval(z1,lv,lsmp),s pretend StS))$ST2(SMP,SMP) addvariable:(Var,InnerTaylorSeries Coef) -> % addvariable(v,s) == ints := integers(0)$STT pretend ST NNI - map(monomial(#2 :: SMP,v,#1)$SMP,ints,s pretend ST Coef)$ST3(NNI,Coef,SMP) - + map((n1:NNI,c2:Coef):SMP+->monomial(c2 :: SMP,v,n1)$SMP, + ints,s pretend ST Coef)$ST3(NNI,Coef,SMP) + + -- We can extract a polynomial giving the terms of given total degree coefficient(s,n) == elt(s,n + 1)$Rep -- 1-based indexing for streams + + -- Here we have to take into account that we reduce the degree of each + -- term of the stream by a constant + coefficient(s:%,lv:List Var,ln:List NNI):% == + map ((z1:SMP):SMP +-> coefficient(z1,lv,ln),rest(s,reduce(_+,ln))) + + -- the coefficient of a particular monomial: + coefficient(s:%,m:IndexedExponents Var):Coef == + n:=leadingCoefficient(mon:=m) + while not zero?(mon:=reductum mon) repeat + n:=n+leadingCoefficient mon + coefficient(coefficient(s,n),m) --% creation of series @@ -89631,11 +89702,11 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ sortmfirst:(SMP,L Var,L %) -> % sortmfirst(p,vl,q) == - nlv : L Var := sort(#1 > #2,vl) + nlv : L Var := sort((v1:Var,v2:Var):Boolean +-> v1 > v2,vl) nq : L % := [q position$(L Var) (i,vl) for i in nlv] substvar(p,nlv,nq) - csubst(vl,q) == sortmfirst(#1,vl,q pretend L(%)) pretend StS + csubst(vl,q) == (p1:SMP):StS+->sortmfirst(p1,vl,q pretend L(%)) pretend StS restCheck(s:StS):StS == -- checks that stream is null or first element is 0 @@ -89665,7 +89736,8 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ substmts(v,p,q pretend %) pretend StS comp1:(Var,StS,StS) -> StS - comp1(v,r,t)== addiag(map(subststream(v,#1,t),r)$ST2(SMP,StS))$STT + comp1(v,r,t)== + addiag(map((p1:SMP):StS +-> subststream(v,p1,t),r)$ST2(SMP,StS))$STT comp(v:Var,s:StS,t:StS):StS == delay empty? s => s @@ -89682,15 +89754,17 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ differentiate(s:%,v:Var):% == empty? s => 0 - map(differentiate(#1,v),rst s) + map((z1:SMP):SMP +-> differentiate(z1,v),rst s) if Coef has Algebra Fraction Integer then stream(x:%):Rep == x pretend Rep (x:%) ** (r:RN) == powern(r,stream x)$STT - (r:RN) * (x:%) == map(r * #1, stream x)$ST2(SMP,SMP) pretend % - (x:%) * (r:RN) == map(#1 * r,stream x )$ST2(SMP,SMP) pretend % + (r:RN) * (x:%) == + map((z1:SMP):SMP +-> r*z1,stream x)$ST2(SMP,SMP) pretend % + (x:%) * (r:RN) == + map((z1:SMP):SMP +-> z1*r,stream x)$ST2(SMP,SMP) pretend % exp x == exp(stream x)$STF log x == log(stream x)$STF @@ -89734,9 +89808,9 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ ss fintegrate(f,v,r) == - concat(r::SMP,delay map(intsmp(v,#1),f() pretend StS)) + concat(r::SMP,delay map((z1:SMP):SMP +-> intsmp(v,z1),f() pretend StS)) integrate(s,v,r) == - concat(r::SMP,map(intsmp(v,#1),s pretend StS)) + concat(r::SMP,map((z1:SMP):SMP +-> intsmp(v,z1),s pretend StS)) -- If there is more than one term of the same order, group them. tout(p:SMP):OUT == @@ -89770,7 +89844,8 @@ SparseMultivariateTaylorSeries(Coef,Var,SMP):_ if Coef has Field then stream(x:%):Rep == x pretend Rep SF2==> StreamFunctions2 - p:% / r:Coef ==(map(#1/$SMP r,stream p)$SF2(SMP,SMP))pretend % + p:% / r:Coef == + (map((z1:SMP):SMP +-> z1/$SMP r,stream p)$SF2(SMP,SMP)) pretend % @ <>= diff --git a/changelog b/changelog index 5f88a4c..b6585ee 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,5 @@ +20090518 tpd src/axiom-website/patches.html 20090518.05.tpd.patch +20090518 tpd books/bookvol10.3 SMTS +-> conversion 20090518 tpd src/axiom-website/patches.html 20090518.04.tpd.patch 20090518 tpd books/bookvol10.4 ESCONT +-> conversion 20090518 tpd src/axiom-website/patches.html 20090518.03.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index c4c0eb5..1a4f5c5 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -1346,5 +1346,7 @@ bookvol10.2 SMP +-> conversion
bookvol10.4 GBEUCLID +-> conversion
20090518.04.tpd.patch bookvol10.4 ESCONT +-> conversion
+20090518.05.tpd.patch +bookvol10.3 SMTS +-> conversion