📌  相关文章
📜  在 Golang 中找到复数的反双曲正弦

📅  最后修改于: 2021-10-24 13:18:11             🧑  作者: Mango

Go 语言在 cmplx 包的帮助下为复数的基本常量和数学函数提供了内置支持。您可以借助 math/cmplx 包提供的Asinh()函数找到指定复数的反双曲正弦值。因此,您需要借助 import 关键字在程序中添加一个math/cmplx 包来访问 Asinh()函数。

句法:

func Asinh(x complex128) complex128

让我们在给定示例的帮助下讨论这个概念:

示例 1:

// Golang program to illustrate how to find the
// Inverse Hyperbolic Sine of Complex Number
package main
  
import (
    "fmt"
    "math/cmplx"
)
  
// Main function
func main() {
  
    // Finding inverse hyperbolic sine of
    // the specified complex number
    // Using Asinh() function
    res_1 := cmplx.Asinh(2 + 5i)
    res_2 := cmplx.Asinh(-9 + 8i)
    res_3 := cmplx.Asinh(-5 - 7i)
  
    // Displaying the result
    fmt.Println("Result 1:", res_1)
    fmt.Println("Result 2:", res_2)
    fmt.Println("Result 3:", res_3)
}

输出:

Result 1: (2.37054853731792+1.184231684275022i)
Result 2: (-3.1817205225071747+0.7249311476979132i)
Result 3: (-2.8440976626506607-0.9473406443130534i)

示例 2:

// Golang program to illustrate how to find
// Inverse Hyperbolic Sine of Complex Number
  
package main
  
import (
    "fmt"
    "math/cmplx"
)
  
// Main function
func main() {
  
    cnumber_1 := complex(2, 3)
    cnumber_2 := complex(6, 8)
  
    // Finding inverse hyperbolic sine
    cvalue_1 := cmplx.Asinh(cnumber_1)
    cvalue_2 := cmplx.Asinh(cnumber_2)
  
    // Sum of two inverse 
    // hyperbolic sine values
    res := cvalue_1 + cvalue_2
  
    // Displaying results
    fmt.Println("Complex Number 1: ", cnumber_1)
    fmt.Println("Inverse hyperbolic sine 1: ", cvalue_1)
  
    fmt.Println("Complex Number 2: ", cnumber_2)
    fmt.Println("Inverse hyperbolic sine 2: ", cvalue_2)
    fmt.Println("Sum of inverse hyperbolic sines : ", res)
  
}

输出:

Complex Number 1:  (2+3i)
Inverse hyperbolic sine 1:  (1.9686379257930964+0.9646585044076027i)
Complex Number 2:  (6+8i)
Inverse hyperbolic sine 2:  (2.995040217583994+0.9248902126310973i)
Sum of inverse hyperbolic sines :  (4.9636781433770905+1.8895487170387i)