Java如何使用三角计算方法?
本示例演示如何使用java.lang.Math该类的三角方法。你可以看到使用方法,如Math.sin(),Math.cos(),Math.tan(),等。
package org.nhooo.example.math;
public class TrigonometricExample {
public static void main(String[] args) {
double radians = 1.0d;
double sine = Math.sin(radians);
double cosine = Math.cos(radians);
double tan = Math.tan(radians);
double asine = Math.asin(sine);
double acosine = Math.acos(cosine);
double atan = Math.atan(tan);
System.out.println("Sine of " + radians + " = " + sine);
System.out.println("Cosine of " + radians + " = " + cosine);
System.out.println("Tangent of " + radians + " = " + tan);
System.out.println("Arcsine of " + sine + " = " + asine);
System.out.println("Arccosine of " + cosine + " = " + acosine);
System.out.println("Arctangent of " + tan + " = " + atan);
}
}该程序的输出为:
Sine of 1.0 = 0.8414709848078965 Cosine of 1.0 = 0.5403023058681398 Tangent of 1.0 = 1.5574077246549023 Arcsine of 0.8414709848078965 = 1.0 Arccosine of 0.5403023058681398 = 1.0 Arctangent of 1.5574077246549023 = 1.0
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短