General > General Technical Chat

Raising a number to a non-integer power.

<< < (11/13) > >>

magic:

--- Quote from: Nominal Animal on June 01, 2020, 04:57:46 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).
--- End quote ---
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 :)

Nominal Animal:

--- Quote from: magic on June 01, 2020, 07:39:01 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.

--- End quote ---
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.  ::)


--- Quote from: magic on June 01, 2020, 07:39:01 am ---You are not going to calculate exp yourself starting from your (f' = f, f(0)=1) definition
--- End quote ---
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.

T3sl4co1l:

--- Quote from: magic on June 01, 2020, 07:39:01 am ---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 :)

--- End quote ---

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

magic:
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
--- End quote ---

That looks like it could very well be 20 ;)

msuffidy:
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.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod