在Go語言中查詢複數的反雙曲正弦


在Go語言中,有內建函式可以查詢複數的反雙曲正弦。反雙曲正弦是一個數學函式,它返回複數的反雙曲正弦值。在本文中,我們將討論如何在Go語言中查詢複數的反雙曲正弦。

語法

在Go語言中查詢複數的反雙曲正弦的語法如下:

func Asinh(z complex128) complex128

Asinh()函式接受一個複數作為引數,並返回該數的反雙曲正弦。

示例1:查詢複數的反雙曲正弦

讓我們考慮以下示例來查詢複數的反雙曲正弦:

package main

import (
   "fmt"
   "math/cmplx"
)

func main() {
   // Creating a complex number
   z := complex(4, 3)

   // Finding the inverse hyperbolic sine of the complex number
   asinh := cmplx.Asinh(z)

   // Displaying the result
   fmt.Println("Inverse Hyperbolic Sine of", z, "is", asinh)
}

輸出

Inverse Hyperbolic Sine of (4+3i) is (2.305509031243477+0.6339838656391765i)

示例2:查詢負複數的反雙曲正弦

讓我們考慮以下示例來查詢負複數的反雙曲正弦:

package main

import (
   "fmt"
   "math/cmplx"
)

func main() {
   // Creating a complex number
   z := complex(-5, -12)

   // Finding the inverse hyperbolic sine of the complex number
   asinh := cmplx.Asinh(z)

   // Displaying the result
   fmt.Println("Inverse Hyperbolic Sine of", z, "is", asinh)
}

輸出

Inverse Hyperbolic Sine of (-5-12i) is (-3.257054943061329-1.1749515338392524i)

示例3:查詢純虛數的反雙曲正弦

讓我們考慮以下示例來查詢純虛數的反雙曲正弦:

package main

import (
   "fmt"
   "math/cmplx"
)
   
func main() {
   // Creating a complex number
   z := complex(0, 7)
   
   // Finding the inverse hyperbolic sine of the complex number
   asinh := cmplx.Asinh(z)
   
   // Displaying the result
   fmt.Println("Inverse Hyperbolic Sine of", z, "is", asinh)
}

輸出

Inverse Hyperbolic Sine of (0+7i) is (2.6339157938496336+1.5707963267948966i)

結論

在本文中,我們討論瞭如何使用內建的Asinh()函式在Go語言中查詢複數的反雙曲正弦。我們還提供了一些示例來幫助您理解如何使用此函式查詢不同型別複數的反雙曲正弦。

更新於:2023年4月17日

92 次瀏覽

啟動您的職業生涯

透過完成課程獲得認證

開始學習
廣告