Perhaps this is why engineers want 0**0 = 1
foreach my $close_to_zero (1e-3,
1e-4,
1e-5,
1e-6,
1e-7,
1e-8,
1e-9,
1e-10,
1e-11,
1e-12,
1e-13,
){
print $close_to_zero**$close_to_zero,"\n";
}
produces
0.993116048420934
0.999079389984462
0.999884877372469
0.999986184584876
0.999998388191734
0.99999981579321
0.999999979276734
0.999999997697415
0.999999999746716
0.999999999972369
0.999999999997007
If you approach zero from the negative side,
it doesn't work. There are many other directions
you can approach from, using complex numbers.
From these directions the answer also seems
to head toward a limit of 1.
use Math::Complex;
my $j=sqrt(-1)/100;
foreach my $close_to_zero (-1e-3-$j*1e-3,
-1e-4-$j*1e-4,
-1e-5-$j*1e-5,
-1e-6-$j*1e-6,
-1e-7-$j*1e-7,
-1e-8-$j*1e-8,
-1e-9-$j*1e-9,
-1e-10-$j*1e-10,
-1e-11-$j*1e-11,
-1e-12-$j*1e-12,
-1e-13-$j*1e-13,
){
print $close_to_zero**$close_to_zero,"\n";
}
prints
1.00689492851834+0.00322274943578533i
1.00091826683245+0.000322665621543586i
1.00011482165982+3.24709453669811e-05i
1.00001378423429+3.2697926634863e-06i
1.00000160867421+3.29277874043755e-07i
1.00000018389316+3.31579990412048e-08i
1.0000000206919+3.33882521438423e-09i
1.00000000229945+3.36185100395793e-10i
1.00000000025297+3.38487684801375e-11i
1.0000000000276+3.40790269818147e-12i
1.00000000000299+3.43092854902761e-13i
So my engineering view is that 0**0==1
most of the time, for large values of zero.
It should work perfectly the first time! - toma
In reply to Re: 0**0
by toma
in thread 0**0
by Juerd
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.