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 2026新年祝福语简短语
16 女儿婚礼女婿祝福语简短
17 桔梗配什么祝福语简短
18 朋友搬迁新房祝福语简短