Home >>Python cmath Module >Python cmath.log() Method

Python cmath.log() Method

Python cmath.log() Method

Python cmath.log() method in python is used to returns the natural logarithm of a complex value with base e. with two arguments it returns logarithm first argument (x) with the base of the second argument (base).

Syntax:
cmath.log(x, base)

Parameter Values

Parameter Description
X It is Required parameter used to Specifies the value to calculate the logarithm
Base It is Optional parameter to use the logarithm base. Default value is 'e'
Here is an Example of Python cmath.log() Method:

import cmath 
print (cmath.log(3+ 1.3j))
print (cmath.log(2, 4j))

Output:
(1.1846543625184769+0.4089078289509254j)
(0.21892443900448655-0.24806110035395335j)
Example 2:

import cmath 
tpoint = cmath.log(2) 
print(tpoint)

Output:
(0.6931471805599453+0j)