17.6 errpr

Last-modified: 2026-02-14 (土) 13:08:38

17.6 Error Function
The Error function and related functions are defined in Abramowitz and Stegun, Handbook of Mathematical Functions, A&S Chapter 7 and (DLMF 7)

Function: erf (z)
The Error Function erf(z):

(A&S eqn 7.1.1) and (DLMF 7.2.E1).

See also flag erfflag. This can also be expressed in terms of a hypergeometric function. See hypergeometric_representation.

Categories: Special functions ·
Function: erfc (z)
The Complementary Error Function erfc(z):

(A&S eqn 7.1.2) and (DLMF 7.2.E2).

This can also be expressed in terms of a hypergeometric function. See hypergeometric_representation.

Categories: Special functions ·
Function: erfi (z)
The Imaginary Error Function.

Categories: Special functions ·
Function: erf_generalized (z1,z2)
Generalized Error function Erf(z1,z2):

This can also be expressed in terms of a hypergeometric function. See hypergeometric_representation.

Categories: Special functions ·
Function: fresnel_c (z)
The Fresnel Integral

(A&S eqn 7.3.1) and (DLMF 7.2.E7).

The simplification

is applied when flag trigsign is true.

The simplification

is applied when flag %iargs is true.

See flags erf_representation and hypergeometric_representation.

Categories: Special functions ·
Function: fresnel_s (z)
The Fresnel Integral

(A&S eqn 7.3.2) and (DLMF 7.2.E8).

The simplification

is applied when flag trigsign is true.

The simplification

is applied when flag %iargs is true.

See flags erf_representation and hypergeometric_representation.

Categories: Special functions ·
Option variable: erf_representation
Default value: false

erf_representation controls how the error functions are represented. It must be set to one of false, erf, erfc, or erfi. When set to false, the error functions are not modified. When set to erf, all error functions (erfc, erfi, erf_generalized, fresnel_s and fresnel_c) are converted to erf functions. Similarly, erfc converts error functions to erfc. Finally erfi converts the functions to erfi.

Converting to erf:

(%i1) erf_representation:erf;
(%o1) erf
(%i2) erfc(z);
(%o2) 1 - erf(z)
(%i3) erfi(z);
(%o3) - %i erf(%i z)
(%i4) erf_generalized(z1,z2);
(%o4) erf(z2) - erf(z1)
(%i5) fresnel_c(z);

                    sqrt(%pi) (%i + 1) z

(%o5) ((1 - %i) (erf(--------------------)

                             2
                                       sqrt(%pi) (1 - %i) z
                              + %i erf(--------------------)))/4
                                                2

(%i6) fresnel_s(z);

                    sqrt(%pi) (%i + 1) z

(%o6) ((%i + 1) (erf(--------------------)

                             2
                                       sqrt(%pi) (1 - %i) z
                              - %i erf(--------------------)))/4
                                                2

Converting to erfc:

(%i1) erf_representation:erfc;
(%o1) erfc
(%i2) erf(z);
(%o2) 1 - erfc(z)
(%i3) erfc(z);
(%o3) erfc(z)
(%i4) erf_generalized(z1,z2);
(%o4) erfc(z1) - erfc(z2)
(%i5) fresnel_s(c);

                       sqrt(%pi) (%i + 1) c

(%o5) ((%i + 1) (- erfc(--------------------)

                                2
                                  sqrt(%pi) (1 - %i) c
                   - %i (1 - erfc(--------------------)) + 1))/4
                                           2

(%i6) fresnel_c(c);

                       sqrt(%pi) (%i + 1) c

(%o6) ((1 - %i) (- erfc(--------------------)

                                2
                                  sqrt(%pi) (1 - %i) c
                   + %i (1 - erfc(--------------------)) + 1))/4
                                           2

Converting to erfc:

(%i1) erf_representation:erfi;
(%o1) erfi
(%i2) erf(z);
(%o2) - %i erfi(%i z)
(%i3) erfc(z);
(%o3) %i erfi(%i z) + 1
(%i4) erfi(z);
(%o4) erfi(z)
(%i5) erf_generalized(z1,z2);
(%o5) %i erfi(%i z1) - %i erfi(%i z2)
(%i6) fresnel_s(z);

                          sqrt(%pi) %i (%i + 1) z

(%o6) ((%i + 1) (- %i erfi(-----------------------)

                                     2
                                    sqrt(%pi) (1 - %i) %i z
                             - erfi(-----------------------)))/4
                                               2

(%i7) fresnel_c(z);

                     sqrt(%pi) (1 - %i) %i z

(%o7) ((1 - %i) (erfi(-----------------------)

                                2
                                    sqrt(%pi) %i (%i + 1) z
                          - %i erfi(-----------------------)))/4
                                               2

Option variable: hypergeometric_representation
Default value: false

Enables transformation to a Hypergeometric representation for fresnel_s and fresnel_c and other error functions.

(%i1) hypergeometric_representation:true;
(%o1) true
(%i2) fresnel_s(z);

                                              2  4
                             3    3  7     %pi  z    3
         %pi hypergeometric([-], [-, -], - -------) z
                             4    2  4       16

(%o2) ---------------------------------------------

                               6

(%i3) fresnel_c(z);

                                            2  4
                           1    1  5     %pi  z

(%o3) hypergeometric([-], [-, -], - -------) z

                           4    2  4       16

(%i4) erf(z);

                                                  2
                                   3    2      - z
            2 hypergeometric([1], [-], z ) z %e
                                   2

(%o4) ---------------------------------------

                           sqrt(%pi)

(%i5) erfi(z);

                                 1    3    2
               2 hypergeometric([-], [-], z ) z
                                 2    2

(%o5) --------------------------------

                          sqrt(%pi)

(%i6) erfc(z);

                                                    2
                                     3    2      - z
              2 hypergeometric([1], [-], z ) z %e
                                     2

(%o6) 1 - ---------------------------------------

                             sqrt(%pi)

(%i7) erf_generalized(z1,z2);

                                              2
                            3     2       - z2
     2 hypergeometric([1], [-], z2 ) z2 %e
                            2

(%o7) ------------------------------------------

                     sqrt(%pi)
                                                               2
                                             3     2       - z1
                      2 hypergeometric([1], [-], z1 ) z1 %e
                                             2
                    - ------------------------------------------
                                      sqrt(%pi)

Next: Hypergeometric Functions, Previous: Error Function, Up: Special Functions [Contents][Index]

17.7 Struve Functions
The Struve functions are defined in Abramowitz and Stegun, Handbook of Mathematical Functions, A&S Chapter 12 and (DLMF 11). The Struve Function

is a particular solution of the differential equation:

which has the general soution

Function: struve_h (v, z)
The Struve Function H of order

and argument z:

(A&S eqn 12.1.3) and (DLMF 11.2.E1).

When besselexpand is true, struve_h is expanded in terms of elementary functions when the order v is half of an odd integer. See besselexpand.

Categories: Special functions ·
Function: struve_l (v, z)
The Modified Struve Function L of order

and argument z:

(A&S eqn 12.2.1) and (DLMF 11.2.E2).

When besselexpand is true, struve_l is expanded in terms of elementary functions when the order v is half of an odd integer. See besselexpand.

Categories: Special functions ·
Next: Parabolic Cylinder Functions, Previous: Struve Functions, Up: Special Functions [Contents][Index]

17.8 Hypergeometric Functions
The Hypergeometric Functions are defined in Abramowitz and Stegun, Handbook of Mathematical Functions, A&S Chapters 13 and A&S 15.

Maxima has very limited knowledge of these functions. They can be returned from function hgfred.

Function: %m [k,u] (z)
Whittaker M function (A&S eqn 13.1.32):

where M(a,b,z) is Kummer’s solution of the confluent hypergeometric equation.

This can also be expressed by the series (DLMF 13.14.E6):

Categories: Special functions ·
Function: %w [k,u] (z)
Whittaker W function (A&S eqn 13.1.33):

where U(a,b,z) is Kummer’s second solution of the confluent hypergeometric equation.

Categories: Special functions ·
Function: %f [p,q] ([a],[b],z)
The

hypergeometric function, where a a list of length p and b a list of length q.

Categories: Bessel functions · Special functions ·
Function: hypergeometric ([a1, ..., ap],[b1, ... ,bq], x)
The hypergeometric function. Unlike Maxima’s %f hypergeometric function, the function hypergeometric is a simplifying function; also, hypergeometric supports complex double and big floating point evaluation. For the Gauss hypergeometric function, that is p = 2 and q = 1, floating point evaluation outside the unit circle is supported, but in general, it is not supported.

When the option variable expand_hypergeometric is true (default is false) and one of the arguments a1 through ap is a negative integer (a polynomial case), hypergeometric returns an expanded polynomial.

Examples:

(%i1) hypergeometric([],[],x);

                                x

(%o1) %e
Polynomial cases automatically expand when expand_hypergeometric is true:

(%i1) hypergeometric([-3],[7],x);
(%o1) hypergeometric([- 3], [7], x)
(%i2) hypergeometric([-3],[7],x), expand_hypergeometric : true;

                       3       2
                      x     3 x    3 x

(%o2) - --- + ---- - --- + 1

                      504    56     7

Both double float and big float evaluation is supported:

(%i1) hypergeometric([5.1],[7.1 + %i],0.42);
(%o1) 1.3462507863753337 - 0.0559061414208204 %i
(%i2) hypergeometric([5,6],[8], 5.7 - %i);
(%o2) 0.007375824009774945 - 0.0010498136885786736 %i
(%i3) hypergeometric([5,6],[8], 5.7b0 - %i), fpprec : 30;
(%o3) 7.37582400977494674506442010824b-3

                         - 1.04981368857867315858055393376b-3 %i

Function: hypergeometric_simp (e)
hypergeometric_simp simplifies hypergeometric functions by applying hgfred to the arguments of any hypergeometric functions in the expression e.

Only instances of hypergeometric are affected; any %f, %w, and %m in the expression e are not affected. Any unsimplified hypergeometric functions are returned unchanged (instead of changing to %f as hgfred would).

load("hypergeometric"); loads this function.

See also hgfred.

Examples:

(%i1) load ("hypergeometric") $
(%i2) foo : [hypergeometric([1,1], [2], z), hypergeometric([1/2], [1], z)];
(%o2) [hypergeometric([1, 1], [2], z),

                                                    1
                                    hypergeometric([-], [1], z)]
                                                    2

(%i3) hypergeometric_simp (foo);

                log(1 - z)    z/2             z

(%o3) [- ----------, %e bessel_i(0, -)]

                    z                         2

(%i4) bar : hypergeometric([n], [m], z + 1);
(%o4) hypergeometric([n], [m], z + 1)
(%i5) hypergeometric_simp (bar);
(%o5) hypergeometric([n], [m], z + 1)
Categories: Hypergeometric functions · Simplification functions · Special functions ·
Function: hgfred (a, b, t)
Simplify the generalized hypergeometric function in terms of other, simpler, forms. a is a list of numerator parameters and b is a list of the denominator parameters.

If hgfred cannot simplify the hypergeometric function, it returns an expression of the form %f[p,q]([a], [b], x) where p is the number of elements in a, and q is the number of elements in b. This is the usual

generalized hypergeometric function.

(%i1) assume(not(equal(z,0)));
(%o1) [notequal(z, 0)]
(%i2) hgfred([v+1/2],[2*v+1],2*%i*z);

             v/2                               %i z
            4    bessel_j(v, z) gamma(v + 1) %e

(%o2) ---------------------------------------

                               v
                              z

(%i3) hgfred([1,1],[2],z);

                           log(1 - z)

(%o3) - ----------

                               z

(%i4) hgfred([a,a+1/2],[3/2],z^2);

                       1 - 2 a          1 - 2 a
                (z + 1)        - (1 - z)

(%o4) -------------------------------

                         2 (1 - 2 a) z

It can be beneficial to load orthopoly too as the following example shows. Note that L is the generalized Laguerre polynomial.

(%i1) load("orthopoly")$
(%i2) hgfred([-2],[a],z);

                          2
                         z        2 z

(%o2) --------- - --- + 1

                      a (a + 1)    a

(%i3) ev(%);

                          2
                         z        2 z

(%o3) --------- - --- + 1

                      a (a + 1)    a

Next: Functions and Variables for Special Functions, Previous: Hypergeometric Functions, Up: Special Functions [Contents][Index]

17.9 Parabolic Cylinder Functions
The Parabolic Cylinder Functions are defined in Abramowitz and Stegun, Handbook of Mathematical Functions, A&S Chapter 19.

Maxima has very limited knowledge of these functions. They can be returned from function specint.

Function: parabolic_cylinder_d (v, z)
The parabolic cylinder function parabolic_cylinder_d(v,z). (A&S eqn 19.3.1).

The solution of the Weber differential equation

has two independent solutions, one of which is

the parabolic cylinder d function.

Function specint can return expressions containing parabolic_cylinder_d(v,z) if the option variable prefer_d is true.

Categories: Special functions ·
Previous: Parabolic Cylinder Functions, Up: Special Functions [Contents][Index]

17.10 Functions and Variables for Special Functions
Function: lambert_w (z)
The principal branch of Lambert’s W function W(z) (DLMF 4.13), the solution of

Categories: Special functions ·
Function: generalized_lambert_w (k, z)
The k-th branch of Lambert’s W function W(z) (DLMF 4.13), the solution of

The principal branch, denoted

in DLMF, is lambert_w(z) = generalized_lambert_w(0,z).

The other branch with real values, denoted

in DLMF, is generalized_lambert_w(-1,z).

Categories: Special functions ·
Function: kbateman [v] (x)
The Bateman k function

It is one solution of a differential equation which appears in the theory of turbulence:

It is a special case of the confluent hypergeometric function for x > 0:

where U is the confluent hypergeometric function. Also, we have

where

is the Whittaker W function.

Some examples:

(%i1) assume(x > 0)$
(%i2) makelist(kbateman[n](0),n,0,5);

                     2          2         2

(%o2) [0, ---, 0, - -----, 0, -----]

                    %pi       3 %pi     5 %pi

(%i3) kbateman[0](x);

                               - x

(%o3) %e
(%i4) kbateman[2](x);

                               - x

(%o4) 2 %e x
(%i5) kbateman[4](x);

                           - x

(%o5) 2 %e (x - 1) x
(%i6) kbateman[3](x);
(%o6) kbateman (x)

                                 3

Maxima can calculate the Laplace transform of kbateman using laplace or specint, as shown below:

(%i1) assume(s>0)$
(%i2) specint(kbateman[v](z)*exp(-s*z),z);

                              v        v   s - 1
             2 %f    ([2, 1 - -], [2 - -], -----)
                 2, 1         2        2   s + 1

(%o2) ------------------------------------

                     2           v        v
              (s + 1)  gamma(2 - -) gamma(- + 1)
                                 2        2

Categories: Special functions ·
Function: nzeta (z)
The Plasma Dispersion Function

Categories: Special functions ·
Function: nzetar (z)
Returns realpart(nzeta(z)).

Categories: Special functions ·
Function: nzetai (z)
Returns imagpart(nzeta(z)).

Categories: Special functions ·
Next: Elliptic Functions, Previous: Polynomials [Contents][Index]