역삼각함수란 삼각함수의 역함수를 의미하고,

역쌍곡선함수란 쌍곡선함수의 역함수를 의미한다.

수학에서 sin 함수의 역함수는 arcsin 으로 표기되는데,

Java 언어에서는 java.lang.Math.asin(double) 메소드로 구현되어 있다.

 

/*
 * Filename: TestArcSine.java
 *
 * Compile: javac -d . TestArcSine.java
 * Execute: java TestArcSine
 *
 * Date: 2013. 1. 1.
 * Copyright (c) pkim _AT_ scripts.pe.kr
 */

public class TestArcSine {
        public static double sin(double x)  {
            double y = Math.sin(x);
            return y;
        }

        public static double asin(double x) {
            double y = Math.asin(x);
            return y;
        }

        public static double sinh(double x) {
            double y = Math.sinh(x);
            return y;
        }

        public static double cosh(double x) {
            double y = Math.cosh(x);
            return y;
        }

        public static double asinh(double x)
        {
            double y = Math.log(x + Math.sqrt(x*x + 1));
            return y;
        }

        public static double acosh(double x)
        {
            double y = Math.log(x + Math.sqrt(x*x - 1));
            return y;
        }

        public static void main(String[] args)
        {
            double x = -0.9;
            double y = asin(x);
            System.out.printf("y = asin(%.1g) = %.9f\n", x,  y);
            System.out.printf("sin(y) = sin(%.9f) = %.1g\n",  y, sin(y));
            System.out.printf("\n");

            x = 1.1;
            double u = acosh(x);
            System.out.printf("u = acosh(%3.2g) = %.10f\n", x,  u);

            double v = asinh(x);
            System.out.printf("v = asinh(%3.2g) = %.10f\n", x,  v);

            System.out.printf("cosh(u) = cosh(%.10f) = %3.2g\n", u,  cosh(u));
            System.out.printf("sinh(v) = sinh(%.10f) = %3.2g\n", v,  sinh(v));
        }
}

/*
Output:
y = asin(-0.9) = -1.119769515
sin(y) = sin(-1.119769515) = -0.9

u = acosh(1.1) = 0.4435682544
v = asinh(1.1) = 0.9503469298
cosh(u) = cosh(0.4435682544) = 1.1
sinh(v) = sinh(0.9503469298) = 1.1
*/

 

 

Posted by Scripter
,