defint.rlg 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128
  1. Tue Feb 10 12:28:32 2004 run on Linux
  2. *** ci already defined as operator
  3. *** si already defined as operator
  4. % Test cases for definite integration.
  5. int(x/(x+2),x,2,6);
  6. 2*( - log(2) + 2)
  7. int(sin x,x,0,pi/2);
  8. 1
  9. int(log(x),x,1,5);
  10. 5*log(5) - 4
  11. int((1+x**2/p**2)**(1/2),x,0,p);
  12. p*(sqrt(2) + log(sqrt(2) + 1))
  13. --------------------------------
  14. 2
  15. int(x**9+y+y**x+x,x,0,2);
  16. 2
  17. 10*log(y)*y + 522*log(y) + 5*y - 5
  18. -------------------------------------
  19. 5*log(y)
  20. % Collected by Kerry Gaskell, ZIB, 1993/94.
  21. int(x^2*log(1+x),x,0,infinity);
  22. 2
  23. int(x *log(1 + x),x,0,infinity)
  24. int(x*e^(-1/2x),x,0,infinity);
  25. 4
  26. int(x/4*e^(-1/2x),x,0,infinity);
  27. 1
  28. int(sqrt(2)*x^(1/2)*e^(-1/2x),x,0,infinity);
  29. 2*sqrt(pi)
  30. int(x^(3/2)*e^(-x),x,0,infinity);
  31. 3*sqrt(pi)
  32. ------------
  33. 4
  34. int(sqrt(pi)*x^(3/2)*e^(-x),x,0,infinity);
  35. 3*pi
  36. ------
  37. 4
  38. int(x*log(1+1/x),x,0,infinity);
  39. 1
  40. int(x*log(1 + ---),x,0,infinity)
  41. x
  42. int(si(1/x),x,0,infinity);
  43. 1
  44. int(si(---),x,0,infinity)
  45. x
  46. int(cos(1/x),x,0,infinity);
  47. 1
  48. int(cos(---),x,0,infinity)
  49. x
  50. int(sin(x^2),x,0,infinity);
  51. sqrt(pi)*sqrt(2)
  52. ------------------
  53. 4
  54. int(sin(x^(3/2)),x,0,infinity);
  55. 2/3 5
  56. sqrt(pi)*2 *gamma(---)
  57. 6
  58. --------------------------
  59. 2
  60. 3*gamma(---)
  61. 3
  62. int(besselj(2,x),x,0,infinity);
  63. 1
  64. int(besselj(2,y^(5/4)),y,0,infinity);
  65. 4/5 7
  66. 2*2 *gamma(---)
  67. 5
  68. -------------------
  69. 8
  70. 5*gamma(---)
  71. 5
  72. int(x^(-1)*besselj(2,sqrt(x)),x,0,infinity);
  73. 1
  74. int(bessely(2,x),x,0,infinity);
  75. int(bessely(2,x),x,0,infinity)
  76. int(x*besseli(2,x),x,0,infinity);
  77. int(x*besseli(2,x),x,0,infinity)
  78. int(besselk(0,x),x,0,infinity);
  79. pi
  80. ----
  81. 2
  82. int(x^2*besselk(2,x),x,0,infinity);
  83. 3*pi
  84. ------
  85. 2
  86. int(sinh(x),x,0,infinity);
  87. int(sinh(x),x,0,infinity)
  88. int(cosh(2*x),x,0,infinity);
  89. int(cosh(2*x),x,0,infinity)
  90. int(-3*ei(-x),x,0,infinity);
  91. 3
  92. int(x*shi(x),x,0,infinity);
  93. int(x*shi(x),x,0,infinity)
  94. int(x*fresnel_c(x),x,0,infinity);
  95. int(x*fresnel_c(x),x,0,infinity)
  96. int(x^3*e^(-2*x),x,0,infinity);
  97. 3
  98. ---
  99. 8
  100. int(x^(-1)*sin(x/3),x,0,infinity);
  101. pi
  102. ----
  103. 2
  104. int(x^(-1/2)*sin(x),x,0,infinity);
  105. sqrt(pi)*sqrt(2)
  106. ------------------
  107. 2
  108. int(2*x^(-1/2)*cos(x),x,0,infinity);
  109. sqrt(pi)*sqrt(2)
  110. int(sin x + cos x,x,0,infinity);
  111. int(sin(x) + cos(x),x,0,infinity)
  112. int(ei(-x) + sin(x^2),x,0,infinity);
  113. sqrt(pi)*sqrt(2) - 4
  114. ----------------------
  115. 4
  116. int(x^(-1)*(sin (-2*x) + sin(x^2)),x,0,infinity);
  117. - pi
  118. -------
  119. 4
  120. int(x^(-1)*(cos(x/2) - cos(x/3)),x,0,infinity);
  121. 3
  122. - log(---)
  123. 2
  124. int(x^(-1)*(cos x - cos(2*x)),x,0,infinity);
  125. log(2)
  126. int(x^(-1)*(cos(x) - cos(x)),x,0,infinity);
  127. 0
  128. int(2,x,0,infinity);
  129. int(2,x,0,infinity)
  130. int(cos(x)*si(x),x,0,infinity);
  131. int(cos(x)*si(x),x,0,infinity)
  132. int(2*cos(x)*e^(-x),x,0,infinity);
  133. 1
  134. int(x/2*cos(x)*e^(-x),x,0,infinity);
  135. 0
  136. int(x^2/4*cos(x)*e^(-2*x),x,0,infinity);
  137. 1
  138. -----
  139. 125
  140. int(1/(2*x)*sin(x)*e^(-3*x),x,0,infinity);
  141. 1
  142. atan(---)
  143. 3
  144. -----------
  145. 2
  146. int(3/x^2*sin(x)*e^(-x),x,0,infinity);
  147. 3 - x
  148. int(----*sin(x)*e ,x,0,infinity)
  149. 2
  150. x
  151. int(cos(sqrt(x))*e^(-x),x,0,infinity);
  152. i 1/4
  153. sqrt( - pi)*erf(---) + 2*e
  154. 2
  155. -------------------------------
  156. 1/4
  157. 2*e
  158. int(e^(-x)*besselj(2,x),x,0,infinity);
  159. - 2*sqrt(2) + 3
  160. ------------------
  161. sqrt(2)
  162. int(cos(x^2)*e^(-x),x,0,infinity);
  163. 1 1 1 1 1
  164. (pi*( - 2*cos(---)*fresnel_s(---) + cos(---) + 2*fresnel_c(---)*sin(---)
  165. 4 4 4 4 4
  166. 1
  167. - sin(---)))/(2*sqrt(pi)*sqrt(2))
  168. 4
  169. int(erf(x)*e^(-x),x,0,infinity);
  170. 1/4 1
  171. e *( - erf(---) + 1)
  172. 2
  173. int(besseli(2,x)*e^(-x),x,0,infinity);
  174. - 1 1
  175. 2*hypergeometric({------},{},1) + hypergeometric({---},{},1) - 2
  176. 2 2
  177. int(e^(-x^2)*cos(x),x,0,infinity);
  178. sqrt(pi)
  179. ----------
  180. 1/4
  181. 2*e
  182. int(x^(-1)*sin(x)*cos(x),x,0,infinity);
  183. pi
  184. ----
  185. 4
  186. int(x^(-1)*sin(x)*cos(2*x),x,0,infinity);
  187. 0
  188. int(x^(-1)*sin(x)*cos(x/2),x,0,infinity);
  189. pi
  190. ----
  191. 2
  192. int(e^x,x,0,infinity);
  193. x
  194. int(e ,x,0,infinity)
  195. int(e^(-x^2 - x),x,0,infinity);
  196. 1/4 1
  197. e *pi*( - erf(---) + 1)
  198. 2
  199. ---------------------------
  200. 2*sqrt(pi)
  201. int(e^(-(x+x^2+1)),x,0,infinity);
  202. 1/4 1
  203. e *pi*( - erf(---) + 1)
  204. 2
  205. ---------------------------
  206. 2*sqrt(pi)*e
  207. int(e^(-(x+1/x)^2),x,0,infinity);
  208. sqrt(pi)
  209. ----------
  210. 4
  211. 2*e
  212. int(e^(-(x+2))*sin(x),x,0,infinity);
  213. 1
  214. ------
  215. 2
  216. 2*e
  217. int(-3*x*e^(-1/2x),x,0,infinity);
  218. -12
  219. int(x*e^(-1/2*x^2),x,0,infinity);
  220. 1
  221. int(x^2*besselj(2,x),x,0,infinity);
  222. 2
  223. int(x *besselj(2,x),x,0,infinity)
  224. int(x*besselk(1,x),x,0,infinity);
  225. pi
  226. ----
  227. 2
  228. int(-3*ei(-x),x,0,infinity);
  229. 3
  230. int(x^3*e^(-2*x^2),x,0,infinity);
  231. 1
  232. ---
  233. 8
  234. int(sqrt(2)/2*x^(-3/2)*sin x,x,0,infinity);
  235. sqrt(pi)
  236. int(x^(-1)*(sin(-2*x) + sin(x^2)),x,0,infinity);
  237. - pi
  238. -------
  239. 4
  240. int(x^(-1)*(cos(3*x) - cos(x/2)),x,0,infinity);
  241. - log(6)
  242. int(x^(-1)*(sin x - sin(2*x)),x,0,infinity);
  243. 0
  244. int(1/x*sin(x)*e^(-3*x),x,0,infinity);
  245. 1
  246. atan(---)
  247. 3
  248. int(sin(x)*e^(-x),x,0,infinity);
  249. 1
  250. ---
  251. 2
  252. int(x^(-1)*sin(x)*cos(x),x,0,infinity);
  253. pi
  254. ----
  255. 4
  256. int(e^(1-x)*e^(2-x^2),x,0,infinity);
  257. 1/4 3 1
  258. e *e *pi*( - erf(---) + 1)
  259. 2
  260. ------------------------------
  261. 2*sqrt(pi)
  262. int(e^(-1/2x),x,0,y);
  263. y/2
  264. 2*(e - 1)
  265. --------------
  266. y/2
  267. e
  268. int(si(x),x,0,y);
  269. si(y)*y - 1 + cos(y)
  270. int(besselj(2,x^(1/4)),x,0,y);
  271. 1/4 1/4
  272. - 2*((8*sqrt(y) - y)*besselj(0,y ) - besselj(2,y )*y
  273. 1/4 1/4 1/4 1/4
  274. + 4*y *(y + 2)*(y - 2)*besselj(1,y ))
  275. int(x*besseli(2,x),x,0,y);
  276. - (2*(besseli(0,y) - 1) - besseli(1,y)*y)
  277. int(x^(3/2)*e^(-x),x,0,y);
  278. y
  279. 3*sqrt(pi)*e *erf(sqrt(y)) - 4*sqrt(y)*y - 6*sqrt(y)
  280. ------------------------------------------------------
  281. y
  282. 4*e
  283. int(sinh(x),x,0,y);
  284. y 2
  285. (e - 1)
  286. -----------
  287. y
  288. 2*e
  289. int(cosh(2*x),x,0,y);
  290. 2*y y y
  291. (e + 1)*(e + 1)*(e - 1)
  292. ------------------------------
  293. 2*y
  294. 4*e
  295. int(x*shi(x),x,0,y);
  296. y y 2
  297. - (e *(e *(y - 1) - 2*shi(y)*y ) + y + 1)
  298. --------------------------------------------
  299. y
  300. 4*e
  301. int(x^2*e^(-x^2),x,0,y);
  302. 2
  303. y
  304. sqrt(pi)*e *erf(y) - 2*y
  305. ---------------------------
  306. 2
  307. y
  308. 4*e
  309. int(x^(-1)/2*sin(x),x,0,y);
  310. si(y)
  311. -------
  312. 2
  313. int(sin x + cos x,x,0,y);
  314. sin(y) + 1 - cos(y)
  315. int(sin x + sin(-2*x),x,0,y);
  316. - (2*cos(y) - 1 - cos(2*y))
  317. ------------------------------
  318. 2
  319. int(sin(n*x),x,0,y);
  320. - (cos(n*y) - 1)
  321. -------------------
  322. n
  323. int(heaviside(x-1),x,0,y);
  324. (y - 1)*heaviside(y - 1)
  325. % Tests of transformations defined in defint package.
  326. laplace_transform(1,x);
  327. 1
  328. ---
  329. s
  330. laplace_transform(x,x);
  331. 1
  332. ----
  333. 2
  334. s
  335. laplace_transform(x^a/factorial(a),x);
  336. 1
  337. ------
  338. a
  339. s *s
  340. laplace_transform(x,e^(-a*x),x);
  341. 1
  342. -----------------
  343. 2 2
  344. a + 2*a*s + s
  345. laplace_transform(x^k,e^(-a*x),x);
  346. gamma(k + 1)
  347. -------------------------
  348. k k
  349. (a + s) *a + (a + s) *s
  350. laplace_transform(cosh(a*x),x);
  351. - s
  352. ---------
  353. 2 2
  354. a - s
  355. laplace_transform(1/(2*a^3),sinh(a*x)-sin(a*x),x);
  356. - 1
  357. ---------
  358. 4 4
  359. a - s
  360. laplace_transform(1/(a^2),1-cos(a*x),x);
  361. 1
  362. -----------
  363. 2 3
  364. a *s + s
  365. laplace_transform(1/(b^2-a^2),cos(a*x)-cos(b*x),x);
  366. s
  367. ----------------------------
  368. 2 2 2 2 2 2 4
  369. a *b + a *s + b *s + s
  370. laplace_transform(besselj(0,2*sqrt(k*x)),x);
  371. 1
  372. --------
  373. k/s
  374. e *s
  375. laplace_transform(Heaviside(x-1),x);
  376. 1
  377. ------
  378. s
  379. e *s
  380. laplace_transform(1/x,sin(k*x),x);
  381. k
  382. atan(---)
  383. s
  384. laplace_transform(1/(k*sqrt(pi)),e^(-x^2/(4*k^2)),x);
  385. 2 2 2 2
  386. k *s k *s
  387. - e *erf(k*s) + e
  388. laplace_transform(1/k,e^(-k^2/(4*x)),x);
  389. besselk(1,sqrt(s)*k)
  390. ----------------------
  391. sqrt(s)
  392. laplace_transform(2/(sqrt(pi*x)),besselk(0,2*sqrt(2*k*x)),x);
  393. k/s k
  394. e *besselk(0,---)
  395. s
  396. ---------------------
  397. sqrt(s)
  398. hankel_transform(x,x);
  399. n + 4
  400. gamma(-------)
  401. 2
  402. -------------------
  403. n - 2 2
  404. gamma(-------)*s
  405. 2
  406. Y_transform(x,x);
  407. - n + 4 n + 4
  408. gamma(----------)*gamma(-------)
  409. 2 2
  410. -------------------------------------
  411. - n + 3 n - 1 2
  412. gamma(----------)*gamma(-------)*s
  413. 2 2
  414. K_transform(x,x);
  415. - n + 4 n + 4
  416. gamma(----------)*gamma(-------)
  417. 2 2
  418. ----------------------------------
  419. 2
  420. 2*s
  421. struveh_transform(x,x);
  422. - n - 3 n + 5
  423. gamma(----------)*gamma(-------)
  424. 2 2
  425. -------------------------------------
  426. - n - 2 n - 2 2
  427. gamma(----------)*gamma(-------)*s
  428. 2 2
  429. fourier_sin(e^(-x),x);
  430. s
  431. --------
  432. 2
  433. s + 1
  434. fourier_sin(sqrt(x),e^(-1/2*x),x);
  435. 3*atan(2*s)
  436. 2*sin(-------------)*pi
  437. 2
  438. --------------------------------
  439. 2 3/4
  440. sqrt(pi)*(4*s + 1) *sqrt(2)
  441. fourier_sin(1/x,e^(-a*x),x);
  442. s
  443. atan(---)
  444. a
  445. fourier_sin(x^k,x);
  446. k/2 - k k
  447. 4 *gamma(------)*gamma(---)*k
  448. 2 2
  449. ---------------------------------
  450. k k
  451. 4*s *2 *gamma( - k)*s
  452. fourier_sin(1/(b-a),(e^(-a*x)-e^(-b*x)),x);
  453. a*s + b*s
  454. ----------------------------
  455. 2 2 2 2 2 2 4
  456. a *b + a *s + b *s + s
  457. fourier_sin(besselj(0,a*x),x);
  458. 2 2
  459. - a + s
  460. heaviside(------------)
  461. 2
  462. a
  463. -------------------------
  464. 2 2
  465. sqrt( - a + s )
  466. fourier_sin(1/sqrt(pi*x),cos(2*sqrt(k*x)),x);
  467. k k
  468. sqrt(s)*sqrt(2)*cos(---) - sqrt(s)*sqrt(2)*sin(---)
  469. s s
  470. -----------------------------------------------------
  471. 2*s
  472. fourier_sin(1/(k*sqrt(pi)),e^(-x^2/(4*k^2)),x);
  473. erf(i*k*s)*i
  474. --------------
  475. 2 2
  476. k *s
  477. e
  478. fourier_cos(e^(-1/2x),x);
  479. 2
  480. ----------
  481. 2
  482. 4*s + 1
  483. fourier_cos(x,e^(-x),x);
  484. 2
  485. - s + 1
  486. ---------------
  487. 4 2
  488. s + 2*s + 1
  489. fourier_cos(x,e^(-1/2*x^2),x);
  490. 2
  491. i*s s /2
  492. sqrt(pi)*erf(---------)*i*s + e *sqrt(2)
  493. sqrt(2)
  494. ---------------------------------------------
  495. 2
  496. s /2
  497. e *sqrt(2)
  498. fourier_cos(2*x^2,e^(-1/2x),x);
  499. 2
  500. - 384*s + 32
  501. ---------------------------
  502. 6 4 2
  503. 64*s + 48*s + 12*s + 1
  504. fourier_cos(x,e^(-a*x),x);
  505. 2 2
  506. a - s
  507. -------------------
  508. 4 2 2 4
  509. a + 2*a *s + s
  510. fourier_cos(x^n,e^(-a*x),x);
  511. s s
  512. cos(atan(---)*n + atan(---))*gamma(n + 1)
  513. a a
  514. -------------------------------------------
  515. 2 2 (n + 1)/2
  516. (a + s )
  517. fourier_cos(1/x,sin(k*x),x);
  518. 2 2
  519. sign(k - s )*pi + pi
  520. -----------------------
  521. 4
  522. fourier_cos(1/sqrt(pi*x),cos(2*sqrt(k*x)),x);
  523. k k
  524. sqrt(s)*sqrt(2)*cos(---) + sqrt(s)*sqrt(2)*sin(---)
  525. s s
  526. -----------------------------------------------------
  527. 2*s
  528. fourier_cos(1/(k*sqrt(pi)),e^(-x^2/(4*k^2)),x);
  529. 1
  530. --------
  531. 2 2
  532. k *s
  533. e
  534. fourier_cos(1/(pi*x),sin(2*k*sqrt(x)),x);
  535. 2 2
  536. k k
  537. intfc(----) + intfs(----)
  538. s s
  539. fourier_cos(1/(sqrt(pi*x)),e^(-2*k*sqrt(x)),x);
  540. 2 2 2
  541. k k k
  542. ( - 2*sqrt(s)*cos(----)*fresnel_s(----) + sqrt(s)*cos(----)
  543. s s s
  544. 2 2 2
  545. k k k
  546. + 2*sqrt(s)*fresnel_c(----)*sin(----) - sqrt(s)*sin(----))/(sqrt(2)*s)
  547. s s s
  548. laplace_transform(x^n/factorial(n)*e^(-a*x),x);
  549. 1
  550. -------------------------
  551. n n
  552. (a + s) *a + (a + s) *s
  553. laplace_transform(1/(2*a^2)*(cosh(a*x)-cos(a*x)),x);
  554. - s
  555. ---------
  556. 4 4
  557. a - s
  558. laplace_transform(k*a^k/x*besselj(k,a*x),x);
  559. 2*k
  560. a
  561. ----------------------
  562. 2 2 k
  563. (sqrt(a + s ) + s)
  564. fourier_sin(1/x*e^(-3*x),x);
  565. s
  566. atan(---)
  567. 3
  568. fourier_sin(1/(pi*x)*sin(2*k*sqrt(x)),x);
  569. 2 2
  570. k k
  571. intfc(----) - intfs(----)
  572. s s
  573. fourier_cos(x^n*e^(-a*x),x);
  574. s s
  575. cos(atan(---)*n + atan(---))*gamma(n + 1)
  576. a a
  577. -------------------------------------------
  578. 2 2 (n + 1)/2
  579. (a + s )
  580. fourier_cos(1/(k*sqrt(pi))*e^(-x^2/(4*k^2)),x);
  581. 1
  582. --------
  583. 2 2
  584. k *s
  585. e
  586. end;
  587. Time for test: 7010 ms, plus GC time: 300 ms