Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想得到 y 的 x 根。就像 8 的 3 根是 2 一样,php 中有什么函数可以得到这个结果。
sqrt函数正在获取给定值的平方根。但我想要给定值的 n 根。有没有其他方法可以找到它。
你可以使用这样的东西
战俘(8,1/3);
还记得那条规则吗?:-)
x = b e
变成:
ln x = e ln b ln x / e = ln b ln b = ln x / e b = e ln x / e
因此:
$b = exp(log($x) / $e);
请注意,这只会给你一个真正的根,如果有的话。如果您想要所有e 根,则需要在复数域中执行数学运算。
要获取数字的任何根,您可以使用以下pow()函数:
pow()
pow(8, 1/3)
这给了你八的第三个根。
供参考检查
http://php.net/manual/en/function.pow.php