Author Topic: Raising a number to a non-integer power.  (Read 2584 times)

0 Members and 1 Guest are viewing this topic.

Offline magic

  • Super Contributor
  • ***
  • Posts: 2133
  • Country: pl
Re: Raising a number to a non-integer power.
« Reply #50 on: June 01, 2020, 07:39:01 am »
there is only one the fulfills the standard arithmetic rules of addition and subtraction in the exponent for both integers and non-integers (reals).
That's what I meant :)

And as it happens, this suffices to define arbitrary powers, not just ex. Then you can show the exp/log trick as a convenient way of calculating arbitrary powers to whatever precision that's provided by your log tables, but not as the definition.

Defining ab as exp(b·ln(a)) is just :scared:

edit
There is another advantage to avoiding the exp/log madness: a direct definition gives a straightforward, constructive method for calculating arbitrary real powers to arbitrary precision. Take some integer powers and roots, in case of an irrational exponent calculate a limit (algebraically or numerically), done. A trained monkey could do that.
With exp/log, you are entirely at the mercy of your log tables or calculator in terms of precision (and accuracy :P). You are not going to calculate exp yourself starting from your (f' = f, f(0)=1) definition and trying to use the ex definition you will quickly realize why I insist that it's circular :)
« Last Edit: June 01, 2020, 08:14:44 am by magic »
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 1716
  • Country: fi
    • My home page and email address
Re: Raising a number to a non-integer power.
« Reply #51 on: June 01, 2020, 10:01:46 am »
Take some integer powers and roots, in case of an irrational exponent calculate a limit (algebraically or numerically), done. A trained monkey could do that.
I don't like that approach for two reasons.  First is that it can give the impression that irrational exponents are somehow special; and we both know they're not.  Second is that Nth root itself (root extraction) is a very nontrivial operation. Essentially, to calculate A1/n, you start with some guess x0, and then iterate xk+1 = ((n-1)·xk + A/xkn-1, until you have a good enough approximation.  (To explain what that is, one needs to know what recurrence formulae are, and about Newton's method of finding roots of a function; it opens up a whole another can of math tools.)

Plus, when you do more than one approximation at different phases of your calculation, the error becomes very hard to estimate.  Then, when you deal with a coincidence like eπ-π, and you do two or three or more approximations when calculating it, you can be tempted to second-guess yourself and claim eπ-π=20.  It isn't, it's just a coincidence in decimal base; it's actually eπ-π ≃ 19.99909979.

And don't even think about saying it's close enough, or we'll have to talk about how 640k is enough for everyone.  ::)

You are not going to calculate exp yourself starting from your (f' = f, f(0)=1) definition
No, but I have used the series sum.  It is the logarithm part that needs the tables, because they're too onerous to calculate by hand.  On a computer, however, both base-2 exponent and logarithm are much simpler, when floating-point numbers are expressed as m·2b.  I've actually done that by hand, too, I think. (To convert a real into binary, just convert the integer part first, successively dividing by two and adding the remainder in increasing order of significance (right to left, starting at just left of the decimal point).  Then, for the fractional part, multiply it by two, and extract the integer part – it is always 0 or 1 – repeatedly, adding one binary digit (from left to right, starting at just right of the decimal point) per iteration.  Then, apply the binary logarithm algorithm.  In all, it isn't hard to do by hand, because both involve just halving or squaring a value, no other multiplications or divisions.)

An aside: It is funny how some things are easier in binary than in decimal.  For example, there is a known method for extracting an arbitrary hexadecimal digit of Pi, without knowing any of the preceding (more significant) digits; yet, no such method is (at least as of this writing) known for decimals.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 15243
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Raising a number to a non-integer power.
« Reply #52 on: June 01, 2020, 03:57:33 pm »
You are not going to calculate exp yourself starting from your (f' = f, f(0)=1) definition and trying to use the ex definition you will quickly realize why I insist that it's circular :)

Erm, can, and do?

The definition is directly the conditions needed to apply Taylor's theorem.  And as a theorem, it's simply an equivalent representation, it's nothing new.

(Indeed this is a better application of computing truncated series, than the mentioned powers-and-roots approximation to irrational powers.  Not in that it's wrong, just that this is a heck of a lot faster.)

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 2133
  • Country: pl
Re: Raising a number to a non-integer power.
« Reply #53 on: June 02, 2020, 10:21:28 pm »
Okay, you guys would, but a monkey wouldn't :P Sorry for the confusing post yesterday.

What I mean is that one definition essentially is an algorithm (fastest or not), the other is some differential equation which I am supposed to know how to solve before even thinking about calculating anything.

Even if you make the obvious fix and simply define exp as the usual power series, that's still a nasty monstrosity which bears little resemblance to anything most people would consider a "power". If I ask what's exp(½ln(4)), you will produce quite a wall of text to arrive at the correct solution or use a proof by authority that your mysterious series somehow agrees with my definition and then use the properties that I enumerated. So much for eating your dog food :)

Now to the interesting stuff :popcorn:

There is something special about the irrationals: they are the limits of rational sequences which appear to be convergent despite having no limit among the rationals ;) That's a somewhat informal statement of one of the many formal definitions in circulation; smart people some 150 years ago figured out that this is all we need to do anything that needs to be done with the irrationals. Others definitions aren't much better, before you ask.

Conveniently, it means that any continuous function on the rationals can be uniquely extended to all reals. Including addition and multiplication, as it happens. Yes, you can write a power series like Σ(πn/n!) and your maths teacher promised you that such a real number exists, but that's all - this number is some infinite abomination which can't be computed and compared to 20+π. As soon as you try that, either analytically or numerically, you are replacing your neat formula with a contraption like limx→π(Σ(xn/n!)). And if you try numerically, once more you have an iterative approximation nested inside another iterative approximation and two sources of numerical error to worry about.

Quote
octave:1> exp(3)-3
ans =  17.086
octave:2> exp(3.1)-3.1
ans =  19.098
octave:3> exp(3.14)-3.14
ans =  19.964
octave:4> exp(3.141)-3.141
ans =  19.986
octave:5> exp(3.1415)-3.1415
ans =  19.997
octave:6> exp(3.14159)-3.14159
ans =  19.999

That looks like it could very well be 20 ;)
 

Offline msuffidy

  • Contributor
  • Posts: 9
  • Country: ca
Re: Raising a number to a non-integer power.
« Reply #54 on: June 03, 2020, 04:52:03 am »
Pretty sure it is part of a logarithmic curve when you are between two exponents. There is some stuff on YouTube about weird ways to manipulate usual things like 0 to the 0 power something to the negative power, something to an non integer power etc. Most of them are either logical or undefined.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 1716
  • Country: fi
    • My home page and email address
Re: Raising a number to a non-integer power.
« Reply #55 on: June 03, 2020, 07:42:51 am »
I understand your point, magic, but I disagree; not because I have a different opinion, but because I think your approach leads to problems when trying to understand  more complex mathematical "stuff".

If it was just a matter of opinion or different experiences, different opinions would be just useful, because people do think and learn in different ways.

First, a couple of points:
What I mean is that one definition essentially is an algorithm (fastest or not), the other is some differential equation which I am supposed to know how to solve before even thinking about calculating anything.
Using a ratio to approximate a real number, then calculating the power as the denominator'th root of the nominator'th power of the value, is itself an algorithm.  Calculating an N'th root of a value is nontrivial; quite a lot of work, really.

Even if you make the obvious fix and simply define exp as the usual power series
No, I did not, and would not.  The intuitive or real-world definition of the exponential function is "the curve which has value 1 at x=0, and slope x at x".  The power series is just one way to apply it or evaluate it: to calculate a specific point on that curve.

Now, back to the core disagreement.

OP asked how to intuitively grasp ab, when b is not an integer.  They intuitively grasp the case where b is an integer, as multiplying a by itself b times.

If I understood you correctly, your point is to just approximate b with a ratio, c/d, so that abac/d, in which case ab is approximately equal to the d'th root of ac.

I disagree with that, because it gives an incorrect intuition about the continuity and other properties of exponentials and real powers; intuitions, that will cause difficulty in understanding more in-depth mathematical concepts.

(My objection is similar to the one when teachers tell kids that electrons orbit nuclei like planets orbit the sun.  They do not.  Electrons do have properties like angular momentum and orbital radius that make the orbit model one that gives a good intuitive grasp of the properties of such electrons, but the fact is, they're delocalized in a region around the nuclei in manner better examined using quantum mechanics, and are definitely not just whizzing around like a rock around a gravity well.  It is an analog that works in one specific situation – when considering electron angular momentum and orbital properties – but is a hindrance when trying to understand anything else about atoms and molecules.  Physicists like me don't get weirded about this, because we learn to use different analogs depending on the situation, and understand that those are just tools to help us think, and not a representation of reality.)

My own suggestion is basically this:

The "best" one (that makes any further math easier to integrate to ones understanding and mathematical toolbox), is to just consider non-integer powers as an "extension" of the integer ones, with exactly the same rules and behaviour.  That is, to understand, that not every mathematical tool has an intuitive real-world analog; that requiring such intuition can hinder ones use of math.  In math, it is perfectly okay to multiply a by itself 2.1276352 times, because fractional "numbers of times" are just an extension of integer number of times, and have the exact same properties.  The fact that 2.1276352 is not countable – that is, you cannot have 2.1276352 items, because it is not a natural integer – is just completely irrelevant in this context.

The answer to exactly how to multiply something by itself a non-integer number of times, is via a mathematical identity: ab = eb loge a, where ex ≝ exp(x) is a curve that has slope x at x=x, and exp(0) = 1; and where loge x is a curve that has slope 1/x at x=x, and loge 1 = 0.  We have several different tools for calculating any point on those curves.

In fact, when you tell a current computer to calculate ab for you (in C, pow(a, b); in Python, a**b; and so on), it actually uses base-two exponent and logarithm: ab = 2b log2 a.  Mathematically, 2x = eC x and log2 y = C loge y, where C is a constant, C = 1 / loge 2.  It turns out there are very fast and efficient techniques, or algorithms, to calculate base-2 exponentials and logarithms, when numbers are expressed in binary floating-point format, m·2b.  The IEEE-754 standard defines two, Binary32 and Binary64, that use exactly this form, and these are used by almost all current computer architectures (as "float" and "double" real types, typically).  Intel x86 and AMD64 processor architectures include machine instructions that do these operations in hardware, and have had these for decades.

See?  I understand why one would see the root-of-power approach better, even more powerful, but I don't like it because of how it can affect ones further understanding of math.  I like to separate the what and the how, with an approach for understanding the what that isn't likely to bite oneself in the ass later on.

Of course, if one can take both models, and simply switch between them, they're way ahead of either of us already (since we're still here discussing which one to use), and can use such analogs themselves as tools, switching them as they need – if they need such analogs at all.  But I suspect that those people are good at math anyway, and don't need our help!
« Last Edit: June 03, 2020, 07:51:59 am by Nominal Animal »
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 2133
  • Country: pl
Re: Raising a number to a non-integer power.
« Reply #56 on: June 03, 2020, 01:45:17 pm »
The "best" one (that makes any further math easier to integrate to ones understanding and mathematical toolbox), is to just consider non-integer powers as an "extension" of the integer ones, with exactly the same rules and behaviour.
I agree, plus the particular rules and behaviors you want to generalize ought to be listed so that there is no doubt and confusion.

Moreover, in any remotely serious mathematics, it is also considered a good idea to convince yourself and the reader that such a function is even possible in the first place, and there is no better way than defining it and verifying that it meets all the requirements.

The answer to exactly how to multiply something by itself a non-integer number of times, is via a mathematical identity: ab = eb loge a, where ex ≝ exp(x) is a curve that has slope x at x=x, and exp(0) = 1; and where loge x is a curve that has slope 1/x at x=x, and loge 1 = 0.  We have several different tools for calculating any point on those curves.
Yes, you can, but there is a problem: you typically cannot calculate ex exactly unless x comes in the form x=ln(y). This complicates some simplest examples possible, like 4½. At some point it's convenient to just admit that fractional powers are simply roots.

So yes, you have defined the function and provided the "how", but it's not even clear if it meets your own "what" criteria without bringing in some calculus heavy artillery, which no beginner would understand if you actually tried to explain. That's the Arduino approach to mathematics, I guess I'm just not a fan of Arduino :P

You've got me on one point: I utterly glossed over the problem of continuity / monotonicity / etc. Why would my function be continuous on the rationals? Is it even true that a½<a<a¾? I believe those problems are solvable by elementary means (like converting the fractions to a common denominator, and others), which means that if you want a truly honest definition, with no cheating, handwaving and appeals to authority, this looks like a promising direction.

And yes, it will take limits to get to the irrationals. But limits are either explicit or implicit in pretty much everything dealing with the irrationals. The irrationals are pure cancer IMO and one shouldn't feel bad about treating them like they are some kind of cancer. Most of the time you too don't deal with the irrationals, you just compute e3.1415926536 instead and call it a day.

And no, I certainly didn't say to approximate an irrational with a fraction and leave it at that. That's not what limits are :P
« Last Edit: June 03, 2020, 01:54:29 pm by magic »
 

Online GlennSprigg

  • Frequent Contributor
  • **
  • Posts: 839
  • Country: au
  • Medically retired Tech. Old School / re-learning !
Re: Raising a number to a non-integer power.
« Reply #57 on: June 03, 2020, 02:18:48 pm »
To me, simple INTEGERS are enough to bamboozle most!  ;D
10^24     Approx number of atoms in an average adult human being.
10^50     Approx number of atoms in our Earth.
10^80     Approx number of atomic particles in the 'known' Universe!
10^124   Approx number of Protons, if the 'known' Universe was a SOLID!!
10^100   Was named a 'Googol' just for fun, by a scientists son.
A 'GoogolPlex' was then decided to be 10^Googol...  That's just beyond stupid!  :-DD
 

Offline Circlotron

  • Super Contributor
  • ***
  • Posts: 1850
  • Country: au
Re: Raising a number to a non-integer power.
« Reply #58 on: June 03, 2020, 10:48:49 pm »
Googolplex in popular culture:
Quote
"Clara was one in a million... One in a billion... One in a googolplex... The woman of my dreams, and I've lost her for all time."
—Doc Brown
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 15243
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Raising a number to a non-integer power.
« Reply #59 on: June 03, 2020, 11:51:51 pm »
This looks like a good point to add my "'real numbers' are the least real number system" rant...  :blah: :-DD

To know a truly real number, is to know the infinite madness that is darkness itself... to know the wisdom of The Old Ones...

Rational numbers, within reason, we can conceive of -- as long as we can put a number to it, or an approximate range, that's fine.  The algebraic numbers are a little more tricky, with more operations involved in their creation -- but still only finitely many operations, be it exponentiation (aha, see it's still on topic!) or what.

The computables are even more difficult, with such monsters as Graham's number cropping up even from relatively simple criteria.  Obviously the large numbers are quite sparse in the computables, but vastly more sparse is any other random real number -- to be able to compute a number, we must have some code, algorithm, proof, or even just proposition, which implies the existence of the number in question -- no such criterion is needed for a general real number.

The few real numbers we know, are all constructed based on their relationships.  Pi is very useful because it has many equivalent relationships, from geometry to complex analysis and beyond.  It is well known, of course never exactly as we cannot enumerate all the decimals of a transcendental real number -- but its strength is only rarely in its numerical value, and more fundamentally among the many facets of mathematics it connects.

Similarly for e, gamma, etc.

One of the few truly real, non-computable numbers that we can even begin to grasp, is: https://en.wikipedia.org/wiki/Chaitin%27s_constant  Which, because we know [upper bounds] on the first few BB(n) numbers, we have an approximate value for already -- but it's patently clear that we can't know, really much more than that, like, even a decimal more, but perhaps proofs will be developed that give just a few and then it's provable that further development (even given universe-sized recursive proofs) is realistically impossible.

Now consider that, for as many numbers as a googolplex, there are far more numbers than that, just among the rationals between 0 and 1; but compared to the number of uncomputable reals in the same range, even that infinity has measure zero, and not just laughably so, but trivially so!

P.S. My spell check wants to correct "uncomputable" to "uncomfortable".  That is understandable.  :scared:

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: hamster_nz

Offline hamster_nz

  • Super Contributor
  • ***
  • Posts: 2284
  • Country: nz
Re: Raising a number to a non-integer power.
« Reply #60 on: June 04, 2020, 09:19:58 am »
One of the few truly real, non-computable numbers that we can even begin to grasp, is: https://en.wikipedia.org/wiki/Chaitin%27s_constant

Thanks for that Wikipedia wormhole  :)... I've never heard of it till now.
Gaze not into the abyss, lest you become recognized as an abyss domain expert, and they expect you keep gazing into the damn thing.
 

Offline magic

  • Super Contributor
  • ***
  • Posts: 2133
  • Country: pl
Re: Raising a number to a non-integer power.
« Reply #61 on: June 04, 2020, 10:06:37 pm »
Now consider that, for as many numbers as a googolplex, there are far more numbers than that, just among the rationals between 0 and 1; but compared to the number of uncomputable reals in the same range, even that infinity has measure zero, and not just laughably so, but trivially so!
Screw computability; most irrationals can't even be individually described and identified by any finite text or formula in any language in existence. Some people got quite upset when one Cantor raised this issue some 150 years ago ;D

You can have sets of real numbers which can't be assigned any length/area/volume because every possible value from zero to infinity leads to one or another paradox. And many mathematicians will tell you with a straight face that from a few such unmeasurable sets in a 3D space it is possible to assemble various measurable sets of different volumes just by moving and rotating them around. Some others feel a bit uneasy about that idea, though.
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 3598
  • Country: us
Re: Raising a number to a non-integer power.
« Reply #62 on: June 04, 2020, 11:42:58 pm »
There is so much esoterica in advanced mathematics.  I find it challenging enough to understand and use the crumbs that very bright people pull out of that heap and show the real world applications to us mere mortals.  Distributions, contour integrals and a whole list of other tools.  But those people are made to pay for their sins.  In grad school I took several advanced mathematics courses in aid of understanding the limits and applications of those crumbs.  The courses were owned and taught be the mathematics department.  But 80-90% populated by engineers and physicists.  Which irked the mathematicians no end.  And caused immense disdain for their colleagues who continued finding and disseminating those crumbs.
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 15243
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Raising a number to a non-integer power.
« Reply #63 on: June 05, 2020, 02:18:49 am »


Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 
The following users thanked this post: magic

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 3598
  • Country: us
Re: Raising a number to a non-integer power.
« Reply #64 on: June 05, 2020, 03:49:53 am »
Very good opening.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf