### 15.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): $$ {\rm erf}\ z = {{2\over \sqrt{\pi}}} \int_0^z e^{-t^2}\, dt $$

  (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): $$ {\rm erfc}\ z = 1 - {\rm erf}\ 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. $$ {\rm erfi}\ z = -i\, {\rm erf}(i z) $$

  Categories:Special functions ·

Function: erf_generalized (z1,z2)

  Generalized Error function Erf(z1,z2): $$ {\rm erf}(z_1, z_2) = {{2\over \sqrt{\pi}}} \int_{z_1}^{z_2} e^{-t^2}\, dt $$

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

  Categories:Special functions ·

Function: fresnel_c (z)

  The Fresnel Integral

  $$ C(z) = \int_0^z \cos\left({\pi \over 2} t^2\right)\, dt $$

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

  The simplification \(C(-x) = -C(x)\) is applied when flag `trigsign` is true.

  The simplification \(C(ix) = iC(x)\) is applied when flag `%iargs` is true.

  See flags `erf_representation` and `hypergeometric_representation`.

  Categories:Special functions ·

Function: fresnel_s (z)

  The Fresnel Integral $$ S(z) = \int_0^z \sin\left({\pi \over 2} t^2\right)\, dt $$

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

  The simplification \(S(-x) = -S(x)\) is applied when flag `trigsign` is true.

  The simplification \(S(ix) = iS(x)\) 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. Similary, `erfc` converts error functions to `erfc`. Finally `erfi` converts the functions to `erfi`.

  Converting to `erf`:

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

  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);
      (%o7)
                         sqrt(%pi) (1 - %i) %i z            sqrt(%pi) %i (%i + 1) z
          (1 - %i) (erfi(-----------------------) - %i erfi(-----------------------))
                                    2                                  2
          ---------------------------------------------------------------------------
                                               4

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);
                                              1    3      2
                            2 hypergeometric([-], [-], - z ) z
                                              2    2
      (%o4)                 ----------------------------------
                                        sqrt(%pi)
      (%i5) erfi(z);
                                               1    3    2
                             2 hypergeometric([-], [-], z ) z
                                               2    2
      (%o5)                  --------------------------------
                                        sqrt(%pi)
      (%i6) erfc(z);
                                                1    3      2
                              2 hypergeometric([-], [-], - z ) z
                                                2    2
      (%o6)               1 - ----------------------------------
                                          sqrt(%pi)
      (%i7) erf_generalized(z1,z2);
                              1    3       2
            2 hypergeometric([-], [-], - z2 ) z2
                              2    2
      (%o7) ------------------------------------
                         sqrt(%pi)
                                                                   1    3       2
                                                 2 hypergeometric([-], [-], - z1 ) z1
                                                                   2    2
                                               - ------------------------------------
                                                              sqrt(%pi)