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);
    
  }
}




















Home »
  Java Tutorial »
    Development »




Java Algorithms
Java Clipboard
Java Compiler
Java Desktop
Java Virtual Machine
Java Math
OS
Random
Java Robot
Java RuntimeMXBean
Java Timer
Java UUID
Java Internationalization