javascript - 将数学公式翻译成 JavaScript
问题描述
我正在尝试将这个数学公式转换为 JS:
我尝试tan^-1
用于第一部分,但出现错误。
解决方案
尝试以下
function phi_i (l, w, phi) {
// Check and set defaults for the parameters l, w and phi in case the are not set properly ...
var arg = 2 * l * Math.sin(phi) / ( 2 * l * Math.cos(phi) - w * Math.sin(phi) );
return Math.atan(arg);
}
推荐阅读
- svn - 如何使用 svn 命令检查特定版本是否位于 SVN 中某个目录的已提交版本范围之间?
- php - 从循环按钮获取值
- sql - 如何使用 PostgreSQL 中的变量创建具有内部连接的视图?
- javascript - 包括在空格后找不到字符
- java - Java使用ajax创建和下载文件不起作用
- node.js - 如何使用 npm 安装 node-win-shortcut
- node.js - node/express 中的“/register”和“register”路由是否相同?
- vb.net - 使用 async/await 从另一个任务更新 gui 时出现问题
- .net-core - 跳过 .NET Core 控制台应用程序的依赖项检查
- php - 对于将数据上传到服务器上的 PHP 脚本的私有内部公司应用程序,我应该有哪些潜在的安全问题?