2 * Introduction to Special Functions::
5 * Gamma and factorial Functions::
6 * Exponential Integrals::
9 * Hypergeometric Functions::
10 * Parabolic Cylinder Functions::
11 * Functions and Variables for Special Functions::
14 @c -----------------------------------------------------------------------------
15 @node Introduction to Special Functions, Bessel Functions, Special Functions, Special Functions
16 @section Introduction to Special Functions
17 @c -----------------------------------------------------------------------------
19 Special function notation follows:
22 bessel_j (index, expr) Bessel function, 1st kind
23 bessel_y (index, expr) Bessel function, 2nd kind
24 bessel_i (index, expr) Modified Bessel function, 1st kind
25 bessel_k (index, expr) Modified Bessel function, 2nd kind
27 hankel_1 (v,z) Hankel function of the 1st kind
28 hankel_2 (v,z) Hankel function of the 2nd kind
29 struve_h (v,z) Struve H function
30 struve_l (v,z) Struve L function
32 assoc_legendre_p[v,u] (z) Legendre function of degree v and order u
33 assoc_legendre_q[v,u] (z) Legendre function, 2nd kind
35 %f[p,q] ([], [], expr) Generalized Hypergeometric function
36 gamma (z) Gamma function
37 gamma_incomplete_lower (a,z) Lower incomplete gamma function
38 gamma_incomplete (a,z) Tail of incomplete gamma function
39 hypergeometric (l1, l2, z) Hypergeometric function
40 @c IS slommel THE "LOMMEL" FUNCTION ?? NOT OTHERWISE MENTIONED IN TEXINFO FILES
42 %m[u,k] (z) Whittaker function, 1st kind
43 %w[u,k] (z) Whittaker function, 2nd kind
44 erfc (z) Complement of the erf function
46 expintegral_e (v,z) Exponential integral E
47 expintegral_e1 (z) Exponential integral E1
48 expintegral_ei (z) Exponential integral Ei
49 expintegral_li (z) Logarithmic integral Li
50 expintegral_si (z) Exponential integral Si
51 expintegral_ci (z) Exponential integral Ci
52 expintegral_shi (z) Exponential integral Shi
53 expintegral_chi (z) Exponential integral Chi
55 kelliptic (z) Complete elliptic integral of the first
57 parabolic_cylinder_d (v,z) Parabolic cylinder D function
60 @opencatbox{Categories:}
61 @category{Bessel functions}
62 @category{Airy functions}
63 @category{Special functions}
66 @c -----------------------------------------------------------------------------
67 @node Bessel Functions, Airy Functions, Introduction to Special Functions, Special Functions
68 @section Bessel Functions
69 @c -----------------------------------------------------------------------------
71 @c -----------------------------------------------------------------------------
73 @deffn {Function} bessel_j (@var{v}, @var{z})
75 The Bessel function of the first kind of order @math{v} and argument @math{z}.
77 @code{bessel_j} is defined as
82 ==== k - v - 2 k v + 2 k
84 > --------------------------
92 $$\sum_{k=0}^{\infty }{{{\left(-1\right)^{k}\,\left(z\over 2\right)^{v+2\,k}
93 }\over{k!\,\Gamma\left(v+k+1\right)}}}$$
96 although the infinite series is not used for computations.
98 @opencatbox{Categories:}
99 @category{Bessel functions}
100 @category{Special functions}
104 @c -----------------------------------------------------------------------------
106 @deffn {Function} bessel_y (@var{v}, @var{z})
108 The Bessel function of the second kind of order @math{v} and argument @math{z}.
110 @code{bessel_y} is defined as
113 cos(%pi v) bessel_j(v, z) - bessel_j(-v, z)
114 -------------------------------------------
120 $${{\cos \left(\pi\,v\right)\,J_{v}(z)-J_{-v}(z)}\over{
121 \sin \left(\pi\,v\right)}}$$
124 when @math{v} is not an integer. When @math{v} is an integer @math{n},
125 the limit as @math{v} approaches @math{n} is taken.
127 @opencatbox{Categories:}
128 @category{Bessel functions}
129 @category{Special functions}
133 @c -----------------------------------------------------------------------------
135 @deffn {Function} bessel_i (@var{v}, @var{z})
137 The modified Bessel function of the first kind of order @math{v} and argument
140 @code{bessel_i} is defined as
144 ==== - v - 2 k v + 2 k
146 > -------------------
147 / k! gamma(v + k + 1)
154 $$\sum_{k=0}^{\infty } {{1\over{k!\,\Gamma
155 \left(v+k+1\right)}} {\left(z\over 2\right)^{v+2\,k}}}$$
158 although the infinite series is not used for computations.
160 @opencatbox{Categories:}
161 @category{Bessel functions}
162 @category{Special functions}
166 @c -----------------------------------------------------------------------------
168 @deffn {Function} bessel_k (@var{v}, @var{z})
170 The modified Bessel function of the second kind of order @math{v} and argument
173 @code{bessel_k} is defined as
176 %pi csc(%pi v) (bessel_i(-v, z) - bessel_i(v, z))
177 -------------------------------------------------
182 $${{\pi\,\csc \left(\pi\,v\right)\,\left(I_{-v}(z)-I_{v}(z)\right)}\over{2}}$$
185 when @math{v} is not an integer. If @math{v} is an integer @math{n},
186 then the limit as @math{v} approaches @math{n} is taken.
188 @opencatbox{Categories:}
189 @category{Bessel functions}
190 @category{Special functions}
194 @c -----------------------------------------------------------------------------
196 @deffn {Function} hankel_1 (@var{v}, @var{z})
198 The Hankel function of the first kind of order @math{v} and argument @math{z}
199 (A&S 9.1.3). @code{hankel_1} is defined as
202 bessel_j(v,z) + %i * bessel_y(v,z)
205 Maxima evaluates @code{hankel_1} numerically for a complex order @math{v} and
206 complex argument @math{z} in float precision. The numerical evaluation in
207 bigfloat precision is not supported.
209 When @code{besselexpand} is @code{true}, @code{hankel_1} is expanded in terms
210 of elementary functions when the order @math{v} is half of an odd integer.
211 See @code{besselexpand}.
213 Maxima knows the derivative of @code{hankel_1} wrt the argument @math{z}.
217 Numerical evaluation:
221 @c hankel_1(1,0.5+%i);
225 (%i1) hankel_1(1,0.5);
226 (%o1) 0.24226845767487 - 1.471472392670243 %i
229 (%i2) hankel_1(1,0.5+%i);
230 (%o2) - 0.25582879948621 %i - 0.23957560188301
234 Expansion of @code{hankel_1} when @code{besselexpand} is @code{true}:
237 @c hankel_1(1/2,z),besselexpand:true;
241 (%i1) hankel_1(1/2,z),besselexpand:true;
242 sqrt(2) sin(z) - sqrt(2) %i cos(z)
243 (%o1) ----------------------------------
248 Derivative of @code{hankel_1} wrt the argument @math{z}. The derivative wrt the
249 order @math{v} is not supported. Maxima returns a noun form:
252 @c diff(hankel_1(v,z),z);
253 @c diff(hankel_1(v,z),v);
257 (%i1) diff(hankel_1(v,z),z);
258 hankel_1(v - 1, z) - hankel_1(v + 1, z)
259 (%o1) ---------------------------------------
263 (%i2) diff(hankel_1(v,z),v);
265 (%o2) -- (hankel_1(v, z))
270 @opencatbox{Categories:}
271 @category{Bessel functions}
272 @category{Special functions}
276 @c -----------------------------------------------------------------------------
278 @deffn {Function} hankel_2 (@var{v}, @var{z})
280 The Hankel function of the second kind of order @math{v} and argument @math{z}
281 (A&S 9.1.4). @code{hankel_2} is defined as
284 bessel_j(v,z) - %i * bessel_y(v,z)
287 Maxima evaluates @code{hankel_2} numerically for a complex order @math{v} and
288 complex argument @math{z} in float precision. The numerical evaluation in
289 bigfloat precision is not supported.
291 When @code{besselexpand} is @code{true}, @code{hankel_2} is expanded in terms
292 of elementary functions when the order @math{v} is half of an odd integer.
293 See @code{besselexpand}.
295 Maxima knows the derivative of @code{hankel_2} wrt the argument @math{z}.
297 For examples see @code{hankel_1}.
299 @opencatbox{Categories:}
300 @category{Bessel functions}
301 @category{Special functions}
305 @c -----------------------------------------------------------------------------
306 @anchor{besselexpand}
307 @defvr {Option variable} besselexpand
308 Default value: @code{false}
311 Controls expansion of the Bessel functions when the order is half of
312 an odd integer. In this case, the Bessel functions can be expanded
313 in terms of other elementary functions. When @code{besselexpand} is @code{true},
314 the Bessel function is expanded.
317 (%i1) besselexpand: false$
318 (%i2) bessel_j (3/2, z);
322 (%i3) besselexpand: true$
323 (%i4) bessel_j (3/2, z);
325 sqrt(2) sqrt(z) (------ - ------)
328 (%o4) ---------------------------------
332 @opencatbox{Categories:}
333 @category{Bessel functions}
334 @category{Simplification flags and variables}
335 @category{Special functions}
339 @c -----------------------------------------------------------------------------
340 @anchor{scaled_bessel_i}
341 @deffn {Function} scaled_bessel_i (@var{v}, @var{z})
343 The scaled modified Bessel function of the first kind of order
344 @math{v} and argument @math{z}. That is, @math{scaled\_bessel_i(v,z) =
345 exp(-abs(z))*bessel_i(v, z)}. This function is particularly useful
346 for calculating @math{bessel_i} for large @math{z}, which is large.
347 However, maxima does not otherwise know much about this function. For
348 symbolic work, it is probably preferable to work with the expression
349 @code{exp(-abs(z))*bessel_i(v, z)}.
351 @opencatbox{Categories:}
352 @category{Bessel functions}
356 @anchor{scaled_bessel_i0}
357 @deffn {Function} scaled_bessel_i0 (@var{z})
359 Identical to @code{scaled_bessel_i(0,z)}.
361 @opencatbox{Categories:}
362 @category{Bessel functions}
363 @category{Special functions}
367 @c -----------------------------------------------------------------------------
368 @anchor{scaled_bessel_i1}
369 @deffn {Function} scaled_bessel_i1 (@var{z})
371 Identical to @code{scaled_bessel_i(1,z)}.
372 @opencatbox{Categories:}
373 @category{Bessel functions}
374 @category{Special functions}
378 @c -----------------------------------------------------------------------------
379 @deffn {Function} %s [@var{u},@var{v}] (@var{z})
380 Lommel's little s[u,v](z) function.
381 Probably Gradshteyn & Ryzhik 8.570.1.
382 @opencatbox{Categories:}
383 @category{Bessel functions}
384 @category{Special functions}
388 @c -----------------------------------------------------------------------------
389 @node Airy Functions, Gamma and factorial Functions, Bessel Functions, Special Functions
390 @section Airy Functions
391 @c -----------------------------------------------------------------------------
393 The Airy functions Ai(x) and Bi(x) are defined in Abramowitz and Stegun,
394 @i{Handbook of Mathematical Functions}, Section 10.4.
396 @code{y = Ai(x)} and @code{y = Bi(x)} are two linearly independent solutions
397 of the Airy differential equation @code{diff (y(x), x, 2) - x y(x) = 0}.
399 If the argument @code{x} is a real or complex floating point
400 number, the numerical value of the function is returned.
403 @deffn {Function} airy_ai (@var{x})
404 The Airy function Ai(x). (A&S 10.4.2)
406 The derivative @code{diff (airy_ai(x), x)} is @code{airy_dai(x)}.
408 See also @mrefcomma{airy_bi} @mrefcomma{airy_dai} @mrefdot{airy_dbi}
410 @opencatbox{Categories:}
411 @category{Airy functions}
412 @category{Special functions}
416 @c -----------------------------------------------------------------------------
418 @deffn {Function} airy_dai (@var{x})
419 The derivative of the Airy function Ai @code{airy_ai(x)}.
423 @opencatbox{Categories:}
424 @category{Airy functions}
425 @category{Special functions}
429 @c -----------------------------------------------------------------------------
431 @deffn {Function} airy_bi (@var{x})
432 The Airy function Bi(x). (A&S 10.4.3)
434 The derivative @code{diff (airy_bi(x), x)} is @code{airy_dbi(x)}.
436 See @code{airy_ai}, @code{airy_dbi}.
438 @opencatbox{Categories:}
439 @category{Airy functions}
440 @category{Special functions}
444 @c -----------------------------------------------------------------------------
446 @deffn {Function} airy_dbi (@var{x})
447 The derivative of the Airy Bi function @code{airy_bi(x)}.
449 See @code{airy_ai} and @code{airy_bi}.
451 @opencatbox{Categories:}
452 @category{Airy functions}
453 @category{Special functions}
457 @c -----------------------------------------------------------------------------
458 @node Gamma and factorial Functions, Exponential Integrals, Airy Functions, Special Functions
459 @section Gamma and factorial Functions
460 @c -----------------------------------------------------------------------------
462 The gamma function and the related beta, psi and incomplete gamma
463 functions are defined in Abramowitz and Stegun,
464 @i{Handbook of Mathematical Functions}, Chapter 6.
466 @c FOLLOWING FUNCTIONS IN bffac.mac ARE NOT DESCRIBED IN .texi FILES: !!!
467 @c obfac, azetb, vonschtoonk, divrlst, obzeta, bfhzeta, bfpsi0 !!!
468 @c DON'T KNOW WHICH ONES ARE INTENDED FOR GENERAL USE !!!
470 @c FOLLOWING FUNCTIONS IN bffac.mac ARE DESCRIBED IN Number.texi: !!!
471 @c burn, bzeta, bfzeta !!!
473 @c FOLLOWING FUNCTIONS IN bffac.mac ARE DESCRIBED HERE: !!!
474 @c bfpsi, bffac, cbffac !!!
476 @c -----------------------------------------------------------------------------
478 @deffn {Function} bffac (@var{expr}, @var{n})
480 Bigfloat version of the factorial (shifted gamma)
481 function. The second argument is how many digits to retain and return,
482 it's a good idea to request a couple of extra.
484 @opencatbox{Categories:}
485 @category{Gamma and factorial functions}
486 @category{Numerical evaluation}
490 @c -----------------------------------------------------------------------------
492 @deffn {Function} bfpsi (@var{n}, @var{z}, @var{fpprec})
493 @deffnx {Function} bfpsi0 (@var{z}, @var{fpprec})
495 @code{bfpsi} is the polygamma function of real argument @var{z} and integer
496 order @var{n}. @code{bfpsi0} is the digamma function.
497 @code{bfpsi0 (@var{z}, @var{fpprec})} is equivalent to
498 @code{bfpsi (0, @var{z}, @var{fpprec})}.
500 These functions return bigfloat values.
501 @var{fpprec} is the bigfloat precision of the return value.
503 @c psi0(1) = -%gamma IS AN INTERESTING PROPERTY BUT IN THE ABSENCE OF ANY OTHER
504 @c DISCUSSION OF THE PROPERTIES OF THIS FUNCTION, THIS STATEMENT SEEMS OUT OF PLACE.
505 @c Note @code{-bfpsi0 (1, fpprec)} provides @code{%gamma} (Euler's constant) as a bigfloat.
507 @opencatbox{Categories:}
508 @category{Gamma and factorial functions}
509 @category{Numerical evaluation}
513 @c -----------------------------------------------------------------------------
515 @deffn {Function} cbffac (@var{z}, @var{fpprec})
516 Complex bigfloat factorial.
518 @code{load ("bffac")} loads this function.
520 @opencatbox{Categories:}
521 @category{Gamma and factorial functions}
522 @category{Complex variables}
523 @category{Numerical evaluation}
527 @c -----------------------------------------------------------------------------
529 @deffn {Function} gamma (@var{z})
531 The basic definition of the gamma function (A&S 6.1.1) is
545 $$\Gamma\left(z\right)=\int_{0}^{\infty }{t^{z-1}\,e^ {- t }\;dt}$$
548 Maxima simplifies @code{gamma} for positive integer and positive and negative
549 rational numbers. For half integral values the result is a rational number times
550 @code{sqrt(%pi)}. The simplification for integer values is controlled by
551 @code{factlim}. For integers greater than @code{factlim} the numerical result of
552 the factorial function, which is used to calculate @code{gamma}, will overflow.
553 The simplification for rational numbers is controlled by @code{gammalim} to
554 avoid internal overflow. See @code{factlim} and @code{gammalim}.
556 For negative integers @code{gamma} is not defined.
558 Maxima can evaluate @code{gamma} numerically for real and complex values in float
559 and bigfloat precision.
561 @code{gamma} has mirror symmetry.
563 When @code{gamma_expand} is @code{true}, Maxima expands @code{gamma} for
564 arguments @code{z+n} and @code{z-n} where @code{n} is an integer.
566 Maxima knows the derivative of @code{gamma}.
570 Simplification for integer, half integral, and rational numbers:
573 (%i1) map('gamma,[1,2,3,4,5,6,7,8,9]);
574 (%o1) [1, 1, 2, 6, 24, 120, 720, 5040, 40320]
575 (%i2) map('gamma,[1/2,3/2,5/2,7/2]);
576 sqrt(%pi) 3 sqrt(%pi) 15 sqrt(%pi)
577 (%o2) [sqrt(%pi), ---------, -----------, ------------]
579 (%i3) map('gamma,[2/3,5/3,7/3]);
581 2 gamma(-) 4 gamma(-)
583 (%o3) [gamma(-), ----------, ----------]
587 Numerical evaluation for real and complex values:
590 (%i4) map('gamma,[2.5,2.5b0]);
591 (%o4) [1.329340388179137, 1.3293403881791370205b0]
592 (%i5) map('gamma,[1.0+%i,1.0b0+%i]);
593 (%o5) [0.498015668118356 - .1549498283018107 %i,
594 4.9801566811835604272b-1 - 1.5494982830181068513b-1 %i]
597 @code{gamma} has mirror symmetry:
600 (%i6) declare(z,complex)$
601 (%i7) conjugate(gamma(z));
602 (%o7) gamma(conjugate(z))
605 Maxima expands @code{gamma(z+n)} and @code{gamma(z-n)}, when @code{gamma_expand}
609 (%i8) gamma_expand:true$
611 (%i9) [gamma(z+1),gamma(z-1),gamma(z+2)/gamma(z+1)];
613 (%o9) [z gamma(z), --------, z + 1]
617 The derivative of @code{gamma}:
620 (%i10) diff(gamma(z),z);
621 (%o10) psi (z) gamma(z)
625 See also @mrefdot{makegamma}
627 The Euler-Mascheroni constant is @code{%gamma}.
629 @opencatbox{Categories:}
630 @category{Gamma and factorial functions}
631 @category{Special functions}
635 @c -----------------------------------------------------------------------------
636 @deffn {Function} log_gamma (@var{z})
638 The natural logarithm of the gamma function.
640 @opencatbox{Categories:}
641 @category{Gamma and factorial functions}
642 @category{Special functions}
646 @c -----------------------------------------------------------------------------
647 @deffn {Function} gamma_incomplete_lower (@var{a}, @var{z})
649 The lower incomplete gamma function (A&S 6.5.2):
656 gamma_incomplete_lower(a, z) = I t %e dt
663 $$\gamma\left(a , z\right)=\int_{0}^{z}{t^{a-1}\,e^ {- t }\;dt}$$
666 See also @mref{gamma_incomplete} (upper incomplete gamma function).
668 @opencatbox{Categories:}
669 @category{Gamma and factorial functions}
670 @category{Special functions}
674 @c -----------------------------------------------------------------------------
675 @anchor{gamma_incomplete}
676 @deffn {Function} gamma_incomplete (@var{a}, @var{z})
678 The incomplete upper gamma function (A&S 6.5.3):
685 gamma_incomplete(a, z) = I t %e dt
692 $$\Gamma\left(a , z\right)=\int_{z}^{\infty }{t^{a-1}\,e^ {- t }\;dt}$$
695 See also @mref{gamma_expand} for controlling how
696 @code{gamma_incomplete} is expressed in terms of elementary functions
699 Also see the related functions @code{gamma_incomplete_regularized} and
700 @code{gamma_incomplete_generalized}.
702 @opencatbox{Categories:}
703 @category{Gamma and factorial functions}
704 @category{Special functions}
708 @c -----------------------------------------------------------------------------
709 @deffn {Function} gamma_incomplete_regularized (@var{a}, @var{z})
711 The regularized incomplete upper gamma function (A&S 6.5.1):
715 gamma_incomplete_regularized(a, z) =
716 gamma_incomplete(a, z)
717 ----------------------
722 $${\it Q}\left(a , z\right)={{\Gamma\left(a , z\right)}\over{\Gamma\left(a\right)}}$$
725 See also @mref{gamma_expand} for controlling how
726 @code{gamma_incomplete} is expressed in terms of elementary functions
729 Also see @code{gamma_incomplete}.
731 @opencatbox{Categories:}
732 @category{Gamma and factorial functions}
733 @category{Special functions}
737 @c -----------------------------------------------------------------------------
738 @deffn {Function} gamma_incomplete_generalized (@var{a}, @var{z1}, @var{z1})
740 The generalized incomplete gamma function.
744 gamma_incomplete_generalized(a, z1, z2) =
755 $$\Gamma\left(a , z_{1}, z_{2}\right)=\int_{z_{1}}^{z_{2}}{t^{a-1}\,e^ {- t }\;dt}$$
758 Also see @code{gamma_incomplete} and @code{gamma_incomplete_regularized}.
760 @opencatbox{Categories:}
761 @category{Gamma and factorial functions}
762 @category{Special functions}
767 @c -----------------------------------------------------------------------------
768 @anchor{gamma_expand}
769 @defvr {Option variable} gamma_expand
770 Default value: @code{false}
772 @code{gamma_expand} controls expansion of @code{gamma_incomplete}.
773 When @code{gamma_expand} is @code{true}, @code{gamma_incomplete(v,z)}
774 is expanded in terms of
775 @code{z}, @code{exp(z)}, and @code{gamma_incomplete} or @code{erfc(z)} when possible.
778 (%i1) gamma_incomplete(2,z);
779 (%o1) gamma_incomplete(2, z)
780 (%i2) gamma_expand:true;
782 (%i3) gamma_incomplete(2,z);
786 (%i4) gamma_incomplete(3/2,z);
787 - z sqrt(%pi) erfc(sqrt(z))
788 (%o4) sqrt(z) %e + -----------------------
792 (%i5) gamma_incomplete(4/3,z);
794 gamma_incomplete(-, z)
796 (%o5) z %e + ----------------------
800 (%i6) gamma_incomplete(a+2,z);
802 (%o6) z (z + a + 1) %e + a (a + 1) gamma_incomplete(a, z)
803 (%i7) gamma_incomplete(a-2, z);
804 gamma_incomplete(a, z) a - 2 z 1 - z
805 (%o7) ---------------------- - z (--------------- + -----) %e
806 (1 - a) (2 - a) (a - 2) (a - 1) a - 2
811 @opencatbox{Categories:}
812 @category{Gamma and factorial functions}
813 @category{Simplification flags and variables}
817 @c -----------------------------------------------------------------------------
819 @defvr {Option variable} gammalim
823 @code{gammalim} controls simplification of the gamma
824 function for integral and rational number arguments. If the absolute
825 value of the argument is not greater than @code{gammalim}, then
826 simplification will occur. Note that the @code{factlim} switch controls
827 simplification of the result of @code{gamma} of an integer argument as well.
829 @opencatbox{Categories:}
830 @category{Gamma and factorial functions}
831 @category{Simplification flags and variables}
836 @c NEED CROSS REFS HERE
837 @c NEED EXAMPLES HERE
839 @c -----------------------------------------------------------------------------
841 @deffn {Function} makegamma (@var{expr})
842 Transforms instances of binomial, factorial, and beta
843 functions in @var{expr} into gamma functions.
845 See also @mrefdot{makefact}
847 @opencatbox{Categories:}
848 @category{Gamma and factorial functions}
853 @c -----------------------------------------------------------------------------
854 @deffn {Function} beta (@var{a}, @var{b})
855 The beta function is defined as @code{gamma(a) gamma(b)/gamma(a+b)}
858 Maxima simplifies the beta function for positive integers and rational
859 numbers, which sum to an integer. When @code{beta_args_sum_to_integer} is
860 @code{true}, Maxima simplifies also general expressions which sum to an integer.
862 For @var{a} or @var{b} equal to zero the beta function is not defined.
864 In general the beta function is not defined for negative integers as an
865 argument. The exception is for @var{a=-n}, @var{n} a positive integer
866 and @var{b} a positive integer with @code{b<=n}, it is possible to define an
867 analytic continuation. Maxima gives for this case a result.
869 When @code{beta_expand} is @code{true}, expressions like @code{beta(a+n,b)} and
870 @code{beta(a-n,b)} or @code{beta(a,b+n)} and @code{beta(a,b-n)} with @code{n}
871 an integer are simplified.
873 Maxima can evaluate the beta function for real and complex values in float and
874 bigfloat precision. For numerical evaluation Maxima uses @code{log_gamma}:
877 - log_gamma(b + a) + log_gamma(b) + log_gamma(a)
881 Maxima knows that the beta function is symmetric and has mirror symmetry.
883 Maxima knows the derivatives of the beta function with respect to @var{a} or
886 To express the beta function as a ratio of gamma functions see @code{makegamma}.
890 Simplification, when one of the arguments is an integer:
893 (%i1) [beta(2,3),beta(2,1/3),beta(2,a)];
895 (%o1) [--, -, ---------]
899 Simplification for two rational numbers as arguments which sum to an integer:
902 (%i2) [beta(1/2,5/2),beta(1/3,2/3),beta(1/4,3/4)];
904 (%o2) [-----, -------, sqrt(2) %pi]
908 When setting @code{beta_args_sum_to_integer} to @code{true} more general
909 expression are simplified, when the sum of the arguments is an integer:
912 (%i3) beta_args_sum_to_integer:true$
913 (%i4) beta(a+1,-a+2);
915 (%o4) ------------------
919 The possible results, when one of the arguments is a negative integer:
922 (%i5) [beta(-3,1),beta(-3,2),beta(-3,3)];
928 @code{beta(a+n,b)} or @code{beta(a-n)} with @code{n} an integer simplifies when
929 @code{beta_expand} is @code{true}:
932 (%i6) beta_expand:true$
933 (%i7) [beta(a+1,b),beta(a-1,b),beta(a+1,b)/beta(a,b+1)];
934 a beta(a, b) beta(a, b) (b + a - 1) a
935 (%o7) [------------, ----------------------, -]
940 Beta is not defined, when one of the arguments is zero:
944 beta: expected nonzero arguments; found 0, b
945 -- an error. To debug this try debugmode(true);
948 Numerical evaluation for real and complex arguments in float or bigfloat
953 (%o8) .08694748611299981
955 (%i9) beta(2.5,1.4+%i);
956 (%o9) 0.0640144950796695 - .1502078053286415 %i
958 (%i10) beta(2.5b0,2.3b0);
959 (%o10) 8.694748611299969b-2
961 (%i11) beta(2.5b0,1.4b0+%i);
962 (%o11) 6.401449507966944b-2 - 1.502078053286415b-1 %i
965 Beta is symmetric and has mirror symmetry:
968 (%i14) beta(a,b)-beta(b,a);
970 (%i15) declare(a,complex,b,complex)$
971 (%i16) conjugate(beta(a,b));
972 (%o16) beta(conjugate(a), conjugate(b))
975 The derivative of the beta function wrt @code{a}:
978 (%i17) diff(beta(a,b),a);
979 (%o17) - beta(a, b) (psi (b + a) - psi (a))
983 @opencatbox{Categories:}
984 @category{Gamma and factorial functions}
988 @c -----------------------------------------------------------------------------
989 @deffn {Function} beta_incomplete (@var{a}, @var{b}, @var{z})
991 The basic definition of the incomplete beta function (A&S 6.6.1) is
1005 This definition is possible for @math{realpart(a)>0} and @math{realpart(b)>0}
1006 and @math{abs(z)<1}. For other values the incomplete beta function can be
1007 defined through a generalized hypergeometric function:
1010 gamma(a) hypergeometric_generalized([a, 1 - b], [a + 1], z) z
1013 (See @url{https://functions.wolfram.com} for a complete definition of the incomplete beta
1016 For negative integers @math{a = -n} and positive integers @math{b=m} with
1017 @math{m<=n} the incomplete beta function is defined through
1029 Maxima uses this definition to simplify @code{beta_incomplete} for @var{a} a
1032 For @var{a} a positive integer, @code{beta_incomplete} simplifies for any
1033 argument @var{b} and @var{z} and for @var{b} a positive integer for any
1034 argument @var{a} and @var{z}, with the exception of @var{a} a negative integer.
1036 For @math{z=0} and @math{realpart(a)>0}, @code{beta_incomplete} has the
1037 specific value zero. For @var{z=1} and @math{realpart(b)>0},
1038 @code{beta_incomplete} simplifies to the beta function @code{beta(a,b)}.
1040 Maxima evaluates @code{beta_incomplete} numerically for real and complex values
1041 in float or bigfloat precision. For the numerical evaluation an expansion of the
1042 incomplete beta function in continued fractions is used.
1044 When the option variable @code{beta_expand} is @code{true}, Maxima expands
1045 expressions like @code{beta_incomplete(a+n,b,z)} and
1046 @code{beta_incomplete(a-n,b,z)} where n is a positive integer.
1048 Maxima knows the derivatives of @code{beta_incomplete} with respect to the
1049 variables @var{a}, @var{b} and @var{z} and the integral with respect to the
1054 Simplification for @var{a} a positive integer:
1057 (%i1) beta_incomplete(2,b,z);
1059 1 - (1 - z) (b z + 1)
1060 (%o1) ----------------------
1064 Simplification for @var{b} a positive integer:
1067 (%i2) beta_incomplete(a,2,z);
1070 (%o2) ------------------
1074 Simplification for @var{a} and @var{b} a positive integer:
1077 (%i3) beta_incomplete(3,2,z);
1081 (%o3) ------------------
1086 @var{a} is a negative integer and @math{b<=(-a)}, Maxima simplifies:
1089 (%i4) beta_incomplete(-3,1,z);
1096 For the specific values @math{z=0} and @math{z=1}, Maxima simplifies:
1099 (%i5) assume(a>0,b>0)$
1100 (%i6) beta_incomplete(a,b,0);
1102 (%i7) beta_incomplete(a,b,1);
1106 Numerical evaluation in float or bigfloat precision:
1109 (%i8) beta_incomplete(0.25,0.50,0.9);
1110 (%o8) 4.594959440269333
1112 (%i10) beta_incomplete(0.25,0.50,0.9b0);
1113 (%o10) 4.594959440269324086971203b0
1116 For @math{abs(z)>1} @code{beta_incomplete} returns a complex result:
1119 (%i11) beta_incomplete(0.25,0.50,1.7);
1120 (%o11) 5.244115108584249 - 1.45518047787844 %i
1123 Results for more general complex arguments:
1126 (%i14) beta_incomplete(0.25+%i,1.0+%i,1.7+%i);
1127 (%o14) 2.726960675662536 - .3831175704269199 %i
1128 (%i15) beta_incomplete(1/2,5/4*%i,2.8+%i);
1129 (%o15) 13.04649635168716 %i - 5.802067956270001
1133 Expansion, when @code{beta_expand} is @code{true}:
1136 (%i23) beta_incomplete(a+1,b,z),beta_expand:true;
1138 a beta_incomplete(a, b, z) (1 - z) z
1139 (%o23) -------------------------- - -----------
1142 (%i24) beta_incomplete(a-1,b,z),beta_expand:true;
1144 beta_incomplete(a, b, z) (- b - a + 1) (1 - z) z
1145 (%o24) -------------------------------------- - ---------------
1149 Derivative and integral for @code{beta_incomplete}:
1152 (%i34) diff(beta_incomplete(a, b, z), z);
1157 (%i35) integrate(beta_incomplete(a, b, z), z);
1160 (%o35) ----------- + beta_incomplete(a, b, z) z
1162 a beta_incomplete(a, b, z)
1163 - --------------------------
1165 (%i36) factor(diff(%, z));
1166 (%o36) beta_incomplete(a, b, z)
1169 @opencatbox{Categories:}
1170 @category{Gamma and factorial functions}
1174 @c -----------------------------------------------------------------------------
1175 @deffn {Function} beta_incomplete_regularized (@var{a}, @var{b}, @var{z})
1177 The regularized incomplete beta function (A&S 6.6.2), defined as
1180 beta_incomplete_regularized(a, b, z) =
1181 beta_incomplete(a, b, z)
1182 ------------------------
1186 As for @code{beta_incomplete} this definition is not complete. See
1187 @url{https://functions.wolfram.com} for a complete definition of
1188 @code{beta_incomplete_regularized}.
1190 @code{beta_incomplete_regularized} simplifies @var{a} or @var{b} a positive
1193 For @math{z=0} and @math{realpart(a)>0}, @code{beta_incomplete_regularized} has
1194 the specific value 0. For @var{z=1} and @math{realpart(b)>0},
1195 @code{beta_incomplete_regularized} simplifies to 1.
1197 Maxima can evaluate @code{beta_incomplete_regularized} for real and complex
1198 arguments in float and bigfloat precision.
1200 When @code{beta_expand} is @code{true}, Maxima expands
1201 @code{beta_incomplete_regularized} for arguments @math{a+n} or @math{a-n},
1202 where n is an integer.
1204 Maxima knows the derivatives of @code{beta_incomplete_regularized} with respect
1205 to the variables @var{a}, @var{b}, and @var{z} and the integral with respect to
1206 the variable @var{z}.
1210 Simplification for @var{a} or @var{b} a positive integer:
1213 (%i1) beta_incomplete_regularized(2,b,z);
1215 (%o1) 1 - (1 - z) (b z + 1)
1217 (%i2) beta_incomplete_regularized(a,2,z);
1219 (%o2) (a (1 - z) + 1) z
1221 (%i3) beta_incomplete_regularized(3,2,z);
1223 (%o3) (3 (1 - z) + 1) z
1226 For the specific values @math{z=0} and @math{z=1}, Maxima simplifies:
1229 (%i4) assume(a>0,b>0)$
1230 (%i5) beta_incomplete_regularized(a,b,0);
1232 (%i6) beta_incomplete_regularized(a,b,1);
1236 Numerical evaluation for real and complex arguments in float and bigfloat
1240 (%i7) beta_incomplete_regularized(0.12,0.43,0.9);
1241 (%o7) .9114011367359802
1243 (%i9) beta_incomplete_regularized(0.12,0.43,0.9b0);
1244 (%o9) 9.1140113673598075519946998779975b-1
1245 (%i10) beta_incomplete_regularized(1+%i,3/3,1.5*%i);
1246 (%o10) .2865367499935403 %i - 0.122995963334684
1248 (%i12) beta_incomplete_regularized(1+%i,3/3,1.5b0*%i);
1249 (%o12) 2.8653674999354036142b-1 %i - 1.2299596333468400163b-1
1252 Expansion, when @code{beta_expand} is @code{true}:
1255 (%i13) beta_incomplete_regularized(a+1,b,z);
1258 (%o13) beta_incomplete_regularized(a, b, z) - ------------
1260 (%i14) beta_incomplete_regularized(a-1,b,z);
1261 (%o14) beta_incomplete_regularized(a, b, z)
1264 - ----------------------
1265 beta(a, b) (b + a - 1)
1268 The derivative and the integral wrt @var{z}:
1271 (%i15) diff(beta_incomplete_regularized(a,b,z),z);
1274 (%o15) -------------------
1276 (%i16) integrate(beta_incomplete_regularized(a,b,z),z);
1277 (%o16) beta_incomplete_regularized(a, b, z) z
1280 a (beta_incomplete_regularized(a, b, z) - ------------)
1282 - -------------------------------------------------------
1286 @opencatbox{Categories:}
1287 @category{Gamma and factorial functions}
1291 @c -----------------------------------------------------------------------------
1292 @deffn {Function} beta_incomplete_generalized (@var{a}, @var{b}, @var{z1}, @var{z2})
1294 The basic definition of the generalized incomplete beta function is
1308 Maxima simplifies @code{beta_incomplete_regularized} for @var{a} and @var{b}
1311 For @math{realpart(a)>0} and @math{z1=0} or @math{z2=0}, Maxima simplifies
1312 @code{beta_incomplete_generalized} to @code{beta_incomplete}. For
1313 @math{realpart(b)>0} and @math{z1=1} or @var{z2=1}, Maxima simplifies to an
1314 expression with @code{beta} and @code{beta_incomplete}.
1316 Maxima evaluates @code{beta_incomplete_regularized} for real and complex values
1317 in float and bigfloat precision.
1319 When @code{beta_expand} is @code{true}, Maxima expands
1320 @code{beta_incomplete_generalized} for @math{a+n} and @math{a-n}, @var{n} a
1323 Maxima knows the derivative of @code{beta_incomplete_generalized} with respect
1324 to the variables @var{a}, @var{b}, @var{z1}, and @var{z2} and the integrals with
1325 respect to the variables @var{z1} and @var{z2}.
1329 Maxima simplifies @code{beta_incomplete_generalized} for @var{a} and @var{b} a
1333 (%i1) beta_incomplete_generalized(2,b,z1,z2);
1335 (1 - z1) (b z1 + 1) - (1 - z2) (b z2 + 1)
1336 (%o1) -------------------------------------------
1338 (%i2) beta_incomplete_generalized(a,2,z1,z2);
1341 (a (1 - z2) + 1) z2 - (a (1 - z1) + 1) z1
1342 (%o2) -------------------------------------------
1345 (%i3) beta_incomplete_generalized(3,2,z1,z2);
1347 (1 - z1) (3 z1 + 2 z1 + 1) - (1 - z2) (3 z2 + 2 z2 + 1)
1348 (%o3) -----------------------------------------------------------
1352 Simplification for specific values @math{z1=0}, @math{z2=0}, @math{z1=1}, or
1356 (%i4) assume(a > 0, b > 0)$
1357 (%i5) beta_incomplete_generalized(a,b,z1,0);
1358 (%o5) - beta_incomplete(a, b, z1)
1360 (%i6) beta_incomplete_generalized(a,b,0,z2);
1361 (%o6) - beta_incomplete(a, b, z2)
1363 (%i7) beta_incomplete_generalized(a,b,z1,1);
1364 (%o7) beta(a, b) - beta_incomplete(a, b, z1)
1366 (%i8) beta_incomplete_generalized(a,b,1,z2);
1367 (%o8) beta_incomplete(a, b, z2) - beta(a, b)
1370 Numerical evaluation for real arguments in float or bigfloat precision:
1373 (%i9) beta_incomplete_generalized(1/2,3/2,0.25,0.31);
1374 (%o9) .09638178086368676
1377 (%i10) beta_incomplete_generalized(1/2,3/2,0.25,0.31b0);
1378 (%o10) 9.6381780863686935309170054689964b-2
1381 Numerical evaluation for complex arguments in float or bigfloat precision:
1384 (%i11) beta_incomplete_generalized(1/2+%i,3/2+%i,0.25,0.31);
1385 (%o11) - .09625463003205376 %i - .003323847735353769
1387 (%i13) beta_incomplete_generalized(1/2+%i,3/2+%i,0.25,0.31b0);
1388 (%o13) - 9.6254630032054178691b-2 %i - 3.3238477353543591914b-3
1391 Expansion for @math{a+n} or @math{a-n}, @var{n} a positive integer, when
1392 @code{beta_expand} is @code{true}:
1395 (%i14) beta_expand:true$
1397 (%i15) beta_incomplete_generalized(a+1,b,z1,z2);
1400 (1 - z1) z1 - (1 - z2) z2
1401 (%o15) -----------------------------
1403 a beta_incomplete_generalized(a, b, z1, z2)
1404 + -------------------------------------------
1406 (%i16) beta_incomplete_generalized(a-1,b,z1,z2);
1408 beta_incomplete_generalized(a, b, z1, z2) (- b - a + 1)
1409 (%o16) -------------------------------------------------------
1412 (1 - z2) z2 - (1 - z1) z1
1413 - -------------------------------------
1417 Derivative wrt the variable @var{z1} and integrals wrt @var{z1} and @var{z2}:
1420 (%i17) diff(beta_incomplete_generalized(a,b,z1,z2),z1);
1422 (%o17) - (1 - z1) z1
1423 (%i18) integrate(beta_incomplete_generalized(a,b,z1,z2),z1);
1424 (%o18) beta_incomplete_generalized(a, b, z1, z2) z1
1425 + beta_incomplete(a + 1, b, z1)
1426 (%i19) integrate(beta_incomplete_generalized(a,b,z1,z2),z2);
1427 (%o19) beta_incomplete_generalized(a, b, z1, z2) z2
1428 - beta_incomplete(a + 1, b, z2)
1431 @opencatbox{Categories:}
1432 @category{Gamma and factorial functions}
1436 @defvr {Option variable} beta_expand
1437 Default value: false
1439 When @code{beta_expand} is @code{true}, @code{beta(a,b)} and related
1440 functions are expanded for arguments like @math{a+n} or @math{a-n},
1441 where @math{n} is an integer.
1443 @opencatbox{Categories:}
1444 @category{Gamma and factorial functions}
1445 @category{Simplification flags and variables}
1449 @defvr {Option variable} beta_args_sum_to_integer
1450 Default value: false
1452 When @code{beta_args_sum_to_integer} is @code{true}, Maxima simplifies
1453 @code{beta(a,b)}, when the arguments @var{a} and @var{b} sum to an integer.
1455 @opencatbox{Categories:}
1456 @category{Gamma and factorial functions}
1457 @category{Simplification flags and variables}
1462 @c NEED INFO HERE ABOUT THE SUBSCRIPTED FORM psi[n](x)
1463 @c I (rtoy) don't think there is a plain psi(x) function anymore.
1464 @c @deffn {Function} psi (@var{x})
1465 @c @deffnx {Function} psi [@var{n}](@var{x})
1466 @deffn {Function} psi [@var{n}](@var{x})
1468 The derivative of @code{log (gamma (@var{x}))} of order @code{@var{n}+1}.
1469 Thus, @code{psi[0](@var{x})} is the first derivative,
1470 @code{psi[1](@var{x})} is the second derivative, etc.
1472 Maxima does not know how, in general, to compute a numerical value of
1473 @code{psi}, but it can compute some exact values for rational args.
1474 Several variables control what range of rational args @code{psi} will
1475 return an exact value, if possible. See @code{maxpsiposint},
1476 @code{maxpsinegint}, @code{maxpsifracnum}, and @code{maxpsifracdenom}.
1477 That is, @var{x} must lie between @code{maxpsinegint} and
1478 @code{maxpsiposint}. If the absolute value of the fractional part of
1479 @var{x} is rational and has a numerator less than @code{maxpsifracnum}
1480 and has a denominator less than @code{maxpsifracdenom}, @code{psi}
1481 will return an exact value.
1483 The function @code{bfpsi} in the @code{bffac} package can compute
1486 @opencatbox{Categories:}
1487 @category{Gamma and factorial functions}
1491 @defvr {Option variable} maxpsiposint
1494 @code{maxpsiposint} is the largest positive value for which
1495 @code{psi[n](x)} will try to compute an exact value.
1497 @opencatbox{Categories:}
1498 @category{Gamma and factorial functions}
1503 @defvr {Option variable} maxpsinegint
1506 @code{maxpsinegint} is the most negative value for which
1507 @code{psi[n](x)} will try to compute an exact value. That is if
1508 @var{x} is less than @code{maxnegint}, @code{psi[n](@var{x})} will not
1509 return simplified answer, even if it could.
1511 @opencatbox{Categories:}
1512 @category{Gamma and factorial functions}
1517 @defvr {Option variable} maxpsifracnum
1520 Let @var{x} be a rational number less than one of the form @code{p/q}.
1521 If @code{p} is greater than @code{maxpsifracnum}, then
1522 @code{psi[@var{n}](@var{x})} will not try to return a simplified
1525 @opencatbox{Categories:}
1526 @category{Gamma and factorial functions}
1531 @defvr {Option variable} maxpsifracdenom
1534 Let @var{x} be a rational number less than one of the form @code{p/q}.
1535 If @code{q} is greater than @code{maxpsifracdenom}, then
1536 @code{psi[@var{n}](@var{x})} will not try to return a simplified
1539 @opencatbox{Categories:}
1540 @category{Gamma and factorial functions}
1545 @c NEED CROSS REFS HERE
1546 @c NEED EXAMPLES HERE
1548 @deffn {Function} makefact (@var{expr})
1549 Transforms instances of binomial, gamma, and beta
1550 functions in @var{expr} into factorials.
1552 See also @mrefdot{makegamma}
1554 @opencatbox{Categories:}
1555 @category{Gamma and factorial functions}
1560 @c AREN'T THERE OTHER FUNCTIONS THAT DO ESSENTIALLY THE SAME THING ??
1561 @deffn {Function} numfactor (@var{expr})
1562 Returns the numerical factor multiplying the expression
1563 @var{expr}, which should be a single term.
1565 @c WHY IS content MENTIONED IN THIS CONTEXT ??
1566 @code{content} returns the greatest common divisor (gcd) of all terms in a sum.
1573 (%i2) numfactor (%);
1579 @opencatbox{Categories:}
1580 @category{Expressions}
1585 @node Exponential Integrals, Error Function, Gamma and factorial Functions, Special Functions
1586 @section Exponential Integrals
1588 The Exponential Integral and related functions are defined in
1589 Abramowitz and Stegun,
1590 @i{Handbook of Mathematical Functions}, Chapter 5
1592 @deffn {Function} expintegral_e1 (@var{z})
1593 The Exponential Integral E1(z) (A&S 5.1.1) defined as
1597 $$E_1(z) = \int_z^\infty {e^{-t} \over t} dt$$
1599 with $|\arg\ z| < \pi$.
1603 @math{integrate(exp(-t)/t, t, z, inf)}
1604 with @math{abs(arg z) < %pi}.
1607 @opencatbox{Categories:}
1608 @category{Exponential Integrals}
1609 @category{Special functions}
1613 @deffn {Function} expintegral_ei (@var{z})
1614 The Exponential Integral Ei(z) (A&S 5.1.2)
1616 @opencatbox{Categories:}
1617 @category{Exponential Integrals}
1618 @category{Special functions}
1622 @deffn {Function} expintegral_li (@var{z})
1623 The Exponential Integral Li(z) (A&S 5.1.3)
1625 @opencatbox{Categories:}
1626 @category{Exponential Integrals}
1627 @category{Special functions}
1631 @deffn {Function} expintegral_e (@var{n},@var{z})
1632 The Exponential Integral En(z) (A&S 5.1.4) defined as
1636 $$E_n(z) = \int_1^\infty {e^{-zt} \over t^n} dt$$
1637 with ${\rm Re}\ z > 0$ and $n = 0, 1, 2, \ldots$.
1641 @math{integrate(exp(-z*t)/t^n, t, 1, inf)}
1642 with @math{real(x) > 1} and @math{n} a non-negative integer.
1645 @opencatbox{Categories:}
1646 @category{Exponential Integrals}
1647 @category{Special functions}
1651 @deffn {Function} expintegral_si (@var{z})
1652 The Exponential Integral Si(z) (A&S 5.2.1) defined as
1656 $${\rm Si}(z) = \int_0^z {\sin t \over t} dt$$
1660 @math{integrate(sin(t)/t, t, 0, z)}
1663 @opencatbox{Categories:}
1664 @category{Exponential Integrals}
1665 @category{Special functions}
1669 @deffn {Function} expintegral_ci (@var{z})
1670 The Exponential Integral Ci(z) (A&S 5.2.2) defined as
1674 $${\rm Ci}(z) = \gamma + \log z + \int_0^z {{\cos t - 1} \over t} dt$$
1676 with $|\arg\ z| < \pi$.
1680 @math{%gamma + log(z) + integrate((cos(t) - 1)/t, t, 0, z)}
1682 with @math{abs(arg z) < %pi}
1685 @opencatbox{Categories:}
1686 @category{Exponential Integrals}
1687 @category{Special functions}
1691 @deffn {Function} expintegral_shi (@var{z})
1692 The Exponential Integral Shi(z) (A&S 5.2.3) defined as
1696 $${\rm Shi}(z) = \int_0^z {\sinh t \over t} dt$$
1700 @math{integrate(sinh(t)/t, t, 0, z)}
1704 @opencatbox{Categories:}
1705 @category{Exponential Integrals}
1706 @category{Special functions}
1710 @deffn {Function} expintegral_chi (@var{z})
1711 The Exponential Integral Chi(z) (A&S 5.2.4) defined as
1715 $${\rm Chi}(z) = \gamma + \log z + \int_0^z {{\cosh t - 1} \over t} dt$$
1717 with $|\arg\ z| < \pi$.
1721 @math{%gamma + log(z) + integrate((cosh(t) - 1)/t, t, 0, z)}
1723 with @math{abs(arg z) < %pi}
1726 @opencatbox{Categories:}
1727 @category{Exponential Integrals}
1728 @category{Special functions}
1732 @defvr {Option variable} expintrep
1733 Default value: false
1735 Change the representation of one of the exponential integrals,
1736 @var{expintegral_e(m, z)}, @var{expintegral_e1}, or
1737 @var{expintegral_ei} to an equivalent form if possible.
1739 Possible values for @var{expintrep} are @var{false},
1740 @var{gamma_incomplete}, @var{expintegral_e1}, @var{expintegral_ei},
1741 @var{expintegral_li}, @var{expintegral_trig}, or
1742 @var{expintegral_hyp}.
1744 @var{false} means that the representation is not changed. Other
1745 values indicate the representation is to be changed to use the
1746 function specified where @var{expintegral_trig} means
1747 @var{expintegral_si}, @var{expintegral_ci}, and @var{expintegral_hyp}
1748 means @var{expintegral_shi} or @var{expintegral_chi}.
1750 @opencatbox{Categories:}
1751 @category{Exponential Integrals}
1755 @defvr {Option variable} expintexpand
1756 Default value: false
1758 Expand the Exponential Integral E[n](z)
1759 for half integral values in terms of Erfc or Erf and
1760 for positive integers in terms of Ei
1761 @opencatbox{Categories:}
1762 @category{Exponential Integrals}
1766 @node Error Function, Struve Functions, Exponential Integrals, Special Functions
1767 @section Error Function
1769 The Error function and related functions are defined in
1770 Abramowitz and Stegun,
1771 @i{Handbook of Mathematical Functions}, Chapter 7
1773 @c -----------------------------------------------------------------------------
1775 @deffn {Function} erf (@var{z})
1777 The Error Function erf(z) (A&S 7.1.1)
1779 See also flag @mrefdot{erfflag}
1780 @opencatbox{Categories:}
1781 @category{Special functions}
1786 @deffn {Function} erfc (@var{z})
1787 The Complementary Error Function erfc(z) (A&S 7.1.2)
1789 @code{erfc(z) = 1-erf(z)}
1790 @opencatbox{Categories:}
1791 @category{Special functions}
1795 @deffn {Function} erfi (@var{z})
1796 The Imaginary Error Function.
1798 @code{erfi(z) = -%i*erf(%i*z)}
1799 @opencatbox{Categories:}
1800 @category{Special functions}
1804 @deffn {Function} erf_generalized (@var{z1},@var{z2})
1805 Generalized Error function Erf(z1,z2)
1806 @opencatbox{Categories:}
1807 @category{Special functions}
1811 @deffn {Function} fresnel_c (@var{z})
1812 The Fresnel Integral C(z) = integrate(cos((%pi/2)*t^2),t,0,z). (A&S 7.3.1)
1814 The simplification fresnel_c(-x) = -fresnel_c(x) is applied when
1815 flag @code{trigsign} is true.
1817 The simplification fresnel_c(%i*x) = %i*fresnel_c(x) is applied when
1818 flag @code{%iargs} is true.
1820 See flags @code{erf_representation} and @code{hypergeometric_representation}.
1821 @opencatbox{Categories:}
1822 @category{Special functions}
1826 @deffn {Function} fresnel_s (@var{z})
1827 The Fresnel Integral S(z) = integrate(sin((%pi/2)*t^2),t,0,z). (A&S 7.3.2)
1829 The simplification fresnel_s(-x) = -fresnel_s(x) is applied when
1830 flag @code{trigsign} is true.
1832 The simplification fresnel_s(%i*x) = -%i*fresnel_s(x) is applied when
1833 flag @code{%iargs} is true.
1835 See flags @code{erf_representation} and @code{hypergeometric_representation}.
1836 @opencatbox{Categories:}
1837 @category{Special functions}
1841 @defvr {Option variable} erf_representation
1842 Default value: false
1844 When T erfc, erfi, erf_generalized, fresnel_s
1845 and fresnel_c are transformed to erf.
1848 @defvr {Option variable} hypergeometric_representation
1849 Default value: false
1851 Enables transformation to a Hypergeometric
1852 representation for fresnel_s and fresnel_c
1855 @node Struve Functions, Hypergeometric Functions, Error Function, Special Functions
1856 @section Struve Functions
1858 The Struve functions are defined in Abramowitz and Stegun,
1859 @i{Handbook of Mathematical Functions}, Chapter 12.
1861 @c -----------------------------------------------------------------------------
1862 @deffn {Function} struve_h (@var{v}, @var{z})
1863 The Struve Function H of order v and argument z. (A&S 12.1.1)
1865 @opencatbox{Categories:}
1866 @category{Special functions}
1870 @c -----------------------------------------------------------------------------
1871 @deffn {Function} struve_l (@var{v}, @var{z})
1872 The Modified Struve Function L of order v and argument z. (A&S 12.2.1)
1874 @opencatbox{Categories:}
1875 @category{Special functions}
1879 @node Hypergeometric Functions, Parabolic Cylinder Functions, Struve Functions, Special Functions
1880 @section Hypergeometric Functions
1882 The Hypergeometric Functions are defined in Abramowitz and Stegun,
1883 @i{Handbook of Mathematical Functions}, Chapters 13 and 15.
1885 Maxima has very limited knowledge of these functions. They
1886 can be returned from function @code{hgfred}.
1888 @deffn {Function} %m [@var{k},@var{u}] (@var{z})
1889 Whittaker M function
1890 @code{M[k,u](z) = exp(-z/2)*z^(1/2+u)*M(1/2+u-k,1+2*u,z)}.
1892 @opencatbox{Categories:}
1893 @category{Special functions}
1897 @deffn {Function} %w [@var{k},@var{u}] (@var{z})
1898 Whittaker W function. (A&S 13.1.33)
1899 @opencatbox{Categories:}
1900 @category{Special functions}
1905 @deffn {Function} %f [@var{p},@var{q}] (@var{[a],[b],z})
1906 The pFq(a1,a2,..ap;b1,b2,..bq;z) hypergeometric function,
1907 where @code{a} a list of length @code{p} and
1908 @code{b} a list of length @code{q}.
1909 @opencatbox{Categories:}
1910 @category{Bessel functions}
1911 @category{Special functions}
1915 @deffn {Function} hypergeometric ([@var{a1}, ..., @var{ap}],[@var{b1}, ... ,@var{bq}], x)
1916 The hypergeometric function. Unlike Maxima's @code{%f} hypergeometric
1917 function, the function @code{hypergeometric} is a simplifying
1918 function; also, @code{hypergeometric} supports complex double and
1919 big floating point evaluation. For the Gauss hypergeometric function,
1920 that is @math{p = 2} and @math{q = 1}, floating point evaluation
1921 outside the unit circle is supported, but in general, it is not
1924 When the option variable @code{expand_hypergeometric} is true (default
1925 is false) and one of the arguments @code{a1} through @code{ap} is a
1926 negative integer (a polynomial case), @code{hypergeometric} returns an
1927 expanded polynomial.
1932 (%i1) hypergeometric([],[],x);
1936 Polynomial cases automatically expand when @code{expand_hypergeometric} is true:
1939 (%i2) hypergeometric([-3],[7],x);
1940 (%o2) hypergeometric([-3],[7],x)
1942 (%i3) hypergeometric([-3],[7],x), expand_hypergeometric : true;
1943 (%o3) -x^3/504+3*x^2/56-3*x/7+1
1946 Both double float and big float evaluation is supported:
1949 (%i4) hypergeometric([5.1],[7.1 + %i],0.42);
1950 (%o4) 1.346250786375334 - 0.0559061414208204 %i
1951 (%i5) hypergeometric([5,6],[8], 5.7 - %i);
1952 (%o5) .007375824009774946 - .001049813688578674 %i
1953 (%i6) hypergeometric([5,6],[8], 5.7b0 - %i), fpprec : 30;
1954 (%o6) 7.37582400977494674506442010824b-3
1955 - 1.04981368857867315858055393376b-3 %i
1959 @node Parabolic Cylinder Functions, Functions and Variables for Special Functions, Hypergeometric Functions, Special Functions
1960 @section Parabolic Cylinder Functions
1962 The Parabolic Cylinder Functions are defined in Abramowitz and Stegun,
1963 @i{Handbook of Mathematical Functions}, Chapter 19.
1965 Maxima has very limited knowledge of these functions. They
1966 can be returned from function @code{hgfred}.
1968 @deffn {Function} parabolic_cylinder_d (@var{v}, @var{z})
1969 The parabolic cylinder function @code{parabolic_cylinder_d(v,z)}. (A&S 19.3.1)
1970 @opencatbox{Categories:}
1971 @category{Special functions}
1978 @node Functions and Variables for Special Functions, , Parabolic Cylinder Functions, Special Functions
1979 @section Functions and Variables for Special Functions
1983 @deffn {Function} specint (exp(- s*@var{t}) * @var{expr}, @var{t})
1985 Compute the Laplace transform of @var{expr} with respect to the variable @var{t}.
1986 The integrand @var{expr} may contain special functions. The
1987 parameter @var{s} maybe be named something else; it is determined
1988 automatically, as the examples below show where @var{p} is used in
1991 The following special functions are handled by @code{specint}: incomplete gamma
1992 function, error functions (but not the error function @code{erfi}, it is easy to
1993 transform @code{erfi} e.g. to the error function @code{erf}), exponential
1994 integrals, bessel functions (including products of bessel functions), hankel
1995 functions, hermite and the laguerre polynomials.
1997 Furthermore, @code{specint} can handle the hypergeometric function
1998 @code{%f[p,q]([],[],z)}, the whittaker function of the first kind
1999 @code{%m[u,k](z)} and of the second kind @code{%w[u,k](z)}.
2001 The result may be in terms of special functions and can include unsimplified
2002 hypergeometric functions.
2004 When @code{laplace} fails to find a Laplace transform, @code{specint} is called.
2005 Because @code{laplace} knows more general rules for Laplace transforms, it is
2006 preferable to use @code{laplace} and not @code{specint}.
2008 @code{demo("hypgeo")} displays several examples of Laplace transforms computed by
2013 @c assume (p > 0, a > 0)$
2014 @c specint (t^(1/2) * exp(-a*t/4) * exp(-p*t), t);
2015 @c specint (t^(1/2) * bessel_j(1, 2 * a^(1/2) * t^(1/2))
2019 (%i1) assume (p > 0, a > 0)$
2021 (%i2) specint (t^(1/2) * exp(-a*t/4) * exp(-p*t), t);
2029 (%i3) specint (t^(1/2) * bessel_j(1, 2 * a^(1/2) * t^(1/2))
2033 (%o3) ---------------
2039 Examples for exponential integrals:
2042 (%i4) assume(s>0,a>0,s-a>0)$
2043 (%i5) ratsimp(specint(%e^(a*t)
2044 *(log(a)+expintegral_e1(a*t))*%e^(-s*t),t));
2050 (%i7) gamma_expand:true$
2052 radcan(specint((cos(t)*expintegral_si(t)
2053 -sin(t)*expintegral_ci(t))*%e^(-s*t),t));
2058 ratsimp(specint((2*t*log(a)+2/a*sin(a*t)
2059 -2*t*expintegral_ci(a*t))*%e^(-s*t),t));
2067 Results when using the expansion of @code{gamma_incomplete} and when changing
2068 the representation to @code{expintegral_e1}:
2072 (%i11) specint(1/sqrt(%pi*t)*unit_step(t-k)*%e^(-s*t),t);
2074 gamma_incomplete(-, k s)
2076 (%o11) ------------------------
2079 (%i12) gamma_expand:true$
2080 (%i13) specint(1/sqrt(%pi*t)*unit_step(t-k)*%e^(-s*t),t);
2081 erfc(sqrt(k) sqrt(s))
2082 (%o13) ---------------------
2085 (%i14) expintrep:expintegral_e1$
2086 (%i15) ratsimp(specint(1/(t+a)^2*%e^(-s*t),t));
2088 a s %e expintegral_e1(a s) - 1
2089 (%o15) - ---------------------------------
2093 @opencatbox{Categories:}
2094 @category{Laplace transform}
2098 @deffn {Function} hypergeometric_simp (@var{e})
2100 @code{hypergeometric_simp} simplifies hypergeometric functions
2101 by applying @code{hgfred}
2102 to the arguments of any hypergeometric functions in the expression @var{e}.
2104 Only instances of @code{hypergeometric} are affected;
2105 any @code{%f}, @code{%w}, and @code{%m} in the expression @var{e} are not affected.
2106 Any unsimplified hypergeometric functions are returned unchanged
2107 (instead of changing to @code{%f} as @code{hgfred} would).
2109 @code{load(hypergeometric);} loads this function.
2111 See also @mrefdot{hgfred}
2116 @c load ("hypergeometric") $
2117 @c foo : [hypergeometric([1,1], [2], z), hypergeometric([1/2], [1], z)];
2118 @c hypergeometric_simp (foo);
2119 @c bar : hypergeometric([n], [m], z + 1);
2120 @c hypergeometric_simp (bar);
2123 (%i1) load ("hypergeometric") $
2124 (%i2) foo : [hypergeometric([1,1], [2], z), hypergeometric([1/2], [1], z)];
2125 (%o2) [hypergeometric([1, 1], [2], z),
2127 hypergeometric([-], [1], z)]
2129 (%i3) hypergeometric_simp (foo);
2131 (%o3) [- ----------, bessel_i(0, -) %e ]
2133 (%i4) bar : hypergeometric([n], [m], z + 1);
2134 (%o4) hypergeometric([n], [m], z + 1)
2135 (%i5) hypergeometric_simp (bar);
2136 (%o5) hypergeometric([n], [m], z + 1)
2139 @opencatbox{Categories:}
2140 @category{Hypergeometric functions}
2141 @category{Simplification functions}
2142 @category{Special functions}
2147 @deffn {Function} hgfred (@var{a}, @var{b}, @var{t})
2149 Simplify the generalized hypergeometric function in terms of other,
2150 simpler, forms. @var{a} is a list of numerator parameters and @var{b}
2151 is a list of the denominator parameters.
2153 If @code{hgfred} cannot simplify the hypergeometric function, it returns
2154 an expression of the form @code{%f[p,q]([a], [b], x)} where @var{p} is
2155 the number of elements in @var{a}, and @var{q} is the number of elements
2156 in @var{b}. This is the usual @code{pFq} generalized hypergeometric
2160 (%i1) assume(not(equal(z,0)));
2161 (%o1) [notequal(z, 0)]
2162 (%i2) hgfred([v+1/2],[2*v+1],2*%i*z);
2165 4 bessel_j(v, z) gamma(v + 1) %e
2166 (%o2) ---------------------------------------
2169 (%i3) hgfred([1,1],[2],z);
2174 (%i4) hgfred([a,a+1/2],[3/2],z^2);
2178 (%o4) -------------------------------
2183 It can be beneficial to load orthopoly too as the following example
2184 shows. Note that @var{L} is the generalized Laguerre polynomial.
2187 (%i5) load(orthopoly)$
2188 (%i6) hgfred([-2],[a],z);
2201 (%o7) --------- - --- + 1
2207 @deffn {Function} lambert_w (@var{z})
2208 The principal branch of Lambert's W function W(z), the solution of
2209 @code{z = W(z) * exp(W(z))}. (DLMF 4.13)
2210 @opencatbox{Categories:}
2211 @category{Special functions}
2215 @deffn {Function} generalized_lambert_w (@var{k}, @var{z})
2216 The @var{k}-th branch of Lambert's W function W(z), the solution of
2217 @code{z = W(z) * exp(W(z))}. (DLMF 4.13)
2219 The principal branch, denoted Wp(z) in DLMF, is @code{lambert_w(z) = generalized_lambert_w(0,z)}.
2221 The other branch with real values, denoted Wm(z) in DLMF, is @code{generalized_lambert_w(-1,z)}.
2222 @opencatbox{Categories:}
2223 @category{Special functions}
2229 @deffn {Function} nzeta (@var{z})
2230 The Plasma Dispersion Function
2231 @code{nzeta(z) = %i*sqrt(%pi)*exp(-z^2)*(1-erf(-%i*z))}
2232 @opencatbox{Categories:}
2233 @category{Special functions}
2237 @deffn {Function} nzetar (@var{z})
2238 Returns @code{realpart(nzeta(z))}.
2239 @opencatbox{Categories:}
2240 @category{Special functions}
2244 @deffn {Function} nzetai (@var{z})
2245 Returns @code{imagpart(nzeta(z))}.
2246 @opencatbox{Categories:}
2247 @category{Special functions}