cos60°30'的近似值
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/06 07:20:04
cos60°30'的近似值
cos60°30'的近似值
cos60°30'的近似值
public class YX {
public static void main(String[] args) {
// 60度30分 = 60.5分,因为1度=60分
double x = 60.5 * Math.PI / 180;
double sin = sin(x);
double cos = Math.sqrt(1 - sin * sin);
System.out.println("sin=" + sin);
System.out.println("cos=" + cos);
System.out.println(Math.sin(x));
System.out.println(Math.cos(x));
}
// 阶乘只除前20个
public static final long[] factories = { 1L,1L,2L,6L,24L,120L,
720L,5040L,40320L,362880L,3628800L,39916800L,479001600L,
6227020800L,87178291200L,1307674368000L,20922789888000L,
355687428096000L,6402373705728000L,121645100408832000L };
// 阶乘
public static long factory(int n) {
if (n == 1 || n == 0) {
return 1;
}
return n * (factory(n - 1));
}
// 这里的参数x为参数
// 利用泰勒展开 sinx = x-x^3/3!+x^5/5!-...(-1)k-1*x^(2k-1)/(2k-1)!+...(-∞