La función complx.Exp() en Golang se usa para devolver e**x, el exponencial base-e de x.
Sintaxis:
func Exp(x complex128) complex128
Aquí, x es el conjunto de todos los números complejos tanto reales como imaginarios.
Tipo de retorno: el tipo de retorno de esta función es un número complejo.
Ejemplo 1:
// 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)) }
Producción:
(142.50-41.47i)
Ejemplo 2:
// 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)) }
Producción:
(-159.56+1084.96i)
Publicación traducida automáticamente
Artículo escrito por PranchalKatiyar y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA