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 官宣新年祝福语简短