matician - v2.0.0
    Preparing search index...

    Function root

    • Calculates the nth root of a number.

      By default, it computes the square root (i.e., degree = 2).

      Parameters

      • value: number

        The number to take the root of.

      • degree: number = 2

        The degree of the root (e.g., 2 for square root, 3 for cube root).

      Returns number

      The nth root of value.

      Will throw an error if degree is 0.

      root(9);        // returns 3 (square root)
      root(27, 3); // returns 3 (cube root)
      root(16, 4); // returns 2 (fourth root)