exp(z)
Math::E raised to the z power
exp(Complex(0,0)) #=> 1.0+0.0i exp(Complex(0,PI)) #=> -1.0+1.2246467991473532e-16i exp(Complex(0,PI/2.0)) #=> 6.123233995736766e-17+1.0i
# File lib/cmath.rb, line 52 def exp(z) begin if z.real? exp!(z) else ere = exp!(z.real) Complex(ere * cos!(z.imag), ere * sin!(z.imag)) end rescue NoMethodError handle_no_method_error end end