Go language provides inbuilt support for basic constants and mathematical functions for complex numbers with the help of the cmplx package. You are allowed to find the natural logarithm of the specified complex number with the help of Log() function provided by the math/cmplx package. So, you need to add a math/cmplx package in your program with the help of the import keyword to access the Log() function.
func Log(y complex128) complex128
Let us discuss this concept with the help of the given examples:
Result 1: (0.0+1.6i) Result 2: (2.5+1.9i) Result 3: (2.2-1.9i)
Complex Number 1: (0+2i) Natural logarithm 1: (0.7+1.6i) Complex Number 2: (4+6i) Natural logarithm 2: (2.0+1.0i) Sum : (2.7+2.6i)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.