cmath

Il modulo cmath fornisce l’accesso alle funzioni con i numeri complessi.
Gli argomenti possono essere anche interi e reali… ma il risultato è sempre un numero complesso.

Costanti

cmath.e2.718281828459045
cmath.infinfinity
cmath.infjNumero complesso con parte immaginaria infinity
cmath.nannot a number
cmath.nanjNumero complesso con parte immaginaria not a number
cmath.pi3.141592653589793
cmath.tau: 6.283185307179586

Funzioni specifiche

Nome funzioneTipoFunzionalità
cmath.phase(c)floatRestituisce l’argomento di c.
Equivale a math.atan2(c.imag, c.real)
cmath.polar(c)tupleRestituisce la rappresentazione di c in coordinate polari.
Equivale a (abs(c), phase(c))
cmath.rect(r, phi)complexRestituisce il numero complesso con coordinate polari r e phi.
Equivale a r*(math.cos(phi)+math.sin(phi)*1j)

Continua con le funzioni matematiche per i numeri complessi

  1. cmath.acos(x), Return the arc cosine (measured in radians) of x.
  2. cmath.acosh(x), Return the inverse hyperbolic cosine of x.
  3. cmath.asin(x), Return the arc sine (measured in radians) of x.
  4. cmath.asinh(x), Return the inverse hyperbolic sine of x.
  5. cmath.atan(x), Return the arc tangent (measured in radians) of x.
  6. cmath.atanh(x), Return the inverse hyperbolic tangent of x.
  7. cmath.cos(x), Restituisce il coseno dell’angolo x espresso in radianti.
  8. cmath.cosh(x), Return the hyperbolic cosine of x.
  9. cmath.exp(x), Restituisce e elevato a x.
  10. cmath.log(x), Restituisce il logaritmo naturale (base e) di x.
  11. cmath.log(x, base), Restituisce il logaritmo con base data di x.
  12. cmath.log10(x), Restituisce il logaritmo con base 10 di x.
  13. cmath.sin(x), Restituisce il seno dell’angolo x espresso in radianti.
  14. cmath.sinh(x), Return the hyperbolic sine of x.
  15. cmath.sqrt(x), Restituisce la radice quadrata di x.
  16. cmath.tan(x), Restituisce la tangente dell’angolo x espresso in radianti.
  17. cmath.tanh(x), Return the hyperbolic tangent of x.

Valore logico

  • cmath.isfinite(x), Return True if x is neither an infinity nor a NaN, and False otherwise.
  • cmath.isinf(x), Return True if x is a positive or negative infinity, and False otherwise.
  • cmath.isnan(x), Return True if x is a NaN (not a number), and False otherwise.