2
執行三角
如何執行在Javascript以下數學題:在Javascript
Tan(x) = 450/120;
x = 75;
// In my calculator I use tan^-1(450/120) to find the answer
// How do I perform tan^-1 in javascript???
我的JavaScript代碼輸出不正確的結果:
var x = Math.atan(450/120);
alert(x); // says x = 1.3101939350475555
// Maybe I am meant to do any of the following...
var x = Math.atan(450/120) * (Math.PI/2); // still wrong answer
var x = Math.tan(450/120); // still wrong answer
您的計算器是以度模式運行嗎?真正的男人使用弧度。 – 2012-04-10 09:42:14
@ 32bitkid大聲笑爲什麼? – 2012-04-10 09:50:56
嚴肅地說,圍繞單位圓的一次完整的旋轉是一個距離爲2Pi的弧,這並非巧合地是以弧度表示的那個角度的測量值。瞭解這一點以及其他三角函數與單位圓的關係,將會使你的生活變得更加輕鬆。 – 2012-04-10 10:01:14