Is there a function for twelfth root of two?
I'm not a mathematician and for me it is difficult to understand the article on wikipedia. Maybe you can help me.
What I know so far which is not much:
4 to the power of 3 = 64, but how find base 4 and exp 3 when only 64 is given? Is that even possible and if so which function to use?
Now how I calculated the 12th root of 2 and which needs insane computation and I'm sure there's a better solution:
in Python
class Test():
def __init__(self):
self.factor = 0.0000001 #precision
self.twelfth_root_of_two = 1 #result 12th root of 2
self.max_two = 0 #root of 2
def test_(self):
""" 1 < x < 2 """
exit = True
while exit:
self.twelfth_root_of_two += self.factor
if self.max_two < 2:
self.max_two = self.twelfth_root_of_two ** 12
print("self.max_two ", self.max_two)
else:
exit = False
print("aprox. twelfth_root_of_two =", self.twelfth_root_of_two, " aprox. max_two = ", self.max_two)
if __name__ == "__main__":
t = Test()
t.test_()
Output:
aprox. twelfth_root_of_two = 1.0594632000347186 aprox. max_two = 2.000000128565274
I'm happy with the result but like I said before it need lot of computation time. Please when write an answer keep in mind that I'm a dummy in math.
I'm going to give a much simpler answer because I think the question you have isn't "what algorithm can I use to find a 12-th root?" but rather, "what function gives me 12-th roots?"
A 12-th root is a generalization of a square or cube root. We write the 12-th root of 2 as $\sqrt[12]2$ and this is the number whose 12-th power is 2. The important fact that you're missing is that
The reason for this boils down to how exponents work:
$$ x^a \times x^b = x^{a + b}.$$
For example $2^2 \times 2^5 = 2^7$.
And we can work this rule backwards as well:
$$ 2^{\frac12} \times 2^{\frac12} = 2^{\frac12 + \frac12} = 2^1 = 2. $$
So as you can see: $2^{\frac12}$ times itself is 2. But this is exactly the property that defines the square root of 2. So it must be that $2^{\frac12} = \sqrt2$.
Likewise: $$ \underbrace{2^{\frac1{12}} \times 2^{\frac1{12}} \times \dots \times 2^{\frac1{12}}}_{12} = 2^{\frac1{12} + \frac1{12} + \dots + \frac1{12}} = 2. $$
To implement this in a programing language, you either use the
math.powfunction or you use the expression2^(1/12). For example, in Python: