Skip to main content
`Ctrl`+`K`

# scipy.special.erfinv

scipy.special.erfinv(y, out=None) = <ufunc 'erfinv'>

  Inverse of the error function.

  Computes the inverse of the error function.

  In the complex domain, there is no unique complex number w satisfying erf(w)=z. This indicates a true inverse function would be multivalued. When the domain restricts to the real, -1 < x < 1, there is a unique real number satisfying erf(erfinv(x)) = x.

  Parameters:
    y ndarray

      Argument at which to evaluate. Domain: [-1, 1]

    out ndarray, optional

      Optional output array for the function values

  Returns:
    erfinv scalar or ndarray

      The inverse of erf of y, element-wise

  See also

  `erf`

    Error function of a complex argument

  `erfc`

    Complementary error function, `1 - erf(x)`

  `erfcinv`

    Inverse of the complementary error function

  Examples

      >>> import numpy as np
      >>> import matplotlib.pyplot as plt
      >>> from scipy.special import erfinv, erf

      >>> erfinv(0.5)
      0.4769362762044699

      >>> y = np.linspace(-1.0, 1.0, num=9)
      >>> x = erfinv(y)
      >>> x
      array([       -inf, -0.81341985, -0.47693628, -0.22531206,  0.        ,
              0.22531206,  0.47693628,  0.81341985,         inf])

  Verify that `erf(erfinv(y))` is `y`.

      >>> erf(x)
      array([-1.  , -0.75, -0.5 , -0.25,  0.  ,  0.25,  0.5 ,  0.75,  1.  ])

  Plot the function:

      >>> y = np.linspace(-1, 1, 200)
      >>> fig, ax = plt.subplots()
      >>> ax.plot(y, erfinv(y))
      >>> ax.grid(True)
      >>> ax.set_xlabel('y')
      >>> ax.set_title('erfinv(y)')
      >>> plt.show()