8

私はいつも1の累乗は1に等しいと思っていましたが、 Math.pow(1, Infinity)NaNを返します。なぜ1ではないのですか?

4

4 に答える 4

5

This is more of a math question than a Javascript question, and you therefore use mathematical explanations such as the following (http://mathforum.org/library/drmath/view/53372.html):

When you have something like "infinity," you have to realize that it's not a number. Usually what you mean is some kind of limiting process. So if you have "1^infinity" what you really have is some kind of limit: the base isn't really 1, but is getting closer and closer to 1 perhaps while the exponent is getting bigger and bigger, like maybe (x+1)^(1/x) as x->0+.

The question is, which is happening faster, the base getting close to 1 or the exponent getting big? To find out, let's call:

L = lim x->0 of (x+1)^(1/x)

Then:

ln L = lim x->0 of (1/x) ln (x+1) = lim x->0 of ln(x+1) / x

So what's that? As x->0 it's of 0/0 form, so take the derivative of the top and bottom. Then we get lim x->0 of 1/(x+1) / 1, which = 1. So ln L = 1, and L = e. Cool!

Is it really true? Try plugging in a big value of x. Or recognize this limit as a variation of the definition of e. Either way, it's true. The limit is of the 1^infinity form, but in this case it's e, not 1. Try repeating the work with (2/x) in the exponent, or with (1/x^2), or with 1/(sqrt(x)), and see how that changes the answer.

That's why we call it indeterminate - all those different versions of the limit approach 1^infinity, but the final answer could be any number, such as 1, or infinity, or undefined. You need to do more work to determine the answer, so 1^infinity by itself is not determined yet. In other words, 1 is just one of the answers of 1^infinity.

An answer of "indeterminate" is not a number.

于 2012-09-01T22:08:21.397 に答える
3
于 2012-09-01T21:59:04.253 に答える
1

The IEEE 754-2008 defines: 1^(+-)Inf = +1

The language you use does not comfort to the standard.

于 2013-02-24T15:12:09.090 に答える
1
于 2013-03-07T01:58:35.763 に答える