assist.log 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037
  1. Codemist Standard Lisp 3.54 for DEC Alpha: May 23 1994
  2. Dump file created: Mon May 23 10:39:11 1994
  3. REDUCE 3.5, 15-Oct-93 ...
  4. Memory allocation: 6023424 bytes
  5. +++ About to read file tstlib.red
  6. % Tests of Assist Package version 2.0 for REDUCE 3.4 and 3.4.1.
  7. % DATE : 30 May 1993
  8. % Author: H. Caprasse <caprasse@vm1.ulg.ac.be>
  9. showtime;
  10. Time: 0 ms
  11. Comment 1. CONTROL OF SWITCHES;
  12. ;
  13. switches;
  14. **** exp:=t ............. allfac:= t ****
  15. **** ezgcd:=nil ......... gcd:= nil ****
  16. **** mcd:=t ............. lcm:= t ****
  17. **** div:=nil ........... rat:= nil ****
  18. **** intstr:=nil ........ rational:= nil ****
  19. **** precise:=nil ....... reduced:= nil ****
  20. **** complex:=nil ....... rationalize:= nil ****
  21. **** factor:= nil ....... distribute:= nil ***
  22. off exp;
  23. on gcd;
  24. switches;
  25. **** exp:=nil ............. allfac:= t ****
  26. **** ezgcd:=nil ......... gcd:= t ****
  27. **** mcd:=t ............. lcm:= t ****
  28. **** div:=nil ........... rat:= nil ****
  29. **** intstr:=nil ........ rational:= nil ****
  30. **** precise:=nil ....... reduced:= nil ****
  31. **** complex:=nil ....... rationalize:= nil ****
  32. **** factor:= nil ....... distribute:= nil ***
  33. switchorg;
  34. switches;
  35. **** exp:=t ............. allfac:= t ****
  36. **** ezgcd:=nil ......... gcd:= nil ****
  37. **** mcd:=t ............. lcm:= t ****
  38. **** div:=nil ........... rat:= nil ****
  39. **** intstr:=nil ........ rational:= nil ****
  40. **** precise:=nil ....... reduced:= nil ****
  41. **** complex:=nil ....... rationalize:= nil ****
  42. **** factor:= nil ....... distribute:= nil ***
  43. ;
  44. if !*mcd then "the switch mcd is on";
  45. the switch mcd is on
  46. if !*gcd then "the switch gcd is on";
  47. ;
  48. comment 2. MANIPULATION OF THE LIST STRUCTURE:;
  49. ;
  50. t1:=mklist(4);
  51. t1 := {0,0,0,0}
  52. Comment MKLIST does NEVER destroy anything ;
  53. mklist(t1,3);
  54. {0,0,0,0}
  55. mklist(t1,10);
  56. {0,0,0,0,0,0,0,0,0,0}
  57. ;
  58. sequences 3;
  59. {{0,0,0},
  60. {1,0,0},
  61. {0,1,0},
  62. {1,1,0},
  63. {0,0,1},
  64. {1,0,1},
  65. {0,1,1},
  66. {1,1,1}}
  67. lisp;
  68. nil
  69. sequences 3;
  70. ((0 0 0) (1 0 0) (0 1 0) (1 1 0) (0 0 1) (1 0 1) (0 1 1) (1 1 1))
  71. algebraic;
  72. frequency append(t1,t1);
  73. {{0,8}}
  74. elmult(a1,t1);
  75. 0
  76. insert(a1,t1,2);
  77. {0,a1,0,0,0}
  78. li:=list(1,2,5);
  79. li := {1,2,5}
  80. insert_keep_order(4,li,lessp);
  81. {1,2,4,5}
  82. merge_list(li,li,lessp);
  83. {1,1,2,2,5,5}
  84. for i:=1:4 do t1:= (t1.i:=mkid(a,i));
  85. % for i:=1:2 do t1:=(t1.i:=mkid(a,i));
  86. t1.1;
  87. a1
  88. t1:=(t1.1) . t1;
  89. t1 := {a1,a1,a2,a3,a4}
  90. position(a2,t1);
  91. 3
  92. pair(t1,t1);
  93. {{a1,a1},{a1,a1},{a2,a2},{a3,a3},{a4,a4}}
  94. depth list t1;
  95. 2
  96. depth a1;
  97. 0
  98. appendn(li,li,li);
  99. {1,2,5,1,2,5,1,2,5}
  100. ;
  101. comment 3. THE BAG STRUCTURE AND ITS ASSOCIATED FUNCTIONS
  102. ;
  103. aa:=bag(x,1,"A");
  104. aa := bag(x,1,A)
  105. putbag bg1,bg2;
  106. t
  107. on errcont;
  108. putbag list;
  109. ***** list invalid as BAG
  110. off errcont;
  111. aa:=bg1(x,y**2);
  112. 2
  113. aa := bg1(x,y )
  114. ;
  115. if bagp aa then "this is a bag";
  116. this is a bag
  117. ;
  118. clearbag bg2;
  119. ;
  120. depth bg2(x);
  121. 0
  122. ;
  123. if baglistp aa then "this is a bag or list";
  124. this is a bag or list
  125. if baglistp list(x) then "this is a bag or list";
  126. this is a bag or list
  127. ;
  128. ab:=bag(x1,x2,x3);
  129. ab := bag(x1,x2,x3)
  130. al:=list(y1,y2,y3);
  131. al := {y1,y2,y3}
  132. first ab;
  133. bag(x1)
  134. third ab;
  135. bag(x3)
  136. first al;
  137. y1
  138. last ab;
  139. bag(x3)
  140. last al;
  141. y3
  142. belast ab;
  143. bag(x1,x2)
  144. belast al;
  145. {y1,y2}
  146. rest ab;
  147. bag(x2,x3)
  148. rest al;
  149. {y2,y3}
  150. depth al;
  151. 1
  152. depth bg1(ab);
  153. 2
  154. ;
  155. ab.1;
  156. x1
  157. al.3;
  158. y3
  159. on errcont;
  160. ab.4;
  161. ***** Expression bag(x1,x2,x3) does not have part 4
  162. off errcont;
  163. kernlist(aa);
  164. 2
  165. {x,y }
  166. listbag(list x,bg1);
  167. bg1(x)
  168. size ab;
  169. 3
  170. length al;
  171. 3
  172. remove(ab,3);
  173. bag(x1,x2)
  174. delete(y2,al);
  175. {y1,y3}
  176. reverse al;
  177. {y3,y2,y1}
  178. member(x3,ab);
  179. bag(x3)
  180. al:=list(x**2,x**2,y1,y2,y3);
  181. 2
  182. al := {x ,
  183. 2
  184. x ,
  185. y1,
  186. y2,
  187. y3}
  188. ;
  189. elmult(x**2,al);
  190. 2
  191. position(y3,al);
  192. 5
  193. ;
  194. repfirst(xx,al);
  195. 2
  196. {xx,x ,y1,y2,y3}
  197. represt(xx,ab);
  198. bag(x1,xx)
  199. insert(x,al,3);
  200. 2 2
  201. {x ,x ,x,y1,y2,y3}
  202. insert( b,ab,2);
  203. bag(x1,b,xx)
  204. insert(ab,ab,1);
  205. bag(bag(x1,xx),x1,xx)
  206. substitute (new,y1,al);
  207. 2 2
  208. {x ,x ,new,y2,y3}
  209. ;
  210. appendn(ab,ab,ab);
  211. {x1,xx,x1,xx,x1,xx}
  212. append(ab,al);
  213. 2 2
  214. bag(x1,xx,x ,x ,y1,y2,y3)
  215. append(al,ab);
  216. 2 2
  217. {x ,x ,y1,y2,y3,x1,xx}
  218. ;
  219. comment Association list or bag may be constructed and thoroughly used;
  220. ;
  221. l:=list(a1,a2,a3,a4);
  222. l := {a1,a2,a3,a4}
  223. b:=bg1(x1,x2,x3);
  224. b := bg1(x1,x2,x3)
  225. al:=pair(list(1,2,3,4),l);
  226. al := {{1,a1},{2,a2},{3,a3},{4,a4}}
  227. ab:=pair(bg1(1,2,3),b);
  228. ab := bg1(bg1(1,x1),bg1(2,x2),bg1(3,x3))
  229. ;
  230. comment : A BOOLEAN function abaglistp to test if it is an association;
  231. ;
  232. if abaglistp bag(bag(1,2)) then "it is an associated bag";
  233. it is an associated bag
  234. ;
  235. % Values associated to the keys can be extracted
  236. % first occurence ONLY.
  237. ;
  238. asfirst(1,al);
  239. {1,a1}
  240. asfirst(3,ab);
  241. bg1(3,x3)
  242. ;
  243. assecond(a1,al);
  244. {1,a1}
  245. assecond(x3,ab);
  246. bg1(3,x3)
  247. ;
  248. aslast(z,list(list(x1,x2,x3),list(y1,y2,z)));
  249. {y1,y2,z}
  250. asrest(list(x2,x3),list(list(x1,x2,x3),list(y1,y2,z)));
  251. {x1,x2,x3}
  252. ;
  253. clear a1;
  254. ;
  255. % All occurences.
  256. asflist(x,bg1(bg1(x,a1,a2),bg1(x,b1,b2)));
  257. bg1(bg1(x,a1,a2),bg1(x,b1,b2))
  258. asslist(a1,list(list(x,a1),list(y,a1),list(x,y)));
  259. {{x,a1},{y,a1}}
  260. restaslist(bag(a1,x),bg1(bag(x,a1,a2),bag(a1,x,b2),bag(x,y,z)));
  261. bg1(bg1(x,b2),bg1(a1,a2))
  262. restaslist(list(a1,x),bag(bag(x,a1,a2),bag(a1,x,b2),bag(x,y,z)));
  263. bag(bag(x,b2),bag(a1,a2))
  264. ;
  265. comment 4. SETS AND THEIR MANIPULATION FUNCTIONS
  266. ;
  267. ts:=mkset list(a1,a1,a,2,2);
  268. ts := {a1,a,2}
  269. if setp ts then "this is a SET";
  270. this is a SET
  271. ;
  272. union(ts,ts);
  273. {a1,a,2}
  274. diffset(ts,list(a1,a));
  275. {2}
  276. diffset(list(a1,a),ts);
  277. {}
  278. symdiff(ts,ts);
  279. {}
  280. intersect(listbag(ts,set1),listbag(ts,set2));
  281. set1(a1,a,2)
  282. COMMENT 5. MISCELLANEOUS UTILITY FUNCTIONS :;
  283. ;
  284. clear a1,a2,a3,a,x,y,z,x1,x2,op$
  285. ;
  286. % DETECTION OF A GIVEN VARIABLE IN A GIVEN SET
  287. ;
  288. mkidnew();
  289. G0
  290. mkidnew(a);
  291. aG1
  292. dellastdigit 23;
  293. 2
  294. detidnum aa;
  295. detidnum a10;
  296. 10
  297. detidnum a1b2z34;
  298. 34
  299. list_to_ids list(a,1,rr,22);
  300. a1rr22
  301. ;
  302. if oddp 3 then "this is an odd integer";
  303. this is an odd integer
  304. ;
  305. <<prin2 1; followline 7; prin2 8;>>;
  306. 1
  307. 8
  308. ;
  309. operator foo;
  310. foo(x):=x;
  311. foo(x) := x
  312. foo(x)==value;
  313. value
  314. x:=x;
  315. x := value
  316. ;
  317. clear x;
  318. ;
  319. randomlist(10,20);
  320. {8,1,8,0,5,7,3,8,0,5,5,9,0,5,2,0,7,5,5,1}
  321. combnum(8,3);
  322. 56
  323. permutations(bag(a1,a2,a3));
  324. bag(bag(a1,a2,a3),bag(a1,a3,a2),bag(a2,a1,a3),bag(a2,a3,a1),
  325. bag(a3,a1,a2),bag(a3,a2,a1))
  326. permutations {1,2,3};
  327. {{1,2,3},{1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}}
  328. cyclicpermlist{1,2,3};
  329. {{1,2,3},{2,3,1},{3,1,2}}
  330. combinations({1,2,3},2);
  331. {{2,3},{1,3},{1,2}}
  332. labc:={a,b,c};
  333. labc := {a,bg1(x1,x2,x3),c}
  334. symmetrize(labc,foo,cyclicpermlist);
  335. foo(bg1(x1,x2,x3),c,a) + foo(a,bg1(x1,x2,x3),c)
  336. + foo(c,a,bg1(x1,x2,x3))
  337. symmetrize(labc,list,permutations);
  338. {bg1(x1,x2,x3),a,c} + {bg1(x1,x2,x3),c,a} + {a,bg1(x1,x2,x3),c}
  339. + {a,c,bg1(x1,x2,x3)} + {c,bg1(x1,x2,x3),a} + {c,a,bg1(x1,x2,x3)}
  340. symmetrize({labc},foo,cyclicpermlist);
  341. foo({bg1(x1,x2,x3),c,a}) + foo({a,bg1(x1,x2,x3),c})
  342. + foo({c,a,bg1(x1,x2,x3)})
  343. extremum({1,2,3},lessp);
  344. 1
  345. extremum({1,2,3},geq);
  346. 3
  347. extremum({a,b,c},ordp);
  348. bg1(x1,x2,x3)
  349. ;
  350. funcvar(x+y);
  351. {x,y}
  352. funcvar(sin log(x+y));
  353. {x,y}
  354. funcvar(sin pi);
  355. funcvar(x+e+i);
  356. {x}
  357. ;
  358. depatom a;
  359. a
  360. depend a,x,y;
  361. depatom a;
  362. {x,y}
  363. depend op,x,y,z;
  364. implicit op;
  365. op
  366. explicit op;
  367. op(x,y,z)
  368. depend y,zz;
  369. explicit op;
  370. op(x,y(zz),z)
  371. aa:=implicit op;
  372. aa := op
  373. clear op;
  374. ;
  375. korder x,z,y;
  376. korderlist;
  377. (x z y)
  378. ;
  379. if checkproplist({1,2,3},fixp) then "it is a list of integers";
  380. it is a list of integers
  381. ;
  382. if checkproplist({a,b1,c},idp) then "it is a list of identifiers";
  383. it is a list of identifiers
  384. ;
  385. if checkproplist({1,b1,c},idp) then "it is a list of identifiers";
  386. ;
  387. lmix:={1,1/2,a,"st"};
  388. 1
  389. lmix := {1,---,a,st}
  390. 2
  391. ;
  392. extractlist(lmix,fixp);
  393. {1}
  394. extractlist(lmix,numberp);
  395. 1
  396. {1,---}
  397. 2
  398. extractlist(lmix,idp);
  399. {a}
  400. extractlist(lmix,stringp);
  401. {st}
  402. ;
  403. comment 6. PROPERTIES AND FLAGS:;
  404. ;
  405. putflag(list(a1,a2),fl1,t);
  406. t
  407. putflag(list(a1,a2),fl2,t);
  408. t
  409. displayflag a1;
  410. {fl1,fl2}
  411. ;
  412. clearflag a1,a2;
  413. displayflag a2;
  414. {}
  415. putprop(x1,propname,value,t);
  416. x1
  417. displayprop(x1,prop);
  418. {}
  419. displayprop(x1,propname);
  420. {propname,value}
  421. ;
  422. putprop(x1,propname,value,0);
  423. displayprop(x1,propname);
  424. {}
  425. ;
  426. comment CONTROL FUNCTIONS:;
  427. ;
  428. alatomp z;
  429. t
  430. z:=s1;
  431. z := s1
  432. alatomp z;
  433. t
  434. ;
  435. alkernp z;
  436. t
  437. alkernp log sin r;
  438. t
  439. ;
  440. precp(difference,plus);
  441. t
  442. precp(plus,difference);
  443. precp(times,.);
  444. precp(.,times);
  445. t
  446. ;
  447. if stringp x then "this is a string";
  448. if stringp "this is a string" then "this is a string";
  449. this is a string
  450. ;
  451. if nordp(b,a) then "a is ordered before b";
  452. operator op;
  453. for all x,y such that nordp(x,y) let op(x,y)=x+y;
  454. op(a,a);
  455. op(a,a)
  456. op(b,a);
  457. op(bg1(x1,x2,x3),a)
  458. op(a,b);
  459. bg1(x1,x2,x3) + a
  460. clear op;
  461. ;
  462. depvarp(log(sin(x+cos(1/acos rr))),rr);
  463. t
  464. ;
  465. operator op;
  466. symmetric op;
  467. op(x,y)-op(y,x);
  468. 0
  469. remsym op;
  470. op(x,y)-op(y,x);
  471. op(x,y) - op(y,x)
  472. ;
  473. clear y,x,u,v;
  474. clear op;
  475. ;
  476. % DISPLAY and CLEARING of user's objects of various types entered
  477. % to the console. Only TOP LEVEL assignments are considered up to now.
  478. % The following statements must be made INTERACTIVELY. We put them
  479. % as COMMENTS for the user to experiment with them. We do this because
  480. % in a fresh environment all outputs are nil.
  481. ;
  482. % THIS PART OF THE TEST SHOULD BE REALIZED INTERACTIVELY.
  483. % SEE THE ** ASSIST LOG ** FILE .
  484. %v1:=v2:=1;
  485. %show variables; % For REDUCE 3.3 ONLY.
  486. %show scalars;
  487. %aa:=list(a);
  488. %show lists;
  489. %array ar(2);
  490. %show arrays;
  491. %load matr$
  492. %matrix mm;
  493. %show matrices;
  494. %x**2;
  495. %saveas res;
  496. %show saveids;
  497. %suppress variables; % For REDUCE 3.3 ONLY
  498. %show variables; % For REDUCE 3.3 ONLY
  499. %suppress scalars;
  500. %show scalars;
  501. %show lists;
  502. %suppress all;
  503. %show arrays;
  504. %show matrices;
  505. ;
  506. comment end of the interactive part;
  507. ;
  508. clear op;
  509. operator op;
  510. op(x,y,z);
  511. op(x,y,s1)
  512. clearop op;
  513. t
  514. clearfunctions abs,tan;
  515. *** abs is unprotected : Cleared ***
  516. *** tan is a protected function: NOT cleared ***
  517. "Clearing is complete"
  518. ;
  519. comment THIS FUNCTION MUST BE USED WITH CARE !!"!!!;
  520. ;
  521. comment 6. HANDLING OF POLYNOMIALS
  522. clear x,y,z;
  523. COMMENT To see the internal representation :;
  524. ;
  525. off pri;
  526. ;
  527. pol:=(x-2*y+3*z**2-1)**3;
  528. 3 2 2 2 2
  529. pol := x + ( - 6*y + 9*s1 - 3)*x + (12*y + ( - 36*s1 + 12)*y +
  530. 4 2 3 2 2 4
  531. 27*s1 - 18*s1 + 3)*x - 8*y + (36*s1 - 12)*y + ( - 54*s1
  532. 2 6 4 2
  533. + 36*s1 - 6)*y + 27*s1 - 27*s1 + 9*s1 - 1
  534. ;
  535. pold:=distribute pol;
  536. 3 2 2 2 2 2 4
  537. pold := x - 3*x + 9*s1 *x - 6*y*x + 3*x - 18*s1 *x + 27*s1 *x -
  538. 2 2 3 2 2 2
  539. 36*s1 *y*x + 12*y*x + 12*y *x - 8*y - 12*y + 36*s1 *y - 6*
  540. 2 4 6 4 2
  541. y + 36*s1 *y - 54*s1 *y + 27*s1 - 27*s1 + 9*s1 - 1
  542. ;
  543. on distribute;
  544. leadterm (pold);
  545. 3
  546. x
  547. pold:=redexpr pold;
  548. 2 2 2 2 2 4
  549. pold := - 3*x + 9*s1 *x - 6*y*x + 3*x - 18*s1 *x + 27*s1 *x - 36*
  550. 2 2 3 2 2 2
  551. s1 *y*x + 12*y*x + 12*y *x - 8*y - 12*y + 36*s1 *y - 6*y +
  552. 2 4 6 4 2
  553. 36*s1 *y - 54*s1 *y + 27*s1 - 27*s1 + 9*s1 - 1
  554. leadterm pold;
  555. 2
  556. - 3*x
  557. ;
  558. off distribute;
  559. polp:=pol$
  560. leadterm polp;
  561. 3
  562. x
  563. polp:=redexpr polp;
  564. 2 2 2 2
  565. polp := ( - 6*y + 9*s1 - 3)*x + (12*y + ( - 36*s1 + 12)*y + 27*s1
  566. 4 2 3 2 2 4
  567. - 18*s1 + 3)*x - 8*y + (36*s1 - 12)*y + ( - 54*s1 + 36
  568. 2 6 4 2
  569. *s1 - 6)*y + 27*s1 - 27*s1 + 9*s1 - 1
  570. leadterm polp;
  571. 2 2
  572. ( - 6*y + 9*s1 - 3)*x
  573. ;
  574. monom polp;
  575. 2
  576. { - 3*x ,
  577. 2 2
  578. 9*s1 *x ,
  579. 2
  580. - 6*y*x ,
  581. 3*x,
  582. 2
  583. - 18*s1 *x,
  584. 4
  585. 27*s1 *x,
  586. 2
  587. - 36*s1 *y*x,
  588. 12*y*x,
  589. 2
  590. 12*y *x,
  591. 3
  592. - 8*y ,
  593. 2
  594. - 12*y ,
  595. 2 2
  596. 36*s1 *y ,
  597. - 6*y,
  598. 2
  599. 36*s1 *y,
  600. 4
  601. - 54*s1 *y,
  602. 6
  603. 27*s1 ,
  604. 4
  605. - 27*s1 ,
  606. 2
  607. 9*s1 ,
  608. -1}
  609. ;
  610. on pri;
  611. ;
  612. splitterms polp;
  613. 2 2
  614. {{9*s1 *x ,
  615. 2
  616. 12*x*y ,
  617. 12*x*y,
  618. 4
  619. 27*s1 *x,
  620. 3*x,
  621. 2 2
  622. 36*s1 *y ,
  623. 2
  624. 36*s1 *y,
  625. 6
  626. 27*s1 ,
  627. 2
  628. 9*s1 },
  629. 2
  630. {6*x *y,
  631. 2
  632. 3*x ,
  633. 2
  634. 36*s1 *x*y,
  635. 2
  636. 18*s1 *x,
  637. 3
  638. 8*y ,
  639. 2
  640. 12*y ,
  641. 4
  642. 54*s1 *y,
  643. 6*y,
  644. 4
  645. 27*s1 ,
  646. 1}}
  647. ;
  648. splitplusminus polp;
  649. 6 4 2 2 2 2 2 2
  650. {3*(9*s1 + 9*s1 *x + 3*s1 *x + 12*s1 *y + 12*s1 *y + 3*s1
  651. 2
  652. + 4*x*y + 4*x*y + x),
  653. 4 4 2 2 2 2 3
  654. - 54*s1 *y - 27*s1 - 36*s1 *x*y - 18*s1 *x - 6*x *y - 3*x - 8*y
  655. 2
  656. - 12*y - 6*y - 1}
  657. ;
  658. divpol(pol,x+2*y+3*z**2);
  659. 4 2 2 2 2 2
  660. {9*s1 + 6*s1 *x - 24*s1 *y - 9*s1 + x - 8*x*y - 3*x + 28*y + 18*y
  661. + 3,
  662. 3 2
  663. - 64*y - 48*y - 12*y - 1}
  664. ;
  665. lowestdeg(pol,y);
  666. 0
  667. ;
  668. comment 7. HANDLING OF SOME TRANSCENDENTAL FUNCTIONS:;
  669. ;
  670. trig:=((sin x)**2+(cos x)**2)**4;
  671. 8 6 2 4 4
  672. trig := cos(x) + 4*cos(x) *sin(x) + 6*cos(x) *sin(x)
  673. 2 6 8
  674. + 4*cos(x) *sin(x) + sin(x)
  675. trigreduce trig;
  676. 1
  677. trig:=sin (5x);
  678. trig := sin(5*x)
  679. trigexpand trig;
  680. 4 2 2 4
  681. sin(x)*(5*cos(x) - 10*cos(x) *sin(x) + sin(x) )
  682. trigreduce ws;
  683. sin(5*x)
  684. trigexpand sin(x+y+z);
  685. cos(s1)*cos(x)*sin(y) + cos(s1)*cos(y)*sin(x) + cos(x)*cos(y)*sin(s1)
  686. - sin(s1)*sin(x)*sin(y)
  687. ;
  688. ;
  689. hypreduce (sinh x **2 -cosh x **2);
  690. -1
  691. ;
  692. ;
  693. clear a,b;
  694. pluslog log(a*log(x**b));
  695. log(log(x)) + log(a) + log(b)
  696. concsumlog((2*log x + a*b*log(x*y)+1)/(3*x**2*log(y)));
  697. a*b a*b 2
  698. log(y *x *x ) + 1
  699. -----------------------
  700. 2
  701. 3*x
  702. log(y )
  703. ;
  704. comment 8. HANDLING OF N6DIMENSIONAL VECTORS:;
  705. ;
  706. clear u1,u2,v1,v2,v3,v4,w3,w4;
  707. u1:=list(v1,v2,v3,v4);
  708. u1 := {v1,v2,v3,v4}
  709. u2:=bag(w1,w2,w3,w4);
  710. u2 := bag(w1,w2,w3,w4)
  711. %
  712. sumvect(u1,u2);
  713. {v1 + w1,
  714. v2 + w2,
  715. v3 + w3,
  716. v4 + w4}
  717. minvect(u2,u1);
  718. bag( - v1 + w1, - v2 + w2, - v3 + w3, - v4 + w4)
  719. scalvect(u1,u2);
  720. v1*w1 + v2*w2 + v3*w3 + v4*w4
  721. crossvect(rest u1,rest u2);
  722. {v3*w4 - v4*w3,
  723. - v2*w4 + v4*w2,
  724. v2*w3 - v3*w2}
  725. mpvect(rest u1,rest u2, minvect(rest u1,rest u2));
  726. 0
  727. scalvect(crossvect(rest u1,rest u2),minvect(rest u1,rest u2));
  728. 0
  729. ;
  730. comment 9. HANDLING OF GRASSMANN OPERATORS:;
  731. ;
  732. putgrass eta,eta1;
  733. grasskernel:=
  734. {eta(~x)*eta(~y) => -eta y * eta x when nordp(x,y),
  735. (~x)*(~x) => 0 when grassp x};
  736. grasskernel := {eta(~x)*eta(~y) => - eta(y)*eta(x) when nordp(x,y),
  737. ~x*~x => 0 when grassp(x)}
  738. ;
  739. eta(y)*eta(x);
  740. eta(y)*eta(x)
  741. eta(y)*eta(x) where grasskernel;
  742. - eta(x)*eta(y)
  743. let grasskernel;
  744. eta(x)^2;
  745. 0
  746. eta(y)*eta(x);
  747. - eta(x)*eta(y)
  748. operator zz;
  749. grassparity (eta(x)*zz(y));
  750. 1
  751. grassparity (eta(x)*eta(y));
  752. 0
  753. grassparity(eta(x)+zz(y));
  754. parity undefined
  755. clearrules grasskernel;
  756. grasskernel:=
  757. {eta(~x)*eta(~y) => -eta y * eta x when nordp(x,y),
  758. eta1(~x)*eta(~y) => -eta x * eta1 y,
  759. eta1(~x)*eta1(~y) => -eta1 y * eta1 x when nordp(x,y),
  760. (~x)*(~x) => 0 when grassp x};
  761. grasskernel := {eta(~x)*eta(~y) => - eta(y)*eta(x) when nordp(x,y),
  762. eta1(~x)*eta(~y) => - eta(x)*eta1(y),
  763. eta1(~x)*eta1(~y)
  764. => - eta1(y)*eta1(x) when nordp(x,y),
  765. ~x*~x => 0 when grassp(x)}
  766. ;
  767. let grasskernel;
  768. eta1(x)*eta(x)*eta1(z)*eta1(w);
  769. - eta(x)*eta1(s1)*eta1(w)*eta1(x)
  770. clearrules grasskernel;
  771. remgrass eta,eta1;
  772. clearop zz;
  773. t
  774. ;
  775. COMMENT 10. HANDLING OF MATRICES:;
  776. ;
  777. clear m,mm,b,b1,bb,cc,a,b,c,d;
  778. matrix mm(2,2);
  779. baglmat(bag(bag(a1,a2)),m);
  780. t
  781. m;
  782. [a1 a2]
  783. on errcont;
  784. ;
  785. baglmat(bag(bag(a1),bag(a2)),m);
  786. ***** (mat ((*sq ((((a1 . 1) . 1)) . 1) t) (*sq ((((a2 . 1) . 1)) . 1) t)))
  787. should be an identifier
  788. off errcont;
  789. % **** i.e. it cannot redefine the matrix! in order
  790. % to avoid accidental redefinition of an already given matrix;
  791. clear m;
  792. baglmat(bag(bag(a1),bag(a2)),m);
  793. t
  794. m;
  795. [a1]
  796. [ ]
  797. [a2]
  798. on errcont;
  799. baglmat(bag(bag(a1),bag(a2)),bag);
  800. ***** operator bag invalid as matrix
  801. off errcont;
  802. comment Right since a bag-like object cannot become a matrix.;
  803. ;
  804. coercemat(m,op);
  805. op(op(a1),op(a2))
  806. coercemat(m,list);
  807. {{a1},{a2}}
  808. ;
  809. on nero;
  810. unitmat b1(2);
  811. matrix b(2,2);
  812. b:=mat((r1,r2),(s1,s2));
  813. [r1 r2]
  814. b := [ ]
  815. [s1 s2]
  816. b1;
  817. [1 0]
  818. [ ]
  819. [0 1]
  820. b;
  821. [r1 r2]
  822. [ ]
  823. [s1 s2]
  824. mkidm(b,1);
  825. [1 0]
  826. [ ]
  827. [0 1]
  828. ;
  829. seteltmat(b,newelt,2,2);
  830. [r1 r2 ]
  831. [ ]
  832. [s1 newelt]
  833. geteltmat(b,2,1);
  834. s1
  835. %
  836. b:=matsubr(b,bag(1,2),2);
  837. [r1 r2]
  838. b := [ ]
  839. [1 2 ]
  840. ;
  841. submat(b,1,2);
  842. [1]
  843. ;
  844. bb:=mat((1+i,-i),(-1+i,-i));
  845. [i + 1 - i]
  846. bb := [ ]
  847. [i - 1 - i]
  848. cc:=matsubc(bb,bag(1,2),2);
  849. [i + 1 1]
  850. cc := [ ]
  851. [i - 1 2]
  852. ;
  853. cc:=tp matsubc(bb,bag(1,2),2);
  854. [i + 1 i - 1]
  855. cc := [ ]
  856. [ 1 2 ]
  857. matextr(bb, bag,1);
  858. bag(i + 1, - i)
  859. ;
  860. matextc(bb,list,2);
  861. { - i, - i}
  862. ;
  863. hconcmat(bb,cc);
  864. [i + 1 - i i + 1 i - 1]
  865. [ ]
  866. [i - 1 - i 1 2 ]
  867. vconcmat(bb,cc);
  868. [i + 1 - i ]
  869. [ ]
  870. [i - 1 - i ]
  871. [ ]
  872. [i + 1 i - 1]
  873. [ ]
  874. [ 1 2 ]
  875. ;
  876. tpmat(bb,bb);
  877. [ 2*i - i + 1 - i + 1 -1]
  878. [ ]
  879. [ -2 - i + 1 i + 1 -1]
  880. [ ]
  881. [ -2 i + 1 - i + 1 -1]
  882. [ ]
  883. [ - 2*i i + 1 i + 1 -1]
  884. bb tpmat bb;
  885. [ 2*i - i + 1 - i + 1 -1]
  886. [ ]
  887. [ -2 - i + 1 i + 1 -1]
  888. [ ]
  889. [ -2 i + 1 - i + 1 -1]
  890. [ ]
  891. [ - 2*i i + 1 i + 1 -1]
  892. ;
  893. clear hbb;
  894. hermat(bb,hbb);
  895. [ - i + 1 - (i + 1)]
  896. [ ]
  897. [ i i ]
  898. % id hbb changed to a matrix id and assigned to the hermitian matrix
  899. % of bb.
  900. ;
  901. showtime;
  902. Time: 3650 ms plus GC time: 33 ms
  903. end;
  904. (assist 3650 33)
  905. End of Lisp run after 3.66+0.76 seconds