Cube root

=Introduction=

A cube is a regular solid in three dimensions with depth, width and height all equal.

In the diagram the figure defined by solid black lines is a cube. Width = depth = height = 2.

The length of one side is 2 units.

The surface area of one side $$=\ height * depth$$ or $$height * width$$ or $$width * depth = 2 * 2$$ or $$2^2$$ square units. There are 4 square units in each side.

The volume of the cube $$=\ width * depth * height\ =\ 2 * 2 * 2 = 2^3 = 8$$ cubic units.

In this case you can see that 8 cubes of 1 unit each, when properly stacked together, form a cube with length of each side equal to 2 units and volume equal to 8 cubic units.

In mathematical terms $$V = s^3 = 2^3 = 8.$$

We can say that $$V = s$$ raised to the power of 3. Usually we say that $$V = s$$ cubed.

The calculation of cube root is the process reversed. Given $$V$$ or volume, what is the length of each side?

$$s = V^{\frac{1}{3}}$$ read as $$s = V$$ raised to the power $$\frac{1}{3}.$$ Usually we say that $$s = \sqrt[3]{V}$$ or $$s =$$ cube root of $$V.$$

In this case $$s = \sqrt[3]{8} = 2.$$

When $$s = \sqrt[3]{V}$$ then $$s^3 = (\sqrt[3]{V})^3 = (V^{1/3})^3 = V^{\frac{3}{3}}  = V^1 =      V.$$

If $$s$$ is negative, then $$(-s)^3 = (-s)*(-s)*(-s) = -(s * s * s) = -V$$ and $$\sqrt[3]{-V} = -s.$$ $$$$

In theoretical math the cube root of any real number has 3 values, 1 real and 2 complex.

On this page, we'll refer to the one real value noting that the cube root of a negative real number is also a negative real number.

=Calculation=

Preparation
It is desired to calculate the cube root of real number $$N.$$

To simplify the process, and to make the implementation of the process predictable, reformat $$N:$$

$$N = n(10^{3p})$$ where:


 * $$1 <= n < 1000$$


 * $$p$$ is integer.

Then: $$\sqrt[3]{N} = \sqrt[3]{n(10^{3p})} = \sqrt[3]{n}(10^p).$$

To simplify the process further, we calculate cube root of  and restore negative sign to result, if necessary.

Implementation
$$x = \sqrt[3]{n}$$

$$x^3 = n$$

$$x^3 - n = 0$$

To calculate $$\sqrt[3]{n}$$ calculate the real root of:

$$y = f(x) = x^3 - n.$$

$$f(x)$$ is well defined in the region $$1 \le n < 1000.$$

Newton's method is used to derive the root starting with $$x = 5.$$

=Examples=

N with 102 decimal digits

 * Result is achieved with 10 passes through loop.


 * In python this method is more than 3 times faster than raising a number to the power $$\frac{1}{3}.$$ As size of $$N$$ increases, speed advantage increases.


 * This method produced the cube root exactly.

=Links to related topics=

Cubic formula

Square Roots using Newton’s Method

Shifting nth root algorithm

Powers, roots, and exponents

Roots

Exercises