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 装修祝福语男生搞笑简短
18 生日开业蛋糕祝福语简短