java sin.java

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
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值