Close

Java - Math.cosh() Examples

Java Java API 


Class:

java.lang.Math

java.lang.Objectjava.lang.Objectjava.lang.Mathjava.lang.MathLogicBig

Method:

public static double cosh(double x)

Returns the hyperbolic cosine of a double value. The hyperbolic cosine of x is defined to be (ex + e-x)/2 where e is java.lang.Math#E,Euler's number


Examples


package com.logicbig.example.math;

public class CoshExample {

public static void main(String... args) {
findHyperbolicCosine(90);
findHyperbolicCosine(60);
findHyperbolicCosine(45);
findHyperbolicCosine(30);
findHyperbolicCosine(0);
}

private static void findHyperbolicCosine(double angleInDegree) {
double angleInRadians = Math.toRadians(angleInDegree);
double cosh = Math.cosh(angleInRadians);
System.out.printf("Cosh of angle %s = %1.3f%n", angleInDegree, cosh);
}

}

Output

Cosh of angle 90.0 = 2.509
Cosh of angle 60.0 = 1.600
Cosh of angle 45.0 = 1.325
Cosh of angle 30.0 = 1.140
Cosh of angle 0.0 = 1.000




See Also