defint.tex 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. \documentstyle[11pt,reduce]{article}
  2. \date{July 1994}
  3. \title{A Definite Integration Interface for REDUCE}
  4. \author{Kerry Gaskell \\
  5. Konrad--Zuse--Zentrum f\"ur Informationstechnik Berlin\\
  6. Takustra\"se 7 \\
  7. D--14195 Berlin -- Dahlem \\
  8. Federal Republic of Germany \\[0.05in]
  9. E--mail: neun@zib.de\footnotemark[1]}
  10. \begin{document}
  11. \maketitle
  12. \footnotetext[1]{This definite integration interface was written
  13. during my one year placement at ZIB. Any comments and/or
  14. problems should therefore be directed to Winfried Neun at
  15. neun@zib.de.}
  16. \section{Introduction}
  17. This documentation describes part of \REDUCE's definite
  18. integration package that is able to calculate the definite integrals of
  19. many functions, including several special functions. There are other
  20. parts of this package, such as Stan Kameny's code for contour integration,
  21. that are not included here. The integration process described here is not
  22. the more normal approach of initially calculating the indefinite integral,
  23. but is instead the rather unusual idea of representing each function as a
  24. Meijer G-function (a formal definition of the Meijer G-function can be
  25. found in \cite {Prudnikov}), and then calculating the integral by using
  26. the following Meijer G integration formula.
  27. \begin{displaymath}
  28. \int_{0}^{\infty} x^{\alpha-1} G^{s t}_{u v}
  29. \left( \sigma x \ \Bigg\vert \ {( c_u) \atop (d_v)} \right)
  30. G^{m n}_{p q} \left( \omega x^{l/k} \ \Bigg\vert \ {(a_p) \atop (b_q)}
  31. \right) dx = k G^{i j}_{k l} \left( \xi \ \Bigg\vert \
  32. {(g_k) \atop (h_l)} \right) \hspace{5mm} (1)
  33. \end{displaymath}
  34. The resulting Meijer G-function is then retransformed, either directly
  35. or via a hypergeometric function simplification, to give
  36. the answer. A more detailed account of this theory can be found in
  37. \cite {Adamchik:90}.
  38. \section{Integration between zero and infinity}
  39. As an example, if one wishes to calculate the following integral
  40. \begin{displaymath}
  41. \int_{0}^{\infty} x^{-1} e^{-x} sin(x) \, dx
  42. \end{displaymath}
  43. then initially the correct Meijer G-functions are found, via a
  44. pattern matching
  45. process, and are substituted into (1) to give
  46. \begin{displaymath}
  47. \sqrt{\pi} \int_{0}^{\infty} x^{-1} G^{1 0}_{0 1} \left(x
  48. \ \Bigg\vert \
  49. {. \atop 0}\right) G^{1 0}_{0 2}\left(\frac{x^{2}}{4}
  50. \ \Bigg\vert \ {. \; . \atop \frac{1}{2} \; 0} \right) dx
  51. \end{displaymath}
  52. The cases for validity of the integral are then checked. If these
  53. are found to be satisfactory then the formula is calculated and we
  54. obtain the following Meijer G-function
  55. \begin{displaymath}
  56. G^{1 2}_{2 2} \left(1 \ \Bigg\vert \ {\frac{1}{2} \; 1 \atop
  57. \frac{1}{2} \; 0} \right)
  58. \end{displaymath}
  59. This is reduced to the following hypergeometric function
  60. \begin{math}
  61. \hspace{50mm} _2F_1 (\frac{1}{2},1;\frac{3}{2};-1 )
  62. \end{math}
  63. which is then calculated to give the correct answer of
  64. \begin{displaymath}
  65. \frac{\pi}{4}
  66. \end{displaymath}
  67. The above formula (1) is also true for the integration of a single
  68. Meijer G-function by replacing the second Meijer G-function
  69. with a trivial Meijer G-function.
  70. A list of numerous particular Meijer G-functions is available in
  71. \cite {Prudnikov}.
  72. \section{Integration over other ranges}
  73. Although the description so far has been limited to the computation of
  74. definite integrals between 0 and infinity, it can also be extended to
  75. calculate integrals between 0 and some specific upper bound, and
  76. by further extension, integrals between any two bounds. One approach is
  77. to use the Heaviside function, i.e.
  78. \begin{displaymath}
  79. \int_{0}^{\infty} x^{2} e^{-x} H(1-x)\,dx = \int_{0}^{1} x^{2} e^{-x}dx
  80. \end{displaymath}
  81. Another approach, again not involving the normal indefinite integration
  82. process, again uses Meijer G-functions, this time by means of the
  83. following formula
  84. \begin{displaymath}
  85. \int_{0}^{y} x^{\alpha-1} G^{m n}_{p q}
  86. \left( \sigma x \ \Bigg\vert \ {( a_u) \atop (b_v)} \right) dx=%
  87. y^{\alpha}\,G^{m \; n+1}_{p+1 \; q+1} \left( \sigma y \ \Bigg\vert \
  88. {( a_1..a_n,1-\alpha,a_{n+1}..a_p)
  89. \atop (b_1..b_m,-\alpha,b_{m+1}..b_q)} \right) (2)
  90. \end{displaymath}
  91. For a more detailed look at the theory behind this see
  92. \cite{Adamchik:90}.
  93. For example, if one wishes to calculate the following integral
  94. \begin{displaymath}
  95. \int_{0}^{y} sin(2 \sqrt{x}) \, dx
  96. \end{displaymath}
  97. then initially the correct Meijer G-function is found, by a pattern
  98. matching process, and is substituted
  99. into (2) to give
  100. \begin{displaymath}
  101. \int_{0}^{y} G^{1 0}_{0 2}\left(x
  102. \ \Bigg\vert \ {. \; . \atop \frac{1}{2} \; 0} \right) dx
  103. \end{displaymath}
  104. which then in turn gives
  105. \begin{displaymath}
  106. y \; G^{1 1}_{1 3}\left(y \ \Bigg\vert \ {0 \atop
  107. \frac{1}{2} -\!1 \; 0} \right) dx
  108. \end{displaymath}
  109. and returns the result
  110. \begin{displaymath}
  111. \frac{\sqrt{\pi} \, J_{3/2}(2 \, \sqrt{\,y}) \, y}{y^{1/4}}
  112. \end{displaymath}
  113. \section{Using the definite integration package}
  114. To use this package, you must first load it by the command
  115. \begin{verbatim}
  116. load_package defint;
  117. \end{verbatim}
  118. Definite integration is then possible using the \verb+int+
  119. command with the syntax:
  120. \begin{verbatim}
  121. INT(EXPRN:algebraic,VAR:kernel,LOW:algebraic,UP:algebraic)
  122. :algebraic.
  123. \end{verbatim}
  124. where LOW and UP are the lower and upper bounds respectively for
  125. the definite integration of EXPRN with respect to VAR.
  126. \subsection{Examples}
  127. \begin{displaymath}
  128. \int_{0}^{\infty} e^{-x} dx
  129. \end{displaymath}
  130. \begin{verbatim}
  131. int(e^(-x),x,0,infinity);
  132. 1
  133. \end{verbatim}
  134. \begin{displaymath}
  135. \int_{0}^{\infty} x sin(1/x) \, dx
  136. \end{displaymath}
  137. \begin{verbatim}
  138. int(x*sin(1/x),x,0,infinity);
  139. 1
  140. INT(X*SIN(---),X,0,INFINITY)
  141. X
  142. \end{verbatim}
  143. \begin{displaymath}
  144. \int_{0}^{\infty} x^2 cos(x) \, e^{-2x} dx
  145. \end{displaymath}
  146. \begin{verbatim}
  147. int(x^2*cos(x)*e^(-2*x),x,0,infinity);
  148. 4
  149. -----
  150. 125
  151. \end{verbatim}
  152. \begin{displaymath}
  153. \int_{0}^{\infty} x e^{-1/2x} H(1-x) \,dx = \int_{0}^{1} x e^{-1/2x} dx
  154. \end{displaymath}
  155. \begin{verbatim}
  156. int(x*e^(-1/2x)*Heaviside(1-x),x,0,infinity);
  157. 2*(2*SQRT(E) - 3)
  158. -------------------
  159. SQRT(E)
  160. \end{verbatim}
  161. \begin{displaymath}
  162. \int_{0}^{1} x \,log(1+x) \,dx
  163. \end{displaymath}
  164. \begin{verbatim}
  165. int(x*log(1+x),x,0,1);
  166. 1
  167. ---
  168. 4
  169. \end{verbatim}
  170. \begin{displaymath}
  171. \int_{0}^{y} cos(2x) \,dx
  172. \end{displaymath}
  173. \begin{verbatim}
  174. int(cos(2x),x,y,2y);
  175. SIN(4*Y) - SIN(2*Y)
  176. ---------------------
  177. 2
  178. \end{verbatim}
  179. \section{Integral Transforms}
  180. A useful application of the definite integration package is in the
  181. calculation of various integral transforms. The transforms
  182. available are as follows:
  183. \begin{itemize}
  184. \item Laplace transform
  185. \item Hankel transform
  186. \item Y-transform
  187. \item K-transform
  188. \item StruveH transform
  189. \item Fourier sine transform
  190. \item Fourier cosine transform
  191. \end{itemize}
  192. \subsection{Laplace transform}
  193. The Laplace transform
  194. $\hspace{20 mm} f(s) = \cal L$ \{F(t)\} =
  195. $\int_{0}^{\infty} e^{-st}F(t)\,dt$
  196. can be calculated by using the \verb+laplace_transform+ command.
  197. This requires as parameters
  198. \begin{itemize}
  199. \item the function to be integrated
  200. \item the integration variable.
  201. \end{itemize}
  202. For example
  203. $\hspace{56 mm} \cal L$ $\{e^{-at}\} \\$
  204. is entered as
  205. \begin{verbatim}
  206. laplace_transform(e^(-a*x),x);
  207. \end{verbatim}
  208. and returns the result
  209. \begin{displaymath}
  210. \frac{1}{s+a}
  211. \end{displaymath}
  212. \subsection{Hankel transform}
  213. The Hankel transform
  214. \begin{displaymath}
  215. f(\omega) = \int_{0}^{\infty} F(t) \,J_{\nu}(2\sqrt{\omega t}) \,dt
  216. \end{displaymath}
  217. can be calculated by using the \verb+hankel_transform+ command e.g.
  218. \begin{verbatim}
  219. hankel_transform(f(x),x);
  220. \end{verbatim}
  221. This is used in the same way as the \verb+laplace_transform+ command.
  222. \subsection{Y-transform}
  223. The Y-transform
  224. \begin{displaymath}
  225. f(\omega) = \int_{0}^{\infty} F(t) \,Y_{\nu}(2\sqrt{\omega t}) \,dt
  226. \end{displaymath}
  227. can be calculated by using the \verb+Y_transform+ command e.g.
  228. \begin{verbatim}
  229. Y_transform(f(x),x);
  230. \end{verbatim}
  231. This is used in the same way as the \verb+laplace_transform+ command.
  232. \subsection{K-transform}
  233. The K-transform
  234. \begin{displaymath}
  235. f(\omega) = \int_{0}^{\infty} F(t) \,K_{\nu}(2\sqrt{\omega t}) \,dt
  236. \end{displaymath}
  237. can be calculated by using the \verb+K_transform+ command e.g.
  238. \begin{verbatim}
  239. K_transform(f(x),x);
  240. \end{verbatim}
  241. This is used in the same way as the \verb+laplace_transform+ command.
  242. \subsection{StruveH transform}
  243. The StruveH transform
  244. \begin{displaymath}
  245. f(\omega) = \int_{0}^{\infty} F(t) \,StruveH(\nu,2\sqrt{\omega t}) \,dt
  246. \end{displaymath}
  247. can be calculated by using the \verb+struveh_transform+ command e.g.
  248. \begin{verbatim}
  249. struveh_transform(f(x),x);
  250. \end{verbatim}
  251. This is used in the same way as the \verb+laplace_transform+ command.
  252. \subsection{Fourier sine transform}
  253. The Fourier sine transform
  254. \begin{displaymath}
  255. f(s) = \int_{0}^{\infty} F(t) \,sin (st) \,dt
  256. \end{displaymath}
  257. can be calculated by using the \verb+fourier_sin+ command e.g.
  258. \begin{verbatim}
  259. fourier_sin(f(x),x);
  260. \end{verbatim}
  261. This is used in the same way as the \verb+laplace_transform+ command.
  262. \subsection{Fourier cosine transform}
  263. The Fourier cosine transform
  264. \begin{displaymath}
  265. f(s) = \int_{0}^{\infty} F(t) \,cos (st) \,dt
  266. \end{displaymath}
  267. can be calculated by using the \verb+fourier_cos+ command e.g.
  268. \begin{verbatim}
  269. fourier_cos(f(x),x);
  270. \end{verbatim}
  271. This is used in the same way as the \verb+laplace_transform+ command.
  272. \section{Additional Meijer G-function Definitions}
  273. The relevant Meijer G representation for any function is found by a
  274. pattern-matching process which is carried out on a list of Meijer
  275. G-function definitions. This list, although extensive, can never hope
  276. to be complete and therefore the user may wish to add more definitions.
  277. Definitions can be added by adding the following lines:
  278. \begin{verbatim}
  279. defint_choose(f(~x),~var => f1(n,x);
  280. symbolic putv(mellin!-transforms!*,n,'
  281. (() (m n p q) (ai) (bj) (C) (var)));
  282. \end{verbatim}
  283. where f(x) is the new function, i = 1..p, j=1..q, C = a constant,
  284. %where i = 1..p, j=1..q, C = a constant,
  285. var = variable, n = an indexing number.
  286. For example when considering $cos (x)$ we have
  287. \it Meijer G representation -
  288. \begin{displaymath}
  289. \sqrt{\pi} \,G^{1 0}_{0 2}\left(\frac{x^{2}}{4} \ \Bigg\vert
  290. \ { . \; . \atop 0 \; \frac{1}{2}} \right) dx
  291. \end{displaymath}
  292. \it Internal definite integration package representation -
  293. \begin{verbatim}
  294. defint_choose(cos(~x),~var) => f1(3,x);
  295. \end{verbatim}
  296. \rm where 3 is the indexing number corresponding to the 3
  297. in the following formula
  298. \begin{verbatim}
  299. symbolic putv(mellin!-transforms!*,3,'
  300. (() (1 0 0 2) () (nil (quotient 1 2))
  301. (sqrt pi) (quotient (expt x 2) 4)));
  302. \end{verbatim}
  303. or the more interesting example of $J_{n}(x)$:
  304. \it Meijer G representation -
  305. \begin{displaymath}
  306. G^{1 0}_{0 2} \left(\frac{x^{2}}{4} \ \Bigg\vert
  307. \ {. \; . \atop \frac{n}{2} \; {\frac{-n}{2}}} \right) dx
  308. \end{displaymath}
  309. \it Internal definite integration package representation -
  310. \begin{verbatim}
  311. defint_choose(besselj(~n,~x),~var) => f1(50,x,n);
  312. symbolic putv(mellin!-transforms!*,50,'
  313. ((n) (1 0 0 2) () ((quotient n 2)
  314. (minus quotient n 2)) 1
  315. (quotient (expt x 2) 4)));
  316. \end{verbatim}
  317. \section{The print\_conditions function}
  318. \rm The required conditions for the validity of the transform integrals
  319. can be viewed using the following command:
  320. \begin{verbatim}
  321. print_conditions().
  322. \end{verbatim}
  323. For example after calculating the following laplace transform
  324. \begin{verbatim}
  325. laplace_transform(x^k,x);
  326. \end{verbatim}
  327. using the \verb+print_conditions+ command would produce
  328. \begin{verbatim}
  329. repart(sum(ai) - sum(bj)) + 1/2 (q + 1 - p)>(q - p) repart(s)
  330. and ( - min(repart(bj))<repart(s))<1 - max(repart(ai))
  331. or mod(arg(eta))=pi*delta
  332. or ( - min(repart(bj))<repart(s))<1 - max(repart(ai))
  333. or mod(arg(eta))<pi*delta
  334. \end{verbatim}
  335. where
  336. \begin{displaymath}
  337. \begin{array}{ll}
  338. delta = s+t-\frac{u-v}{2}\\
  339. eta = 1-\alpha(v-u)-\mu-\rho\\
  340. \mu = \sum_{j=1}^{q} b_{j} - \sum_{i=1}^{p} a_{i} + \frac{p-q}{2} + 1\\
  341. \rho = \sum_{j=1}^{v} d{j} - \sum_{i=1}^{u} c_{i} + \frac{u-v}{2} + 1\\
  342. s,t,u,v,p,q,\alpha \; {\rm as \; in \; (1)}
  343. \end{array}
  344. \end{displaymath}
  345. \section{Acknowledgements}
  346. I would like to thank Victor Adamchik whose implementation of the
  347. definite integration package for \REDUCE is vital to this
  348. interface.
  349. \begin{thebibliography}{}
  350. \bibitem{Prudnikov} A.P. Prudnikov, Yu.A. Brychkov and O.I. Marichev,
  351. {\em Integrals and Series, Volume 3: More Special Functions} Gordon
  352. and Breach Science Publishers (1990)
  353. \bibitem{Adamchik:90} V.S. Adamchik and O.I. Marichev, {\em The
  354. Algorithm for Calculating Integrals of Hypergeometric Type Functions
  355. and its Realization in Reduce System} from {\em ISSAC 90:Symbolic and
  356. Algebraic Computation} Addison-Wesley Publishing Company (1990)
  357. \bibitem{Luke} Yudell L. Luke, {\em The Special Functions and their
  358. Approximations, Volume 1} Academic Press (1969).
  359. \end{thebibliography}
  360. \end{document}