Closed MAGNETO903 closed 4 years ago
Are you looking for the real root or the principal root? They are different when complex numbers are in the picture.
I did not undertstand the difference between the real root and the principal root, but I am looking for a function like nthRoot()
in mathjs library
nthRoot() function
I know that an nthroot
function was started at some point but was never completed. I'll look into completing it. Adding a cbrt
function might not be a bad idea as well.
Done.
Add function (maybe
root(a, b)
) that return numberc
thatc^a=b
root(3, 8) // return 2
root(4, 16) // return 4
root(8, 3) // return 1.1472...
And also add
cbrt(a)
that return numberb
thatb^3=a
(cubic root)cbrt(8) // return 2
cbrt(27) // return 3
cbrt(2) // return 1.2599...