(未完)
package Cynical_Gary; public class Cynical_Text { public static void main(String[] args){ System.out.println("30°对应的弧度是:"+Math.toRadians(30)); System.out.println("π/6对应的角度是:"+Math.toDegrees(Math.PI/6)); System.out.println("45°对应的弧度是:"+Math.toRadians(45)); System.out.println("π/4对应的角度是:"+Math.toDegrees(Math.PI/4)); } } /* 输出: 30°对应的弧度是:0.5235987755982988 π/6对应的角度是:29.999999999999996 45°对应的弧度是:0.7853981633974483 π/4对应的角度是:45.0 */
角度和弧度的转换
Math.toRadians()方法用于将角度转换为弧度(静态方法)
public static double toRadians(double angdeg)
angdeg:用角度表示的角
返回值:角angdeg用弧度表示的值
Math.toDegrees()方法用于将弧度转换为角度(静态方法)
public static double toDegress(double angrad)
angrad:用弧度表示的角
返回值:角angrad用角度表示的值
package Cynical_Gary; public class Cynical_Text { public static void main(String[] args){ System.out.println("30°对应的正弦值是:"+Math.sin(Math.PI/6)); //计算30°的正弦值 System.out.println("30°对应的余弦值是:"+Math.cos(Math.PI/6)); //计算30°的余弦值 System.out.println("30°对应的正切值是:"+Math.tan(Math.PI/6)); //计算30°的正切值 } } /* 输出 30°对应的正弦值是:0.49999999999999994 30°对应的余弦值是:0.8660254037844387 30°对应的正切值是:0.5773502691896257 */
三角函数的转换
package Cynical_Gary; public class Cynical_Text { public static void main(String[] args){ System.out.println("0.5的反正弦值是:"+Math.asin(0.5)); //计算0.5的反正弦值 System.out.println("0.866的反余弦值是:"+Math.acos(0.866)); //计算0.866的反余弦值 System.out.println("0.5774对应的反正切值是:"+Math.atan(0.5774)); //计算0.5774的反正切值 } } /* 输出 0.5的反正弦值是:0.5235987755982989 0.866的反余弦值是:0.5236495809318289 0.5774对应的反正切值是:0.5236360729028994 */
反三角函数的转换
原文地址:https://www.cnblogs.com/1138720556Gary/p/9144046.html
时间: 2024-10-08 00:30:29