[英]How can I use javascript to solve this equation?
P := 1/(1+10^((Y-X)/400))
M*(1-P) = Result
Please help how would I go about calculating that in java script, I am not sure I believe all the brackets confuse the program. 请帮助我如何在Java脚本中进行计算,我不确定我相信所有方括号都会混淆该程序。 I already have a script determining x and y via user input just unable to get the script to correctly calculate the above math.
我已经有了一个通过用户输入确定x和y的脚本,只是无法使该脚本正确地计算上述数学。
You have to use Math.pow
for exponentiation, ^
is a character reserved for bitwise XOR. 您必须使用
Math.pow
进行幂运算, ^
是保留用于按位XOR的字符。
var Y = 1;
var X = 2;
var M = 3;
var P = 1 / (1 + Math.pow(10, ((Y - X) / 400)));
var Result = M * (1 - P);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.