-2
我需要計算給定值的餘弦定律,如上所示。我測試了每個值,看看是否爲方程的部分進行了正確的計算。 我需要找到給定角度「a」和方程中的餘弦,但不計算該值。我該如何解決這個問題。餘弦的錯誤定律java
double b = 13; //side
double c = 15; // other side
double a =15; // angle
double cosines = Math.pow(b, 2) + Math.pow(c, 2) + 2*(b)*(c) *Math.cos(Math.toRadians(a));
double test = 2*(b)*(c);
double cosiness = Math.sqrt(cosines);
System.out.println(cosiness);
System.out.println(test);
double test2 = Math.cos(Math.toRadians(a));
System.out.println(a);
double test3 = Math.pow(b, 2);
System.out.println(test3);
System.out.println(Math.pow(c, 2));
此輸出:
27.761683526989795
390.0
15.0
169.0
225.0
如何糾正呢?
您將需要解釋_「的值,不計算」 _ –
請出示您所期望的答案是什麼,並找出你認爲這是怎麼了。 – Jason
a的值是角度15度。我希望程序將其轉換爲弧度,然後取該值的餘弦值。這個程序不會改變「a」的值。我想要改變這個價值。我想輸出爲17。 – ecke