| General > General Technical Chat |
| Raising a number to a non-integer power. |
| << < (7/13) > >> |
| Nominal Animal:
--- Quote from: RoGeorge on May 29, 2020, 05:37:32 am ---Op asks what is the intuitive representation of raising a number to a fractional power, gets answers about best numerical algorithms. ::) --- End quote --- Hey! It was a clarification to a comment why expressing a fractional power ab using base-two exponent and base-two logarithm, 2b log2 a is a practical way to look at it, because that's how computers deal with it. Let's recap: One way to look at non-integer powers is to look at fractional powers: ab/c = ab · a1/c The second term is the same as c'th root of a, by definition. So, for example 23.5 = 23·20.5 = 23·√2 = 8√2. This approach has the problem that it only works for rational numbers – those that you can express as the ratio of two integers –, you cannot calculate e.g. 2π with it. Besides, it's slow and burdensome. To solve this problem, John Napier introduced logarithms in 1614. The basic equivalence with exponentiation is ex = y ⇔ x = loge y It's main purpose is to make multiplication and division easier. Logarithm turns multiplication into addition, division into subtraction, using just standard multiplication rules (for powers), with exponentiation as its inverse: A · B = eloge A · eloge B = e(loge A) + (loge B) A / B = A · B-1 = eloge A · e- loge B = e(loge A) - (loge B) Technically, logarithms are defined only for nonnegative reals, but we can treat the signs of A and B separately anyway in multiplication and division trivially: if we have an odd number of negative values, the result is also negative; otherwise it is positive. Easy peasy. Mathematically, this equivalence gives us a simple way to express any power via exponentiation and logarithms as ab = eb logea Because e is an irrational number itself (it has infinite number of digits in any integer base, be it decimal or binary or other), it is something that computers cannot handle directly, and can bother us humans quite a bit, too. So, instead, the base 2 one is used in computers (and some humans, too): ab = 2b log2a There is lots of information about the base-2 logarithm, or binary logarithm, for example at Wikipedia. But wait, didn't we just come around a full circle, and just answer the question with "by raising 2 to a fractional power you calculate thus"? No, because raising 2 to a fractional power is a special function we can call base-2 exponential. You are probably already aware of the exponential function, exp(x) = ex. The base-2 exponential is very similar, except there are algorithms how a computer (or a human counting in binary) can approximate it directly, to whatever precision you like. So, while it looks like the same problem, technically the procedure is ab = exp2(b log2 a) How one should grasp it intuitively, then? Think of integers in the number line. They're distinct, with a gap in between. We use real numbers to describe values that do not match any specific integer, but fall in between two integers. Positive integers can count things, so they're very intuitive, even many animals can do it. Reals are more difficult. Rational numbers are ratios of two integers, but they aren't all reals; we also have irrationals like π that cannot be expressed exactly as a ratio of two integers. So, it is better to think of real numbers as being in between integers, without a perfect real-world analog. In the exact same way as real numbers extend integer points to a continuous line, non-integer powers extend integer powers to a continuous curve. Non-integer powers behave exactly like integer powers, mathematically. So, the best way to intuitively grasp it, is an extension to the integer powers, really. So yeah, we really don't have a good analog for non-integer powers. One tripping point is that if we want to calculate the numerical value without having a tool that can do it directly for us, we'll need exponentiation and logarithms to do so. You might think that is because they are somehow special, but it is quite the opposite: exponentiation and logarithms are just the tool we use for the extension, and themselves have a very clear, intuitive definition. Is this any better, RoGeorge? I bet it is five times more than most members here care to read, so that's why I tried to only drop in the minimal nugget. Would've been much better as a video, too. |
| RoGeorge:
--- Quote from: Nominal Animal on May 29, 2020, 06:42:43 pm ---In the exact same way as real numbers extend integer points to a continuous line, non-integer powers extend integer powers to a continuous curve. --- End quote --- Perfect, hard to explain in less words! :-+ The next chart first represents 41, 42, 43, 44, 45 as red dots. Looks like the red dots nicely align like the beads on an invisible string. That invisible string is our function 4x, drawn as a green dotted curve. If we stick a blue dot on that green curve, and move it left and right, that would show values for fractional power, and if we drag it to x = 3.9, the blue dot will show us the value for 43.9. It will be almost like 4 multiplied 4 times, but a little less than 4x4x4x4. For a live, interactive chart https://www.desmos.com/calculator/s9zbhc9mcy |
| Nominal Animal:
Exactly. Visual examination also gives a good starting point for intuition on the behaviour of the exponential function and the logarithm. The curve y = exp(x) has slope x at x=x, and the natural logarithm curve, y = log(x), has slope 1/x at x=x. This kind of extension is needed for us humans, because our intuition is not sufficient to handle all the things we can understand. We need logic, and mathematical tools we don't have intuitive real-world analogs for, only definitions. As an example, consider functions. There is something called a Lambert W function, which cannot be expressed in terms of elementary functions at all; we cannot express it exactly in form W(z) = ... . We can approximate it numerically, though, to any desired precision you want. Anyway, the Lambert W function is defined as the function that satisfies W(z) exp(W(z)) = z. This means that for example, if you wanted to solve exp(-z) = z, the answer is z = W(1) ≃ 0.56714329. Or, if you wanted to solve exp(-z)=z / 2, the answer is z = W(2) ≃ 0.8526102. Except that W(1) and W(2) are the exact answers, and when looking for a behaviour of something ("What kind of function fulfills these rules?"), the answer just might be W(z). Before you think that that the Lambert W function is just a mathematical curiosity, I'll just point out that it is the function that provides the exact solution for the double-well Dirac delta function model for equal charges: for example, the hydrogen molecule. It's not a curiosity or "pure math", it is an useful tool for describing stuff in nature. It's just hard to pin down in "human terms". At some point, you just have to accept that some of the mathematical tools you use don't have good real-world analogs or plain explanations, and that knowing their operating context and rules is enough – unless you're a mathematician. I ain't. |
| RoGeorge:
I'm not familiar with the Lambert W function, but calling that a function feels like cheating. By definition, a function can not have more than one output for a single input. Maybe in math we can change or extend the definition for what a function is, but then it will be out of this world. In the physical world, when for a single input we observe multiple results, it means we are missing something, like an extra input variable we disregarded, or an extra function/phenomenon we don't realize it's there. |
| T3sl4co1l:
It's a function if you specify a main branch, right. That can sometimes be hand-wavy when it shouldn't be. Just as ln(z) is not a function, it has infinite solutions ln(z) = ln(z) + 2n pi i; by convention we take the main branch (-pi < Im(ln(z)) <= pi), Ln(z). Tim |
| Navigation |
| Message Index |
| Next page |
| Previous page |