log(z, b=::Math::E)
Returns the natural logarithm of Complex. If a second argument is given, it will be the base of logarithm.
CMath.log(1 + 4i) #=> (1.416606672028108+1.3258176636680326i) CMath.log(1 + 4i, 10) #=> (0.6152244606891369+0.5757952953408879i)
# File lib/cmath.rb, line 82 def log(z, b=::Math::E) begin if z.real? && z >= 0 && b >= 0 RealMath.log(z, b) else Complex(RealMath.log(z.abs), z.arg) / log(b) end rescue NoMethodError handle_no_method_error end end