just do it!!!!!!
回望来时的路,保持一颗年少的心,别忘记眼放光芒的年少的自己,加油!
package math;
/**
* 总以为来日方长
*
* 我们不慌不忙总以为来日方长
* 我们憧憬瞻望却难敌世事无常
*
* 时间不等人啊,马上行动起来
*
* @author ZengWenfeng
*/
public class Sin
{
public static void test2()
{
System.out.println(Math.sin(Math.toRadians(42)));
System.out.println(Math.sin(Math.toRadians(48)));
System.out.println(Math.sin(45));
System.out.println(Math.sin((45f / 180f) * Math.PI));
}
public static void main(String[] args)
{
test();
}
/**
*
*
* √[(x2-x1)²+(y2-y1)²]
*
* 余弦定理
* cosa=(b^2+c^2-a^2)/2bc
* cosb=(a^2+c^2-b^2)/2ac
* cosc=(a^2+b^2-c^2)/2ab
*
*/
public static void test()
{
int a = 50;
int b = 10;
System.out.println(Math.tan(Math.toRadians(a)));
double tan42 = Math.tan(Math.toRadians(a));
System.out.println("============================");
double pd = 1.0;
System.out.println("pd : " + pd);
double bd = pd / tan42;
System.out.println("bd : " + bd);
double x1 = bd;
double y1 = pd;
System.out.println("p : (" + x1 + ", " + y1 + ")");
System.out.println("============================");
double tan12 = Math.tan(Math.toRadians(b));
double dc = pd / tan12;
System.out.println("dc : " + dc);
double bc = bd + dc;
System.out.println("ab = bc = ca = " + bc);
// double sin30 = Math.sin(Math.toRadians(30));
double sin60 = Math.sin(Math.toRadians(60));
double ae = bc * sin60;
System.out.println("ae = " + ae);
double x2 = bc / 2;
double y2 = ae;
System.out.println("a : (" + x2 + ", " + y2 + ")");
System.out.println("============================");
double tem01 = (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
double ap = Math.sqrt(tem01);
System.out.println("ap = " + ap);
System.out.println("============================");
double sin12 = Math.sin(Math.toRadians(b));
double pc = pd / sin12;
System.out.println("pc : " + pc);
System.out.println("============================");
double ca = bc;
System.out.println("ca : " + ca);
double cosPac = (ap * ap + ca * ca - pc * pc) / (2 * ap * ca);
System.out.println("cosPac : " + cosPac);
System.out.println(Math.cos(Math.toRadians(54)));
System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>" + Math.toDegrees(Math.acos(cosPac)));
System.out.println("====ZengWenfeng========================");
System.out.println(Math.sin(Math.toRadians(0)));
System.out.println(Math.sin(Math.toRadians(30)));
System.out.println(Math.sin(Math.toRadians(45)));
System.out.println(Math.sin(Math.toRadians(60)));
System.out.println(Math.sin(Math.toRadians(90)));
System.out.println("============================");
System.out.println(Math.cos(Math.toRadians(30)));
System.out.println(Math.cos(Math.toRadians(45)));
System.out.println(Math.cos(Math.toRadians(60)));
System.out.println(Math.cos(Math.toRadians(90)));
System.out.println("============================");
System.out.println(Math.toRadians(90));//弧度
System.out.println(Math.PI / 2);//弧度
System.out.println(Math.toRadians(54));
System.out.println(Math.toDegrees(Math.PI));//弧度
System.out.println(Math.toDegrees(Math.acos(0.5)));
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)