| Modifier and Type | Field and Description |
|---|---|
| private static final double | ATLEAST_27LN2
For x larger than this, e-x is negligible compared with ex, or equivalently 1 is negligible compared with e2x, in IEEE-754 floating point. |
| public static final PyFloat | |
| private static final double | |
| private static final double | LOG10E
log10e (Ref: Abramowitz & Stegun [1972], p3). |
| private static final double | NEARLY_LN_DBL_MAX
ln( |
| public static final PyFloat | |
| private static final double | ROOT_HALF
2-½ (Ref: Abramowitz & Stegun [1972], p2). |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static PyComplex | |
| private static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| private static PyComplex | Returns: sinh-1w or sin-1wtrue to compute sinh-1w, false to
compute sin-1w.Helper to compute either sin-1w or sinh-1w. |
| public static PyComplex | |
| public static PyComplex | |
| private static PyComplex | Returns: tanh-1w or tan-1wtrue to compute tanh-1w, false to
compute tan-1w.Helper to compute either tan-1w or tanh-1w. |
| private static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| private static PyComplex | |
| private static PyComplex | |
| private static PyComplex | |
| public static PyComplex | |
| public static boolean | |
| public static boolean | |
| public static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| private static double | Returns: ½ln(u2+v2)Helper function for the log of a complex number, dealing with the log magnitude, and without intermediate overflow or underflow. |
| public static double | |
| public static PyTuple | |
| public static PyComplex | Returns: reiφradius r, double angle phi)Return the complex number x with polar coordinates r and phi. |
| public static PyComplex | |
| public static PyComplex | |
| private static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| public static PyComplex | |
| private static PyComplex |
| ATLEAST_27LN2 | back to summary |
|---|---|
| private static final double ATLEAST_27LN2 For x larger than this, e-x is negligible compared with ex, or equivalently 1 is negligible compared with e2x, in IEEE-754 floating point. Beyond this, sinh x and cosh x are adequately approximated by 0.5ex. The smallest theoretical value is 27 ln(2). | |
| e | back to summary |
|---|---|
| public static final PyFloat e | |
| HALF_E2 | back to summary |
|---|---|
| private static final double HALF_E2 | |
| LOG10E | back to summary |
|---|---|
| private static final double LOG10E log10e (Ref: Abramowitz & Stegun [1972], p3). | |
| NEARLY_LN_DBL_MAX | back to summary |
|---|---|
| private static final double NEARLY_LN_DBL_MAX ln( | |
| pi | back to summary |
|---|---|
| public static final PyFloat pi | |
| ROOT_HALF | back to summary |
|---|---|
| private static final double ROOT_HALF 2-½ (Ref: Abramowitz & Stegun [1972], p2). | |
| cmath | back to summary |
|---|---|
| public cmath() | |
| _acos | back to summary |
|---|---|
| private static PyComplex _acos(PyComplex w) Helper to compute cos-1w. The method used is as in CPython:
a = (1-w)½ = √2 sin z/2 Then, with z = x+iy, a = a1+ia2, and b = b1+ib2,
a1 / b1 = tan x/2
and we use For w sufficiently large that w2≫1, cos-1w ≈ -i ln(2w).
| |
| _acosh | back to summary |
|---|---|
| private static PyComplex _acosh(PyComplex w) Helper to compute z = cosh-1w. The method used is as in CPython:
a = (w-1)½ = √2 sinh z/2 Then, with z = x+iy, a = a1+ia2, and b = b1+ib2,
a1b1 + a2b2 = sinh x
and we use For w sufficiently large that w2≫1, cosh-1w ≈ ln(2w). We do not use this method also to compute cos-1w, because the branch cuts do not correspond.
| |
| acos | back to summary |
|---|---|
| public static PyComplex acos(PyObject w) Return the arc cosine of w. There are two branch cuts. One extends right from 1 along the real axis to ∞, continuous from below. The other extends left from -1 along the real axis to -∞, continuous from above.
| |
| acosh | back to summary |
|---|---|
| public static PyComplex acosh(PyObject w) Return the hyperbolic arc cosine of w. There is one branch cut, extending left from 1 along the real axis to -∞, continuous from above.
| |
| asin | back to summary |
|---|---|
| public static PyComplex asin(PyObject w) Return the arc sine of w. There are two branch cuts. One extends right from 1 along the real axis to ∞, continuous from below. The other extends left from -1 along the real axis to -∞, continuous from above.
| |
| asinh | back to summary |
|---|---|
| public static PyComplex asinh(PyObject w) Return the hyperbolic arc sine of w. There are two branch cuts. One extends from 1j along the imaginary axis to ∞j, continuous from the right. The other extends from -1j along the imaginary axis to -∞j, continuous from the left.
| |
| asinOrAsinh | back to summary |
|---|---|
| private static PyComplex asinOrAsinh(PyComplex w, boolean h) Helper to compute either sin-1w or sinh-1w. The method used is as in CPython:
a = (1-iw)½ = √2 sin(π/4-iz/2) Then, with w = u+iv, z = x+iy, a = a1+ia2, and b = b1+ib2,
a1b2 - a2b2 = sinh x
and we use For w sufficiently large that w2≫1, sinh-1w ≈ ln(2w). When computing sin-1w, we evaluate -i sinh-1iw instead.
| |
| atan | back to summary |
|---|---|
| public static PyComplex atan(PyObject w) Return the arc tangent of w. There are two branch cuts. One extends from 1j along the imaginary axis to ∞j, continuous from the right. The other extends from -1j along the imaginary axis to -∞j, continuous from the left.
| |
| atanh | back to summary |
|---|---|
| public static PyComplex atanh(PyObject w) Return the hyperbolic arc tangent of w. There are two branch cuts. One extends from 1 along the real axis to ∞, continuous from below. The other extends from -1 along the real axis to -∞, continuous from above.
| |
| atanOrAtanh | back to summary |
|---|---|
| private static PyComplex atanOrAtanh(PyComplex w, boolean h) Helper to compute either tan-1w or tanh-1w. The method used is close to that used in CPython. For z = tanh-1w: z = ½ln(1 + 2w/(1-w)) Then, letting z = x+iy, and w = u+iv,
x = ¼ln(1 + 4u/((1-u)2+v2)) =
-¼ln(1 - 4u/((1+u)2+v2))
We use
| |
| complexFromPyObject | back to summary |
|---|---|
| private static PyComplex complexFromPyObject(PyObject obj) | |
| cos | back to summary |
|---|---|
| public static PyComplex cos(PyObject z) Return the cosine of z.
| |
| cosh | back to summary |
|---|---|
| public static PyComplex cosh(PyObject z) Return the hyperbolic cosine of z.
| |
| cosOrCosh | back to summary |
|---|---|
| private static PyComplex cosOrCosh(PyComplex z, boolean h) Helper to compute either cos z or cosh z.
| |
| exceptNaN | back to summary |
|---|---|
| private static PyComplex exceptNaN(PyComplex result, PyComplex arg) throws PyException Turn a
| |
| exceptNaN | back to summary |
|---|---|
| private static PyComplex exceptNaN(PyComplex result, double a, double b) throws PyException Raise | |
| exp | back to summary |
|---|---|
| public static PyComplex exp(PyObject z) Return the exponential value ez.
| |
| isinf | back to summary |
|---|---|
public static boolean isinf(PyObject in)
| |
| isnan | back to summary |
|---|---|
public static boolean isnan(PyObject in)
| |
| log | back to summary |
|---|---|
| public static PyComplex log(PyObject w) Returns the natural logarithm of w.
| |
| log | back to summary |
|---|---|
| public static PyComplex log(PyObject w, PyObject b) Returns the logarithm of w to the given base. If the base is not specified, returns the natural logarithm of w. There is one branch cut, from 0 along the negative real axis to -∞, continuous from above.
| |
| log10 | back to summary |
|---|---|
| public static PyComplex log10(PyObject w) Returns the common logarithm of w (base 10 logarithm).
| |
| logHypot | back to summary |
|---|---|
| private static double logHypot(double u, double v) Helper function for the log of a complex number, dealing with the log magnitude, and without intermediate overflow or underflow. It returns ln r, where r2 = u2+v2. To do this it computes ½ln(u2+v2). Special cases are handled as follows:
Math.log(Math.hypot(u,v)) because a valid
result is still possible even when hypot(u,v) overflows, and because there's no
point in taking a square root when a log is to follow.
| |
| phase | back to summary |
|---|---|
| public static double phase(PyObject in) | |
| polar | back to summary |
|---|---|
| public static PyTuple polar(PyObject in) | |
| rect | back to summary |
|---|---|
| public static PyComplex rect(double r, double phi) Return the complex number x with polar coordinates r and phi. Equivalent to
| |
| sin | back to summary |
|---|---|
| public static PyComplex sin(PyObject z) Return the sine of z.
| |
| sinh | back to summary |
|---|---|
| public static PyComplex sinh(PyObject z) Return the hyperbolic sine of z.
| |
| sinOrSinh | back to summary |
|---|---|
| private static PyComplex sinOrSinh(PyComplex z, boolean h) Helper to compute either sin z or sinh z.
| |
| sqrt | back to summary |
|---|---|
| public static PyComplex sqrt(PyObject w) Calculate z = x+iy, such that z2 = w. In taking the square roots to get x and y, we choose to have x≥0 always, and y the same sign as v. | |
| tan | back to summary |
|---|---|
| public static PyComplex tan(PyObject z) Return the tangent of z.
| |
| tanh | back to summary |
|---|---|
| public static PyComplex tanh(PyObject z) Return the hyperbolic tangent of z.
| |
| tanOrTanh | back to summary |
|---|---|
| private static PyComplex tanOrTanh(PyComplex z, boolean h) Helper to compute either tan z or tanh z. The expression used is: tanh(x+iy) = (sinh x cosh x + i sin y cos y) / (sinh2x + cos2y) A simplification is made for x sufficiently large that e2|x|≫1 that deals satisfactorily with large or infinite x. When computing tan, we evaluate i tan iz instead, and the approximation applies to e2|y|≫1.
| |