cmath (Jython API documentation)
Date: 2024-08-18

org.python.modules

## Class cmath

- java.lang.Object
- - org.python.modules.cmath

-     public class cmath
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static PyFloat` | `e`
    `static PyFloat` | `pi`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `cmath()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static PyComplex` | `acos(PyObject w)` Return the arc cosine of w.
    `static PyComplex` | `acosh(PyObject w)` Return the hyperbolic arc cosine of w.
    `static PyComplex` | `asin(PyObject w)` Return the arc sine of w.
    `static PyComplex` | `asinh(PyObject w)` Return the hyperbolic arc sine of w.
    `static PyComplex` | `atan(PyObject w)` Return the arc tangent of w.
    `static PyComplex` | `atanh(PyObject w)` Return the hyperbolic arc tangent of w.
    `static PyComplex` | `cos(PyObject z)` Return the cosine of z.
    `static PyComplex` | `cosh(PyObject z)` Return the hyperbolic cosine of z.
    `static PyComplex` | `exp(PyObject z)` Return the exponential value ez.
    `static boolean` | `isinf(PyObject in)`
    `static boolean` | `isnan(PyObject in)`
    `static PyComplex` | `log(PyObject w)` Returns the natural logarithm of w.
    `static PyComplex` | `log(PyObject w, PyObject b)` Returns the logarithm of w to the given base.
    `static PyComplex` | `log10(PyObject w)` Returns the common logarithm of w (base 10 logarithm).
    `static double` | `phase(PyObject in)`
    `static PyTuple` | `polar(PyObject in)`
    `static PyComplex` | `rect(double r, double phi)` Return the complex number x with polar coordinates r and phi.
    `static PyComplex` | `sin(PyObject z)` Return the sine of z.
    `static PyComplex` | `sinh(PyObject z)` Return the hyperbolic sine of z.
    `static PyComplex` | `sqrt(PyObject w)` Calculate z = x+iy, such that z2 = w.
    `static PyComplex` | `tan(PyObject z)` Return the tangent of z.
    `static PyComplex` | `tanh(PyObject z)` Return the hyperbolic tangent of z.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### pi

          public static final PyFloat pi

    - #### e

          public static final PyFloat e

  - ### Constructor Detail

    - #### cmath

          public cmath()

  - ### Method Detail

    - #### acos

          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.
      Parameters:
        `w` -
      Returns:
        cos-1w

    - #### acosh

          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.
      Parameters:
        `w` -
      Returns:
        cosh-1w

    - #### asin

          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.
      Parameters:
        `w` -
      Returns:
        sin-1w

    - #### asinh

          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.
      Parameters:
        `w` -
      Returns:
        sinh-1w

    - #### atan

          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.
      Parameters:
        `w` -
      Returns:
        tan-1w

    - #### atanh

          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.
      Parameters:
        `w` -
      Returns:
        tanh-1w

    - #### cos

          public static PyComplex cos(PyObject z)

      Return the cosine of z.
      Parameters:
        `z` -
      Returns:
        cos z

    - #### cosh

          public static PyComplex cosh(PyObject z)

      Return the hyperbolic cosine of z.
      Parameters:
        `z` -
      Returns:
        cosh z

    - #### exp

          public static PyComplex exp(PyObject z)

      Return the exponential value ez.
      Parameters:
        `z` -
      Returns:
        ez

    - #### phase

          public static double phase(PyObject in)

    - #### polar

          public static PyTuple polar(PyObject in)

    - #### rect

          public static PyComplex rect(double r,
                                       double phi)

      Return the complex number x with polar coordinates r and phi. Equivalent to `r * (math.cos(phi) + math.sin(phi)*1j)`.
      Parameters:
        `r` - radius
        `phi` - angle
      Returns:
        reiφ

    - #### isinf

          public static boolean isinf(PyObject in)

      Parameters:
        `in` -
      Returns:
        `true` if in.real or in.imag is positive or negative infinity

    - #### isnan

          public static boolean isnan(PyObject in)

      Parameters:
        `in` -
      Returns:
        `true` if in.real or in.imag is nan.

    - #### log

          public static PyComplex log(PyObject w)

      Returns the natural logarithm of w.
      Parameters:
        `w` -
      Returns:
        ln w

    - #### log10

          public static PyComplex log10(PyObject w)

      Returns the common logarithm of w (base 10 logarithm).
      Parameters:
        `w` -
      Returns:
        log10w

    - #### log

          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.
      Parameters:
        `w` -
        `b` -
      Returns:
        logbw

    - #### sin

          public static PyComplex sin(PyObject z)

      Return the sine of z.
      Parameters:
        `z` -
      Returns:
        sin z

    - #### sinh

          public static PyComplex sinh(PyObject z)

      Return the hyperbolic sine of z.
      Parameters:
        `z` -
      Returns:
        sinh z

    - #### sqrt

          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.
      Parameters:
        `w` - to square-root
      Returns:
        w½

    - #### tan

          public static PyComplex tan(PyObject z)

      Return the tangent of z.
      Parameters:
        `z` -
      Returns:
        tan z

    - #### tanh

          public static PyComplex tanh(PyObject z)

      Return the hyperbolic tangent of z.
      Parameters:
        `z` -
      Returns:
        tanh z

Jython homepage