JavaScript 的 Math.pow 的反面是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4016213/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-25 10:09:51  来源:igfitidea点击:

What's the opposite of JavaScript's Math.pow?

javascriptmathalgebrapolynomial-math

提问by Premasagar

I'm having a mental block here, and algebra not really being my thing, can you tell me how to re-write the JavaScript code below to derive the variable, c, in terms of aand b?:

我在这里有一个心理障碍,与代数不是真的是我的事,你能告诉我如何重新编写JavaScript代码如下导出变量c,在以下方面ab

a = Math.pow(b, c);
c = ?

Thanks!

谢谢!

回答by dusan

c = Math.log(a)/Math.log(b)

回答by Charlie Martin

Logarithms. You want the logarithm of a. B is the base, c is the exponent, so

对数。你想要 a 的对数。B是底数,c是指数,所以

logba = c

日志ba = c