在 Java 中獲取某個值的雙曲正弦


為了在 Java 中獲取某個值的雙曲正弦,我們使用 java.lang.Math.sinh() 方法。sinh() 方法接受弧度形式的引數,並返回該引數的雙曲正弦,該引數充當角度。

宣告 −  java.lang.Math.sinh() 宣告如下 −

public static double sinh(double x)

其中,x 以弧度表示的角度。

讓我們來看一個在 Java 中獲取某個值的雙曲正弦的程式。

示例

 現場演示

import java.lang.Math;
public class Example {
   public static void main(String[] args) {
      // get two double numbers in degrees
      double x = 90;
      double y = 180;
      // convert them in radians
      x = Math.toRadians(x);
      y = Math.toRadians(y);
      // computing and displaying the hyperbolic sine of these doubles
      System.out.println("Hyperbolic sine of " + x + " = " + Math.sinh(x));
      System.out.println("Hyperbolic sine of " + y + " = " + Math.sinh(y));
   }
}

輸出

Hyperbolic sine of 1.5707963267948966 = 2.3012989023072947
Hyperbolic sine of 3.141592653589793 = 11.548739357257748

更新日期: 26-Jun-2020

184 次瀏覽

開啟您的職業生涯

完成課程認證

立即開始
廣告