123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037 |
- Codemist Standard Lisp 3.54 for DEC Alpha: May 23 1994
- Dump file created: Mon May 23 10:39:11 1994
- REDUCE 3.5, 15-Oct-93 ...
- Memory allocation: 6023424 bytes
- +++ About to read file tstlib.red
- % Tests of Assist Package version 2.0 for REDUCE 3.4 and 3.4.1.
- % DATE : 30 May 1993
- % Author: H. Caprasse <caprasse@vm1.ulg.ac.be>
- showtime;
- Time: 0 ms
- Comment 1. CONTROL OF SWITCHES;
- ;
- switches;
- **** exp:=t ............. allfac:= t ****
- **** ezgcd:=nil ......... gcd:= nil ****
- **** mcd:=t ............. lcm:= t ****
- **** div:=nil ........... rat:= nil ****
- **** intstr:=nil ........ rational:= nil ****
- **** precise:=nil ....... reduced:= nil ****
- **** complex:=nil ....... rationalize:= nil ****
- **** factor:= nil ....... distribute:= nil ***
- off exp;
- on gcd;
- switches;
- **** exp:=nil ............. allfac:= t ****
- **** ezgcd:=nil ......... gcd:= t ****
- **** mcd:=t ............. lcm:= t ****
- **** div:=nil ........... rat:= nil ****
- **** intstr:=nil ........ rational:= nil ****
- **** precise:=nil ....... reduced:= nil ****
- **** complex:=nil ....... rationalize:= nil ****
- **** factor:= nil ....... distribute:= nil ***
- switchorg;
- switches;
- **** exp:=t ............. allfac:= t ****
- **** ezgcd:=nil ......... gcd:= nil ****
- **** mcd:=t ............. lcm:= t ****
- **** div:=nil ........... rat:= nil ****
- **** intstr:=nil ........ rational:= nil ****
- **** precise:=nil ....... reduced:= nil ****
- **** complex:=nil ....... rationalize:= nil ****
- **** factor:= nil ....... distribute:= nil ***
- ;
- if !*mcd then "the switch mcd is on";
- the switch mcd is on
- if !*gcd then "the switch gcd is on";
- ;
- comment 2. MANIPULATION OF THE LIST STRUCTURE:;
- ;
- t1:=mklist(4);
- t1 := {0,0,0,0}
- Comment MKLIST does NEVER destroy anything ;
- mklist(t1,3);
- {0,0,0,0}
- mklist(t1,10);
- {0,0,0,0,0,0,0,0,0,0}
- ;
- sequences 3;
- {{0,0,0},
- {1,0,0},
- {0,1,0},
- {1,1,0},
- {0,0,1},
- {1,0,1},
- {0,1,1},
- {1,1,1}}
- lisp;
- nil
- sequences 3;
- ((0 0 0) (1 0 0) (0 1 0) (1 1 0) (0 0 1) (1 0 1) (0 1 1) (1 1 1))
- algebraic;
- frequency append(t1,t1);
- {{0,8}}
- elmult(a1,t1);
- 0
- insert(a1,t1,2);
- {0,a1,0,0,0}
- li:=list(1,2,5);
- li := {1,2,5}
- insert_keep_order(4,li,lessp);
- {1,2,4,5}
- merge_list(li,li,lessp);
- {1,1,2,2,5,5}
- for i:=1:4 do t1:= (t1.i:=mkid(a,i));
- % for i:=1:2 do t1:=(t1.i:=mkid(a,i));
- t1.1;
- a1
- t1:=(t1.1) . t1;
- t1 := {a1,a1,a2,a3,a4}
- position(a2,t1);
- 3
- pair(t1,t1);
- {{a1,a1},{a1,a1},{a2,a2},{a3,a3},{a4,a4}}
- depth list t1;
- 2
- depth a1;
- 0
- appendn(li,li,li);
- {1,2,5,1,2,5,1,2,5}
- ;
- comment 3. THE BAG STRUCTURE AND ITS ASSOCIATED FUNCTIONS
- ;
- aa:=bag(x,1,"A");
- aa := bag(x,1,A)
- putbag bg1,bg2;
- t
- on errcont;
- putbag list;
- ***** list invalid as BAG
- off errcont;
- aa:=bg1(x,y**2);
- 2
- aa := bg1(x,y )
- ;
- if bagp aa then "this is a bag";
- this is a bag
- ;
- clearbag bg2;
- ;
- depth bg2(x);
- 0
- ;
- if baglistp aa then "this is a bag or list";
- this is a bag or list
- if baglistp list(x) then "this is a bag or list";
- this is a bag or list
- ;
- ab:=bag(x1,x2,x3);
- ab := bag(x1,x2,x3)
- al:=list(y1,y2,y3);
- al := {y1,y2,y3}
- first ab;
- bag(x1)
- third ab;
- bag(x3)
- first al;
- y1
- last ab;
- bag(x3)
- last al;
- y3
- belast ab;
- bag(x1,x2)
- belast al;
- {y1,y2}
- rest ab;
- bag(x2,x3)
- rest al;
- {y2,y3}
- depth al;
- 1
- depth bg1(ab);
- 2
- ;
- ab.1;
- x1
- al.3;
- y3
- on errcont;
- ab.4;
- ***** Expression bag(x1,x2,x3) does not have part 4
- off errcont;
- kernlist(aa);
- 2
- {x,y }
- listbag(list x,bg1);
- bg1(x)
- size ab;
- 3
- length al;
- 3
- remove(ab,3);
- bag(x1,x2)
- delete(y2,al);
- {y1,y3}
- reverse al;
- {y3,y2,y1}
- member(x3,ab);
- bag(x3)
- al:=list(x**2,x**2,y1,y2,y3);
- 2
- al := {x ,
- 2
- x ,
- y1,
- y2,
- y3}
- ;
- elmult(x**2,al);
- 2
- position(y3,al);
- 5
- ;
- repfirst(xx,al);
- 2
- {xx,x ,y1,y2,y3}
- represt(xx,ab);
- bag(x1,xx)
- insert(x,al,3);
- 2 2
- {x ,x ,x,y1,y2,y3}
- insert( b,ab,2);
- bag(x1,b,xx)
- insert(ab,ab,1);
- bag(bag(x1,xx),x1,xx)
- substitute (new,y1,al);
- 2 2
- {x ,x ,new,y2,y3}
- ;
- appendn(ab,ab,ab);
- {x1,xx,x1,xx,x1,xx}
- append(ab,al);
- 2 2
- bag(x1,xx,x ,x ,y1,y2,y3)
- append(al,ab);
- 2 2
- {x ,x ,y1,y2,y3,x1,xx}
- ;
- comment Association list or bag may be constructed and thoroughly used;
- ;
- l:=list(a1,a2,a3,a4);
- l := {a1,a2,a3,a4}
- b:=bg1(x1,x2,x3);
- b := bg1(x1,x2,x3)
- al:=pair(list(1,2,3,4),l);
- al := {{1,a1},{2,a2},{3,a3},{4,a4}}
- ab:=pair(bg1(1,2,3),b);
- ab := bg1(bg1(1,x1),bg1(2,x2),bg1(3,x3))
- ;
- comment : A BOOLEAN function abaglistp to test if it is an association;
- ;
- if abaglistp bag(bag(1,2)) then "it is an associated bag";
- it is an associated bag
- ;
- % Values associated to the keys can be extracted
- % first occurence ONLY.
- ;
- asfirst(1,al);
- {1,a1}
- asfirst(3,ab);
- bg1(3,x3)
- ;
- assecond(a1,al);
- {1,a1}
- assecond(x3,ab);
- bg1(3,x3)
- ;
- aslast(z,list(list(x1,x2,x3),list(y1,y2,z)));
- {y1,y2,z}
- asrest(list(x2,x3),list(list(x1,x2,x3),list(y1,y2,z)));
- {x1,x2,x3}
- ;
- clear a1;
- ;
- % All occurences.
- asflist(x,bg1(bg1(x,a1,a2),bg1(x,b1,b2)));
- bg1(bg1(x,a1,a2),bg1(x,b1,b2))
- asslist(a1,list(list(x,a1),list(y,a1),list(x,y)));
- {{x,a1},{y,a1}}
- restaslist(bag(a1,x),bg1(bag(x,a1,a2),bag(a1,x,b2),bag(x,y,z)));
- bg1(bg1(x,b2),bg1(a1,a2))
- restaslist(list(a1,x),bag(bag(x,a1,a2),bag(a1,x,b2),bag(x,y,z)));
- bag(bag(x,b2),bag(a1,a2))
- ;
- comment 4. SETS AND THEIR MANIPULATION FUNCTIONS
- ;
- ts:=mkset list(a1,a1,a,2,2);
- ts := {a1,a,2}
- if setp ts then "this is a SET";
- this is a SET
- ;
- union(ts,ts);
- {a1,a,2}
- diffset(ts,list(a1,a));
- {2}
- diffset(list(a1,a),ts);
- {}
- symdiff(ts,ts);
- {}
- intersect(listbag(ts,set1),listbag(ts,set2));
- set1(a1,a,2)
- COMMENT 5. MISCELLANEOUS UTILITY FUNCTIONS :;
- ;
- clear a1,a2,a3,a,x,y,z,x1,x2,op$
- ;
- % DETECTION OF A GIVEN VARIABLE IN A GIVEN SET
- ;
- mkidnew();
- G0
- mkidnew(a);
- aG1
- dellastdigit 23;
- 2
- detidnum aa;
- detidnum a10;
- 10
- detidnum a1b2z34;
- 34
- list_to_ids list(a,1,rr,22);
- a1rr22
- ;
- if oddp 3 then "this is an odd integer";
- this is an odd integer
- ;
- <<prin2 1; followline 7; prin2 8;>>;
- 1
- 8
- ;
- operator foo;
- foo(x):=x;
- foo(x) := x
- foo(x)==value;
- value
- x:=x;
- x := value
- ;
- clear x;
- ;
- randomlist(10,20);
- {8,1,8,0,5,7,3,8,0,5,5,9,0,5,2,0,7,5,5,1}
- combnum(8,3);
- 56
- permutations(bag(a1,a2,a3));
- bag(bag(a1,a2,a3),bag(a1,a3,a2),bag(a2,a1,a3),bag(a2,a3,a1),
- bag(a3,a1,a2),bag(a3,a2,a1))
- permutations {1,2,3};
- {{1,2,3},{1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}}
- cyclicpermlist{1,2,3};
- {{1,2,3},{2,3,1},{3,1,2}}
- combinations({1,2,3},2);
- {{2,3},{1,3},{1,2}}
- labc:={a,b,c};
- labc := {a,bg1(x1,x2,x3),c}
- symmetrize(labc,foo,cyclicpermlist);
- foo(bg1(x1,x2,x3),c,a) + foo(a,bg1(x1,x2,x3),c)
- + foo(c,a,bg1(x1,x2,x3))
- symmetrize(labc,list,permutations);
- {bg1(x1,x2,x3),a,c} + {bg1(x1,x2,x3),c,a} + {a,bg1(x1,x2,x3),c}
- + {a,c,bg1(x1,x2,x3)} + {c,bg1(x1,x2,x3),a} + {c,a,bg1(x1,x2,x3)}
- symmetrize({labc},foo,cyclicpermlist);
- foo({bg1(x1,x2,x3),c,a}) + foo({a,bg1(x1,x2,x3),c})
- + foo({c,a,bg1(x1,x2,x3)})
- extremum({1,2,3},lessp);
- 1
- extremum({1,2,3},geq);
- 3
- extremum({a,b,c},ordp);
- bg1(x1,x2,x3)
- ;
- funcvar(x+y);
- {x,y}
- funcvar(sin log(x+y));
- {x,y}
- funcvar(sin pi);
- funcvar(x+e+i);
- {x}
- ;
- depatom a;
- a
- depend a,x,y;
- depatom a;
- {x,y}
- depend op,x,y,z;
- implicit op;
- op
- explicit op;
- op(x,y,z)
- depend y,zz;
- explicit op;
- op(x,y(zz),z)
- aa:=implicit op;
- aa := op
- clear op;
- ;
- korder x,z,y;
- korderlist;
- (x z y)
- ;
- if checkproplist({1,2,3},fixp) then "it is a list of integers";
- it is a list of integers
- ;
- if checkproplist({a,b1,c},idp) then "it is a list of identifiers";
- it is a list of identifiers
- ;
- if checkproplist({1,b1,c},idp) then "it is a list of identifiers";
- ;
- lmix:={1,1/2,a,"st"};
- 1
- lmix := {1,---,a,st}
- 2
- ;
- extractlist(lmix,fixp);
- {1}
- extractlist(lmix,numberp);
- 1
- {1,---}
- 2
- extractlist(lmix,idp);
- {a}
- extractlist(lmix,stringp);
- {st}
- ;
- comment 6. PROPERTIES AND FLAGS:;
- ;
- putflag(list(a1,a2),fl1,t);
- t
- putflag(list(a1,a2),fl2,t);
- t
- displayflag a1;
- {fl1,fl2}
- ;
- clearflag a1,a2;
- displayflag a2;
- {}
- putprop(x1,propname,value,t);
- x1
- displayprop(x1,prop);
- {}
- displayprop(x1,propname);
- {propname,value}
- ;
- putprop(x1,propname,value,0);
- displayprop(x1,propname);
- {}
- ;
- comment CONTROL FUNCTIONS:;
- ;
- alatomp z;
- t
- z:=s1;
- z := s1
- alatomp z;
- t
- ;
- alkernp z;
- t
- alkernp log sin r;
- t
- ;
- precp(difference,plus);
- t
- precp(plus,difference);
- precp(times,.);
- precp(.,times);
- t
- ;
- if stringp x then "this is a string";
- if stringp "this is a string" then "this is a string";
- this is a string
- ;
- if nordp(b,a) then "a is ordered before b";
- operator op;
- for all x,y such that nordp(x,y) let op(x,y)=x+y;
- op(a,a);
- op(a,a)
- op(b,a);
- op(bg1(x1,x2,x3),a)
- op(a,b);
- bg1(x1,x2,x3) + a
- clear op;
- ;
- depvarp(log(sin(x+cos(1/acos rr))),rr);
- t
- ;
- operator op;
- symmetric op;
- op(x,y)-op(y,x);
- 0
- remsym op;
- op(x,y)-op(y,x);
- op(x,y) - op(y,x)
- ;
- clear y,x,u,v;
- clear op;
- ;
- % DISPLAY and CLEARING of user's objects of various types entered
- % to the console. Only TOP LEVEL assignments are considered up to now.
- % The following statements must be made INTERACTIVELY. We put them
- % as COMMENTS for the user to experiment with them. We do this because
- % in a fresh environment all outputs are nil.
- ;
- % THIS PART OF THE TEST SHOULD BE REALIZED INTERACTIVELY.
- % SEE THE ** ASSIST LOG ** FILE .
- %v1:=v2:=1;
- %show variables; % For REDUCE 3.3 ONLY.
- %show scalars;
- %aa:=list(a);
- %show lists;
- %array ar(2);
- %show arrays;
- %load matr$
- %matrix mm;
- %show matrices;
- %x**2;
- %saveas res;
- %show saveids;
- %suppress variables; % For REDUCE 3.3 ONLY
- %show variables; % For REDUCE 3.3 ONLY
- %suppress scalars;
- %show scalars;
- %show lists;
- %suppress all;
- %show arrays;
- %show matrices;
- ;
- comment end of the interactive part;
- ;
- clear op;
- operator op;
- op(x,y,z);
- op(x,y,s1)
- clearop op;
- t
- clearfunctions abs,tan;
- *** abs is unprotected : Cleared ***
- *** tan is a protected function: NOT cleared ***
- "Clearing is complete"
- ;
- comment THIS FUNCTION MUST BE USED WITH CARE !!"!!!;
- ;
- comment 6. HANDLING OF POLYNOMIALS
- clear x,y,z;
- COMMENT To see the internal representation :;
- ;
- off pri;
- ;
- pol:=(x-2*y+3*z**2-1)**3;
- 3 2 2 2 2
- pol := x + ( - 6*y + 9*s1 - 3)*x + (12*y + ( - 36*s1 + 12)*y +
- 4 2 3 2 2 4
- 27*s1 - 18*s1 + 3)*x - 8*y + (36*s1 - 12)*y + ( - 54*s1
- 2 6 4 2
- + 36*s1 - 6)*y + 27*s1 - 27*s1 + 9*s1 - 1
- ;
- pold:=distribute pol;
- 3 2 2 2 2 2 4
- pold := x - 3*x + 9*s1 *x - 6*y*x + 3*x - 18*s1 *x + 27*s1 *x -
- 2 2 3 2 2 2
- 36*s1 *y*x + 12*y*x + 12*y *x - 8*y - 12*y + 36*s1 *y - 6*
- 2 4 6 4 2
- y + 36*s1 *y - 54*s1 *y + 27*s1 - 27*s1 + 9*s1 - 1
- ;
- on distribute;
- leadterm (pold);
- 3
- x
- pold:=redexpr pold;
- 2 2 2 2 2 4
- pold := - 3*x + 9*s1 *x - 6*y*x + 3*x - 18*s1 *x + 27*s1 *x - 36*
- 2 2 3 2 2 2
- s1 *y*x + 12*y*x + 12*y *x - 8*y - 12*y + 36*s1 *y - 6*y +
- 2 4 6 4 2
- 36*s1 *y - 54*s1 *y + 27*s1 - 27*s1 + 9*s1 - 1
- leadterm pold;
- 2
- - 3*x
- ;
- off distribute;
- polp:=pol$
- leadterm polp;
- 3
- x
- polp:=redexpr polp;
- 2 2 2 2
- polp := ( - 6*y + 9*s1 - 3)*x + (12*y + ( - 36*s1 + 12)*y + 27*s1
- 4 2 3 2 2 4
- - 18*s1 + 3)*x - 8*y + (36*s1 - 12)*y + ( - 54*s1 + 36
- 2 6 4 2
- *s1 - 6)*y + 27*s1 - 27*s1 + 9*s1 - 1
- leadterm polp;
- 2 2
- ( - 6*y + 9*s1 - 3)*x
- ;
- monom polp;
- 2
- { - 3*x ,
- 2 2
- 9*s1 *x ,
- 2
- - 6*y*x ,
- 3*x,
- 2
- - 18*s1 *x,
- 4
- 27*s1 *x,
- 2
- - 36*s1 *y*x,
- 12*y*x,
- 2
- 12*y *x,
- 3
- - 8*y ,
- 2
- - 12*y ,
- 2 2
- 36*s1 *y ,
- - 6*y,
- 2
- 36*s1 *y,
- 4
- - 54*s1 *y,
- 6
- 27*s1 ,
- 4
- - 27*s1 ,
- 2
- 9*s1 ,
- -1}
- ;
- on pri;
- ;
- splitterms polp;
- 2 2
- {{9*s1 *x ,
- 2
- 12*x*y ,
- 12*x*y,
- 4
- 27*s1 *x,
- 3*x,
- 2 2
- 36*s1 *y ,
- 2
- 36*s1 *y,
- 6
- 27*s1 ,
- 2
- 9*s1 },
- 2
- {6*x *y,
- 2
- 3*x ,
- 2
- 36*s1 *x*y,
- 2
- 18*s1 *x,
- 3
- 8*y ,
- 2
- 12*y ,
- 4
- 54*s1 *y,
- 6*y,
- 4
- 27*s1 ,
- 1}}
- ;
- splitplusminus polp;
- 6 4 2 2 2 2 2 2
- {3*(9*s1 + 9*s1 *x + 3*s1 *x + 12*s1 *y + 12*s1 *y + 3*s1
- 2
- + 4*x*y + 4*x*y + x),
- 4 4 2 2 2 2 3
- - 54*s1 *y - 27*s1 - 36*s1 *x*y - 18*s1 *x - 6*x *y - 3*x - 8*y
- 2
- - 12*y - 6*y - 1}
- ;
- divpol(pol,x+2*y+3*z**2);
- 4 2 2 2 2 2
- {9*s1 + 6*s1 *x - 24*s1 *y - 9*s1 + x - 8*x*y - 3*x + 28*y + 18*y
- + 3,
- 3 2
- - 64*y - 48*y - 12*y - 1}
- ;
- lowestdeg(pol,y);
- 0
- ;
- comment 7. HANDLING OF SOME TRANSCENDENTAL FUNCTIONS:;
- ;
- trig:=((sin x)**2+(cos x)**2)**4;
- 8 6 2 4 4
- trig := cos(x) + 4*cos(x) *sin(x) + 6*cos(x) *sin(x)
- 2 6 8
- + 4*cos(x) *sin(x) + sin(x)
- trigreduce trig;
- 1
- trig:=sin (5x);
- trig := sin(5*x)
- trigexpand trig;
- 4 2 2 4
- sin(x)*(5*cos(x) - 10*cos(x) *sin(x) + sin(x) )
- trigreduce ws;
- sin(5*x)
- trigexpand sin(x+y+z);
- cos(s1)*cos(x)*sin(y) + cos(s1)*cos(y)*sin(x) + cos(x)*cos(y)*sin(s1)
- - sin(s1)*sin(x)*sin(y)
- ;
- ;
- hypreduce (sinh x **2 -cosh x **2);
- -1
- ;
- ;
- clear a,b;
- pluslog log(a*log(x**b));
- log(log(x)) + log(a) + log(b)
- concsumlog((2*log x + a*b*log(x*y)+1)/(3*x**2*log(y)));
- a*b a*b 2
- log(y *x *x ) + 1
- -----------------------
- 2
- 3*x
- log(y )
- ;
- comment 8. HANDLING OF N6DIMENSIONAL VECTORS:;
- ;
- clear u1,u2,v1,v2,v3,v4,w3,w4;
- u1:=list(v1,v2,v3,v4);
- u1 := {v1,v2,v3,v4}
- u2:=bag(w1,w2,w3,w4);
- u2 := bag(w1,w2,w3,w4)
- %
- sumvect(u1,u2);
- {v1 + w1,
- v2 + w2,
- v3 + w3,
- v4 + w4}
- minvect(u2,u1);
- bag( - v1 + w1, - v2 + w2, - v3 + w3, - v4 + w4)
- scalvect(u1,u2);
- v1*w1 + v2*w2 + v3*w3 + v4*w4
- crossvect(rest u1,rest u2);
- {v3*w4 - v4*w3,
- - v2*w4 + v4*w2,
- v2*w3 - v3*w2}
- mpvect(rest u1,rest u2, minvect(rest u1,rest u2));
- 0
- scalvect(crossvect(rest u1,rest u2),minvect(rest u1,rest u2));
- 0
- ;
- comment 9. HANDLING OF GRASSMANN OPERATORS:;
- ;
- putgrass eta,eta1;
- grasskernel:=
- {eta(~x)*eta(~y) => -eta y * eta x when nordp(x,y),
- (~x)*(~x) => 0 when grassp x};
- grasskernel := {eta(~x)*eta(~y) => - eta(y)*eta(x) when nordp(x,y),
- ~x*~x => 0 when grassp(x)}
- ;
- eta(y)*eta(x);
- eta(y)*eta(x)
- eta(y)*eta(x) where grasskernel;
- - eta(x)*eta(y)
- let grasskernel;
- eta(x)^2;
- 0
- eta(y)*eta(x);
- - eta(x)*eta(y)
- operator zz;
- grassparity (eta(x)*zz(y));
- 1
- grassparity (eta(x)*eta(y));
- 0
- grassparity(eta(x)+zz(y));
- parity undefined
- clearrules grasskernel;
- grasskernel:=
- {eta(~x)*eta(~y) => -eta y * eta x when nordp(x,y),
- eta1(~x)*eta(~y) => -eta x * eta1 y,
- eta1(~x)*eta1(~y) => -eta1 y * eta1 x when nordp(x,y),
- (~x)*(~x) => 0 when grassp x};
- grasskernel := {eta(~x)*eta(~y) => - eta(y)*eta(x) when nordp(x,y),
- eta1(~x)*eta(~y) => - eta(x)*eta1(y),
- eta1(~x)*eta1(~y)
- => - eta1(y)*eta1(x) when nordp(x,y),
- ~x*~x => 0 when grassp(x)}
- ;
- let grasskernel;
- eta1(x)*eta(x)*eta1(z)*eta1(w);
- - eta(x)*eta1(s1)*eta1(w)*eta1(x)
- clearrules grasskernel;
- remgrass eta,eta1;
- clearop zz;
- t
- ;
- COMMENT 10. HANDLING OF MATRICES:;
- ;
- clear m,mm,b,b1,bb,cc,a,b,c,d;
- matrix mm(2,2);
- baglmat(bag(bag(a1,a2)),m);
- t
- m;
- [a1 a2]
- on errcont;
- ;
- baglmat(bag(bag(a1),bag(a2)),m);
- ***** (mat ((*sq ((((a1 . 1) . 1)) . 1) t) (*sq ((((a2 . 1) . 1)) . 1) t)))
- should be an identifier
- off errcont;
- % **** i.e. it cannot redefine the matrix! in order
- % to avoid accidental redefinition of an already given matrix;
- clear m;
- baglmat(bag(bag(a1),bag(a2)),m);
- t
- m;
- [a1]
- [ ]
- [a2]
- on errcont;
- baglmat(bag(bag(a1),bag(a2)),bag);
- ***** operator bag invalid as matrix
- off errcont;
- comment Right since a bag-like object cannot become a matrix.;
- ;
- coercemat(m,op);
- op(op(a1),op(a2))
- coercemat(m,list);
- {{a1},{a2}}
- ;
- on nero;
- unitmat b1(2);
- matrix b(2,2);
- b:=mat((r1,r2),(s1,s2));
- [r1 r2]
- b := [ ]
- [s1 s2]
- b1;
- [1 0]
- [ ]
- [0 1]
- b;
- [r1 r2]
- [ ]
- [s1 s2]
- mkidm(b,1);
- [1 0]
- [ ]
- [0 1]
- ;
- seteltmat(b,newelt,2,2);
- [r1 r2 ]
- [ ]
- [s1 newelt]
- geteltmat(b,2,1);
- s1
- %
- b:=matsubr(b,bag(1,2),2);
- [r1 r2]
- b := [ ]
- [1 2 ]
- ;
- submat(b,1,2);
- [1]
- ;
- bb:=mat((1+i,-i),(-1+i,-i));
- [i + 1 - i]
- bb := [ ]
- [i - 1 - i]
- cc:=matsubc(bb,bag(1,2),2);
- [i + 1 1]
- cc := [ ]
- [i - 1 2]
- ;
- cc:=tp matsubc(bb,bag(1,2),2);
- [i + 1 i - 1]
- cc := [ ]
- [ 1 2 ]
- matextr(bb, bag,1);
- bag(i + 1, - i)
- ;
- matextc(bb,list,2);
- { - i, - i}
- ;
- hconcmat(bb,cc);
- [i + 1 - i i + 1 i - 1]
- [ ]
- [i - 1 - i 1 2 ]
- vconcmat(bb,cc);
- [i + 1 - i ]
- [ ]
- [i - 1 - i ]
- [ ]
- [i + 1 i - 1]
- [ ]
- [ 1 2 ]
- ;
- tpmat(bb,bb);
- [ 2*i - i + 1 - i + 1 -1]
- [ ]
- [ -2 - i + 1 i + 1 -1]
- [ ]
- [ -2 i + 1 - i + 1 -1]
- [ ]
- [ - 2*i i + 1 i + 1 -1]
- bb tpmat bb;
- [ 2*i - i + 1 - i + 1 -1]
- [ ]
- [ -2 - i + 1 i + 1 -1]
- [ ]
- [ -2 i + 1 - i + 1 -1]
- [ ]
- [ - 2*i i + 1 i + 1 -1]
- ;
- clear hbb;
- hermat(bb,hbb);
- [ - i + 1 - (i + 1)]
- [ ]
- [ i i ]
- % id hbb changed to a matrix id and assigned to the hermitian matrix
- % of bb.
- ;
- showtime;
- Time: 3650 ms plus GC time: 33 ms
- end;
- (assist 3650 33)
- End of Lisp run after 3.66+0.76 seconds
|