Facebook Page Twitter Page LinkedIn Page
× Python Tutorial Python Advanced Python Resources Python Libraries


The Python cmath.log10() function is used to return the base-10 logarithm of a given complex number. There is one branch cut, from 0 along the negative real axis to -∞, continuous from above.

Syntax

cmath.log10(x)

Parameters

x Required. Specify the number.

Return Value

Returns the base-10 logarithm of a given number.

Example:

In the below example, log10() function is used to calculate the base-10 logarithm of a given complex number.

import cmath

x = 2 + 2j
y = 2
z = 2j

print(cmath.log10(x))
print(cmath.log10(y))
print(cmath.log10(z))

The output of the above code will be:

(0.4515449934959718+0.3410940884604603j)
(0.30102999566398114+0j)
(0.30102999566398114+0.6821881769209206j)

❮ Python cMath Module