Calculate hyperbolic arc-sine in Java
Description
The following code shows how to calculate hyperbolic arc-sine.
Example
//from ww w. j a va2 s . co m
public strictfp class Main {
public static void main(String[] args) {
// Obtain angle in degrees from user
double degs = 20d;
// Convert degrees to radian
double rads = Math.toRadians(degs);
// Calculate hyperbolic sine
double sinHA = (Math.exp(rads) - Math.exp(-rads)) / 2;
System.out.println("Hyperbolic sine = " + sinHA);
// Calculate Hyperbolic cosine
double cosHA = (Math.exp(rads) + Math.exp(-rads)) / 2;
System.out.println("Hyperbolic cosine = " + cosHA);
// Calculate hyperbolic arc-sine
double asinHA = Math.log(sinHA + Math.sqrt((sinHA * sinHA) + 1.0));
degs = Math.toDegrees(asinHA);
System.out.println("Arc hyperbolic sine = " + degs);
}
}