While bored in high-school (when I was half my current age...), I found that \$f(x) = x^{x^{-1}}\$ had some interesting properties, including e.g. that the maximum \$f\$ for \$0 ≤ x\$ is \$f(e)\$, and that the binding energy per nucleon of an isotope can be approximated as \$6 × f(x ÷ 21)\$...
Anyway, write the shortest function or program that calculates the xth root of x for any number in your language's domain.
Examples cases
For all languages
-1 > -1
¯0.2 > -3125
¯0.5 > 4
0.5 > 0.25
1 > 1
2 > 1.414
e > 1.444
3 > 1.442
100 > 1.047
10000 > 1.001
For languages that handle complex numbers
-2 > -0.7071i
i > 4.81
2i > 2.063-0.745i
1+2i > 1.820-0.1834i
2+2i > 1.575-0.1003i
For languages that handle infinities
-1/∞ > 0 (or ∞ or ̃∞)
0 > 0 (or 1 or ∞)
1/∞ > 0
∞ > 1
-∞ > 1
For languages that handle both infinities and complex numbers
-∞-2i > 1 (or ̃∞)
̃∞
denotes directed infinity.
x
. If you omit thex
limits in the query, Wolfram Alpha will include negative values ofx
where the function value depends on a choice of "branch" for the complex logarithm (or for a similar complex function). \$\endgroup\$