C#中的三角函数
C#中的三角函数包括ACos,ASin,Sin,Cos,Tan等。它属于System命名空间的Math类型。
以下是显示如何在C#中实现三角函数的示例-
示例
using System;
class Program {
static void Main() {
Console.WriteLine(Math.Acos(0));
Console.WriteLine(Math.Cos(2));
Console.WriteLine(Math.Asin(0.2));
Console.WriteLine(Math.Sin(2));
Console.WriteLine(Math.Atan(-5));
Console.WriteLine(Math.Tan(1));
}
}输出结果
1.5707963267949 -0.416146836547142 0.201357920790331 0.909297426825682 -1.37340076694502 1.5574077246549
上面我们看到了使用Asin的反正弦值-
Math.Asin(0.2)
这样,我们还可以看到使用Acos的反余弦值-
Math.Acos(0)
以同样的方式,我们找出了Tan(1),Atab(-5),Sin(2)和Cos(2)的值。
热门推荐
10 儿子立冬祝福语简短独特
11 对当兵的祝福语简短
12 侄儿高考试祝福语简短
13 伴郎红包祝福语朋友简短
14 媳妇生日简短祝福语朋友
15 公司年会祝福语简短最好
16 元旦感恩祝福语简短大全
17 红包祝福语简短10字
18 周六早晨祝福语简短