public static ComplexNumber Pow ( ComplexNumber z1 , double n ) { double norm = Math . pow ( z1 . getMagnitude ( ) , n ) ; double angle = 360 - Math . abs ( Math . toDegrees ( Math . atan ( z1 . imaginary / z1 . real ) ) ) ; double common = n * angle ; double r = norm * Math . cos ( Math . toRadians ( common ) ) ; double i = norm * Math . sin ( Math . toRadians ( common ) ) ; return new ComplexNumber ( r , i ) ; }
Calculate power of a complex number .