Search code examples
rradixexponential

Find the Nth root in R


How do we find the Nth root in R?

4^2 = sqrt(16)

But what is the code snippet for the opposite transformation of;

4^7 = ???

Solution

  • Simple

    sqrt(4) == 4^(1/2)
    # 7th root of 4
    4^(1/7)
    

    In calculus, roots are treated as special cases of exponentiation, where the exponent is a fraction:

    https://en.wikipedia.org/wiki/Nth_root#Definition_and_notation