log cosh
数学课double cosh(double d) (Math Class double cosh(double d))
This method is available in java.lang package.
此方法在java.lang包中可用。
In this method, cosh stands for hyperbolic cosine of an angle.
在这种方法中,cosh代表某个角度的双曲余弦。
This method is used to return the hyperbolic cosine of an angle of the given parameter.
此方法用于返回给定参数角度的双曲余弦值。
This is a static method so it is accessible with the class name too.
这是一个静态方法,因此也可以使用类名进行访问。
The return type of this method is double that means it returns the hyperbolic cosine value of the given argument.
此方法的返回类型为double,这意味着它将返回给定参数的双曲余弦值。
In this method, we pass only one double type parameter as an argument (in radians) whose hyperbolic cosine is to be returned.
在此方法中,我们仅传递一个双精度类型参数作为参数(以弧度表示),其双曲余弦值将被返回。
This method does not throw any exception.
此方法不会引发任何异常。
Syntax:
句法:
public static double cosh(double d){
}
Parameter(s): double type parameter as an argument (in radians) whose hyperbolic cosine is to be returned.
参数:双精度型参数作为参数(以弧度表示),将返回其双曲余弦值。
Return value:
返回值:
The return type of this method is double, it returns the hyperbolic cosine of an angle.
此方法的返回类型为double ,它返回角度的双曲余弦值。
Note:
注意:
If we pass "NaN", it returns "NaN".
如果我们传递“ NaN”,则返回“ NaN”。
If we pass an infinity with any sign (positive or negative), it returns the same value.
如果我们传递带有任何符号(正数或负数)的无穷大,它将返回相同的值。
If we pass zero (-0 or 0), it returns 1.0.
如果传递零(-0或0),则返回1.0。
Java程序演示cosh(double d)方法的示例 (Java program to demonstrate example of cosh(double d) method)
// Java program to demonstrate the example of
// cosh(double d) method of Math Class
class CoshMethod {
public static void main(String[] args) {
// Here we are declaring few variables
double d1 = 7.0 / 0.0;
double d2 = -7.0 / 0.0;
double d3 = 0.0;
double d4 = -0.0;
double d5 = 60.0;
// Display previous value of d1,d2,d3,d4 and d5
System.out.println(" Before implementing cosh() so the value of d1 is : " + d1);
System.out.println(" Before implementing cosh() so the value of d2 is : " + d2);
System.out.println(" Before implementing cosh() so the value of d3 is : " + d3);
System.out.println(" Before implementing cosh() so the value of d4 is : " + d4);
System.out.println(" Before implementing cosh() so the value of d5 is : " + d5);
// By using toRadians() method to convert absolute value into radians.
d1 = Math.toRadians(d1);
d2 = Math.toRadians(d2);
d3 = Math.toRadians(d3);
d4 = Math.toRadians(d4);
d5 = Math.toRadians(d5);
// Here , we will get (infinity) because we are
// passing parameter whose value is (infinity)
System.out.println("After implementing cos() so the value of d1 is : " + Math.cosh(d1));
// Here , we will get (infinity) because we are
// passing parameter whose value is (-infinity)
System.out.println("After implementing cosh() so the value of d2 is : " + Math.cosh(d2));
// Here , we will get (1.0) because we are passing parameter
// whose value is (0.0)
System.out.println("After implementing cosh() so the value of d3 is : " + Math.cosh(d3));
// Here , we will get (1.0) because we are passing parameter
// whose value is (-0.0)
System.out.println("After implementing cosh() so the value of d4 is : " + Math.cosh(d4));
// Here we will find hyperbolic cosine of d5 by using cosh() method
System.out.println("After implementing cosh() so the value of d5 is : " + Math.cosh(d5));
}
}
Output
输出量
E:\Programs>javac CoshMethod.java
E:\Programs>java CoshMethod
Before implementing cosh() so the value of d1 is : Infinity
Before implementing cosh() so the value of d2 is : -Infinity
Before implementing cosh() so the value of d3 is : 0.0
Before implementing cosh() so the value of d4 is : -0.0
Before implementing cosh() so the value of d5 is : 60.0
After implementing cos() so the value of d1 is : Infinity
After implementing cosh() so the value of d2 is : Infinity
After implementing cosh() so the value of d3 is : 1.0
After implementing cosh() so the value of d4 is : 1.0
After implementing cosh() so the value of d5 is : 1.600286857702386
翻译自: https://www.includehelp.com/java/math-class-static-double-cosh-double-d-with-example.aspx
log cosh