tri.rlg 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. Tue Feb 10 12:29:44 2004 run on Linux
  2. % TeX-REDUCE-Interface 0.70
  3. % set greek asserted
  4. % set lowercase asserted
  5. % set Greek asserted
  6. % set Uppercase asserted
  7. % \tolerance 10
  8. % \hsize=150mm
  9. % load tri;
  10. global '(textest!*);
  11. symbolic procedure texexa(code);
  12. begin
  13. prin2 "\TRIexa{"; prin2 textest!*;
  14. if !*TeXindent then prin2 "}{TeXindent}{" else
  15. if !*TeXbreak then prin2 "}{TeXBreak}{" else
  16. if !*TeX then prin2 "TeX" else prin2 "}{---}{";
  17. if !*TeXbreak then prin2 tolerance!* else prin2 "---";
  18. prin2 "}{"; prin2 code; prin2 "}"; terpri()
  19. end;
  20. texexa
  21. algebraic procedure exa(expression,code);
  22. begin symbolic texexa code; return expression end;
  23. exa
  24. % ----------------------------------------------------------------------
  25. % Examples from the Integrator Test File
  26. % ----------------------------------------------------------------------
  27. symbolic(textest!*:="Integration");
  28. "Integration"
  29. texsetbreak(120,1000);
  30. % \tolerance 1000
  31. % \hsize=120mm
  32. on texindent;
  33. off echo;
  34. \TRIexa{Integration}{TeXindent}{1000}{int(1+x+x**2,x);}
  35. $$\displaylines{\qdd
  36. \frac{x\cdot
  37. \(2\cdot x^{2}
  38. +3\cdot x
  39. +6
  40. \)
  41. }{
  42. 6}
  43. \cr}$$
  44. \TRIexa{Integration}{TeXindent}{1000}{int(x**2*(2*x**2+x)**2,x);}
  45. $$\displaylines{\qdd
  46. \frac{x^{5}\cdot
  47. \(60\cdot x^{2}
  48. +70\cdot x
  49. +21
  50. \)
  51. }{
  52. 105}
  53. \cr}$$
  54. \TRIexa{Integration}{TeXindent}{1000}{int(x*(x**2+2*x+1),x);}
  55. $$\displaylines{\qdd
  56. \frac{x^{2}\cdot
  57. \(3\cdot x^{2}
  58. +8\cdot x
  59. +6
  60. \)
  61. }{
  62. 12}
  63. \cr}$$
  64. \TRIexa{Integration}{TeXindent}{1000}{int(1/x,x);}
  65. $$\displaylines{\qdd
  66. \ln
  67. \(x
  68. \)
  69. \cr}$$
  70. \TRIexa{Integration}{TeXindent}{1000}{int((x+1)**3/(x-1)**4,x);}
  71. $$\displaylines{\qdd
  72. \frac{3\cdot \ln
  73. \(x
  74. -1
  75. \)
  76. \cdot x^{3}
  77. -9\cdot \ln
  78. \(x
  79. -1
  80. \)
  81. \cdot x^{2}
  82. +9\cdot \ln
  83. \(x
  84. -1
  85. \)
  86. \cdot x
  87. -3\cdot \ln
  88. \(x
  89. -1
  90. \)
  91. -6\cdot x^{3}
  92. -2}{
  93. 3\cdot
  94. \(x^{3}
  95. -3\cdot x^{2}
  96. +3\cdot x
  97. -1
  98. \)
  99. }
  100. \cr}$$
  101. \TRIexa{Integration}{TeXindent}{1000}{int(1/(x*(x-1)*(x+1)**2),x);}
  102. $$\displaylines{\qdd
  103. \(\ln
  104. \(x
  105. -1
  106. \)
  107. \cdot x
  108. +\ln
  109. \(x
  110. -1
  111. \)
  112. +3\cdot \ln
  113. \(x
  114. +1
  115. \)
  116. \cdot x\nl
  117. \off{327680}
  118. +3\cdot \ln
  119. \(x
  120. +1
  121. \)
  122. -4\cdot \ln
  123. \(x
  124. \)
  125. \cdot x
  126. -4\cdot \ln
  127. \(x
  128. \)
  129. +2\cdot x
  130. \)
  131. /\nl
  132. \(4\cdot
  133. \(x
  134. +1
  135. \)
  136. \)
  137. \Nl}$$
  138. \TRIexa{Integration}{TeXindent}{1000}{int((a*x+b)/((x-p)*(x-q)),x);}
  139. $$\displaylines{\qdd
  140. \frac{\ln
  141. \(p
  142. -x
  143. \)
  144. \cdot a\cdot p
  145. +\ln
  146. \(p
  147. -x
  148. \)
  149. \cdot b
  150. -\ln
  151. \(q
  152. -x
  153. \)
  154. \cdot a\cdot q
  155. -\ln
  156. \(q
  157. -x
  158. \)
  159. \cdot b}{
  160. p
  161. -q}
  162. \cr}$$
  163. \TRIexa{Integration}{TeXindent}{1000}{int(1/(a*x**2+b*x+c),x);}
  164. $$\displaylines{\qdd
  165. \frac{2\cdot
  166. \sqrt{4\cdot a\cdot c
  167. -b^{2}}\cdot \atan
  168. \(\frac{2\cdot a\cdot x
  169. +b}{
  170. \sqrt{4\cdot a\cdot c
  171. -b^{2}}}
  172. \)
  173. }{
  174. 4\cdot a\cdot c
  175. -b^{2}}
  176. \cr}$$
  177. \TRIexa{Integration}{TeXindent}{1000}{int((a*x+b)/(1+x**2),x);}
  178. $$\displaylines{\qdd
  179. \frac{2\cdot \atan
  180. \(x
  181. \)
  182. \cdot b
  183. +\ln
  184. \(x^{2}
  185. +1
  186. \)
  187. \cdot a}{
  188. 2}
  189. \cr}$$
  190. \TRIexa{Integration}{TeXindent}{1000}{int(1/(x**2-2*x+3),x);}
  191. $$\displaylines{\qdd
  192. \frac{\sqrt{2}
  193. \cdot \atan
  194. \(\frac{x
  195. -1}{
  196. \sqrt{2}}
  197. \)
  198. }{
  199. 2}
  200. \cr}$$
  201. \TRIexa{Integration}{TeXindent}{1000}{int(1/((x-1)*(x**2+1))**2,x);}
  202. $$\displaylines{\qdd
  203. \(\atan
  204. \(x
  205. \)
  206. \cdot x^{3}
  207. -\atan
  208. \(x
  209. \)
  210. \cdot x^{2}
  211. +\atan
  212. \(x
  213. \)
  214. \cdot x
  215. -\atan
  216. \(x
  217. \)
  218. \nl
  219. \off{327680}
  220. +\ln
  221. \(x^{2}
  222. +1
  223. \)
  224. \cdot x^{3}
  225. -\ln
  226. \(x^{2}
  227. +1
  228. \)
  229. \cdot x^{2}
  230. +\ln
  231. \(x^{2}
  232. +1
  233. \)
  234. \cdot x
  235. -\ln
  236. \(x^{2}
  237. +1
  238. \)
  239. -2\cdot \ln
  240. \(x
  241. -1
  242. \)
  243. \cdot x^{3}\nl
  244. \off{327680}
  245. +2\cdot \ln
  246. \(x
  247. -1
  248. \)
  249. \cdot x^{2}
  250. -2\cdot \ln
  251. \(x
  252. -1
  253. \)
  254. \cdot x
  255. +2\cdot \ln
  256. \(x
  257. -1
  258. \)
  259. -x^{3}
  260. -2\cdot x
  261. +1
  262. \)
  263. /\nl
  264. \(4\cdot
  265. \(x^{3}
  266. -x^{2}
  267. +x
  268. -1
  269. \)
  270. \)
  271. \Nl}$$
  272. \TRIexa{Integration}{TeXindent}{1000}{int(x/((x-a)*(x-b)*(x-c)),x);}
  273. $$\displaylines{\qdd
  274. \(\ln
  275. \(a
  276. -x
  277. \)
  278. \cdot a\cdot b
  279. -\ln
  280. \(a
  281. -x
  282. \)
  283. \cdot a\cdot c
  284. -\ln
  285. \(b
  286. -x
  287. \)
  288. \cdot a\cdot b\nl
  289. \off{327680}
  290. +\ln
  291. \(b
  292. -x
  293. \)
  294. \cdot b\cdot c
  295. +\ln
  296. \(c
  297. -x
  298. \)
  299. \cdot a\cdot c
  300. -\ln
  301. \(c
  302. -x
  303. \)
  304. \cdot b\cdot c
  305. \)
  306. /\nl
  307. \(a^{2}\cdot b
  308. -a^{2}\cdot c
  309. -a\cdot b^{2}
  310. +a\cdot c^{2}
  311. +b^{2}\cdot c
  312. -b\cdot c^{2}
  313. \)
  314. \Nl}$$
  315. \TRIexa{Integration}{TeXindent}{1000}{int(x/((x**2+a**2)*(x**2+b**2)),x);}
  316. $$\displaylines{\qdd
  317. \frac{-\ln
  318. \(a^{2}
  319. +x^{2}
  320. \)
  321. +\ln
  322. \(b^{2}
  323. +x^{2}
  324. \)
  325. }{
  326. 2\cdot
  327. \(a^{2}
  328. -b^{2}
  329. \)
  330. }
  331. \cr}$$
  332. \TRIexa{Integration}{TeXindent}{1000}{int(x**2/((x**2+a**2)*(x**2+b**2)),x);}
  333. $$\displaylines{\qdd
  334. \frac{\atan
  335. \(\frac{x}{
  336. a}
  337. \)
  338. \cdot a
  339. -\atan
  340. \(\frac{x}{
  341. b}
  342. \)
  343. \cdot b}{
  344. a^{2}
  345. -b^{2}}
  346. \cr}$$
  347. \TRIexa{Integration}{TeXindent}{1000}{int(x/((x-1)*(x**2+1)),x);}
  348. $$\displaylines{\qdd
  349. \frac{2\cdot \atan
  350. \(x
  351. \)
  352. -\ln
  353. \(x^{2}
  354. +1
  355. \)
  356. +2\cdot \ln
  357. \(x
  358. -1
  359. \)
  360. }{
  361. 4}
  362. \cr}$$
  363. \TRIexa{Integration}{TeXindent}{1000}{int(x/(1+x**3),x);}
  364. $$\displaylines{\qdd
  365. \frac{2\cdot
  366. \sqrt{3}\cdot \atan
  367. \(\frac{2\cdot x
  368. -1}{
  369. \sqrt{3}}
  370. \)
  371. +\ln
  372. \(x^{2}
  373. -x
  374. +1
  375. \)
  376. -2\cdot \ln
  377. \(x
  378. +1
  379. \)
  380. }{
  381. 6}
  382. \cr}$$
  383. \TRIexa{Integration}{TeXindent}{1000}{int(x**3/((x-1)**2*(x**3+1)),x);}
  384. $$\displaylines{\qdd
  385. \(-4\cdot \ln
  386. \(x^{2}
  387. -x
  388. +1
  389. \)
  390. \cdot x
  391. +4\cdot \ln
  392. \(x^{2}
  393. -x
  394. +1
  395. \)
  396. +9\cdot \ln
  397. \(x
  398. -1
  399. \)
  400. \cdot x\nl
  401. \off{327680}
  402. -9\cdot \ln
  403. \(x
  404. -1
  405. \)
  406. -\ln
  407. \(x
  408. +1
  409. \)
  410. \cdot x
  411. +\ln
  412. \(x
  413. +1
  414. \)
  415. -6\cdot x
  416. \)
  417. /\nl
  418. \(12\cdot
  419. \(x
  420. -1
  421. \)
  422. \)
  423. \Nl}$$
  424. \TRIexa{Integration}{TeXindent}{1000}{int(1/(1+x**4),x);}
  425. $$\displaylines{\qdd
  426. \(\sqrt{2}\cdot
  427. \(-2\cdot \atan
  428. \(\frac{\sqrt{2}
  429. -2\cdot x}{
  430. \sqrt{2}}
  431. \)
  432. +2\cdot \atan
  433. \(\frac{\sqrt{2}
  434. +2\cdot x}{
  435. \sqrt{2}}
  436. \)
  437. -\ln
  438. \(-
  439. \sqrt{2}\cdot x
  440. +x^{2}
  441. +1
  442. \)
  443. +\ln
  444. \(\sqrt{2}\cdot x
  445. +x^{2}
  446. +1
  447. \)
  448. \)
  449. \)
  450. /8
  451. \cr}$$
  452. \TRIexa{Integration}{TeXindent}{1000}{int(x**2/(1+x**4),x);}
  453. $$\displaylines{\qdd
  454. \(\sqrt{2}\cdot
  455. \(-2\cdot \atan
  456. \(\frac{\sqrt{2}
  457. -2\cdot x}{
  458. \sqrt{2}}
  459. \)
  460. +2\cdot \atan
  461. \(\frac{\sqrt{2}
  462. +2\cdot x}{
  463. \sqrt{2}}
  464. \)
  465. +\ln
  466. \(-
  467. \sqrt{2}\cdot x
  468. +x^{2}
  469. +1
  470. \)
  471. -\ln
  472. \(\sqrt{2}\cdot x
  473. +x^{2}
  474. +1
  475. \)
  476. \)
  477. \)
  478. /8
  479. \cr}$$
  480. \TRIexa{Integration}{TeXindent}{1000}{int(1/(1+x**2+x**4),x);}
  481. $$\displaylines{\qdd
  482. \frac{2\cdot
  483. \sqrt{3}\cdot \atan
  484. \(\frac{2\cdot x
  485. -1}{
  486. \sqrt{3}}
  487. \)
  488. +2\cdot
  489. \sqrt{3}\cdot \atan
  490. \(\frac{2\cdot x
  491. +1}{
  492. \sqrt{3}}
  493. \)
  494. -3\cdot \ln
  495. \(x^{2}
  496. -x
  497. +1
  498. \)
  499. +3\cdot \ln
  500. \(x^{2}
  501. +x
  502. +1
  503. \)
  504. }{
  505. 12}
  506. \cr}$$
  507. \TRIexa{Integration}{TeXindent}{1000}{int(sin x**2/x,x);}
  508. $$\displaylines{\qdd
  509. \frac{-ci
  510. \(2\cdot x
  511. \)
  512. +\ln
  513. \(x
  514. \)
  515. }{
  516. 2}
  517. \cr}$$
  518. \TRIexa{Integration}{TeXindent}{1000}{int(x*cos(xi/sin(x))*cos(x)/sin(x)**2,x);}
  519. $$\displaylines{\qdd
  520. \int {\frac{\cos
  521. \(\frac{\xi }{
  522. \sin
  523. \(x
  524. \)
  525. }
  526. \)
  527. \cdot \cos
  528. \(x
  529. \)
  530. \cdot x}{
  531. \sin
  532. \(x
  533. \)
  534. ^{2}}\,dx}
  535. \cr}$$
  536. Time for test: 60 ms, plus GC time: 10 ms