gpt4 book ai didi

javascript - 在 Javascript 中执行三 Angular 函数

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:09:15 24 4
gpt4 key购买 nike

如何在 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

最佳答案

var x = Math.atan(450/120);

以弧度为单位给出 75 度的答案,即:1.3101939350475555

要获得正确答案,只需转换为度数:

var x = Math.atan(450/120) * (180/Math.PI);
alert(x); // says x is 75.06858282186245

关于javascript - 在 Javascript 中执行三 Angular 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10086196/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com