complx.Exp() Function in Golang With Examples

complx.Exp() Function in Golang is used to returns e**x, the base-e exponential of x.

Syntax:

func Exp(x complex128) complex128

Here, x is the set of all complex numbers real as well as imaginary parts.

Return Type: The return type of this function is a complex number.

Example 1:



filter_none

edit
close

play_arrow

link
brightness_4
code

// Golang program to illustrate
// the complx.Exp() Function
  
package main
  
// importing fmt and math/cmplx
import (
"fmt"
"math/cmplx"
)
  
// Calling main method
func main() {
      
    // using the function
    fmt.Printf("%.2f", cmplx.Exp(5 + 6i))
}

chevron_right


Output:

(142.50-41.47i)

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

// Golang program to illustrate
// the complx.Exp() Function
  
package main
  
// importing fmt and math/cmplx
import (
"fmt"
"math/cmplx"
)
  
// Calling main method
func main() {
      
    n := complex(7, 8)
      
    // using the function
    fmt.Printf("%.2f", cmplx.Exp(n))
}

chevron_right


Output:

(-159.56+1084.96i)
My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.