i want to get x root of y. just as 3 root of 8 is 2 is there any function in php to get this result.
sqrt function is getting square root of the given value. but i want n root of given value. is there another way to find it.
You can use something like this
pow(8,1/3);
remember that rule ? :-)
x = be
becomes:
ln x = e ln b
ln x / e = ln b
ln b = ln x / e
b = eln x / e
hence:
$b = exp(log($x) / $e);
Note that this will only give you one real root, if any exist. You'll need to perform math in the complex domain if you want all e roots.
To get any root of a number your can use the pow()
function:
pow(8, 1/3)
which gives you the third root of eight.
For reference check
http://php.net/manual/en/function.pow.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With