# Power Log Zero Returns as Zero?

2 Ansichten (letzte 30 Tage)
wesleynotwise am 11 Jun. 2017
Kommentiert: wesleynotwise am 11 Jun. 2017
Can someone solve this maths mystery in Matlab? why log(0) returns as -Inf, but 5^log(0) returns as zero?
log(0)
ans =
-Inf
5^log(0)
ans =
0
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

John D'Errico am 11 Jun. 2017
Bearbeitet: John D'Errico am 11 Jun. 2017
Um, basic math?
1. The log function is singular at zero. Log(x) approaches -inf, as x approaches zero. So this seems clear.
2. What is 5 raised to some large positive power? A big number.
3. What is 5 raised to some large negative number? It is the inverse of the answer to #2. So a TINY number.
4. What is the smallest number you can represent in double precision without an underflow to zero?
5^-462
ans =
9.8813e-324
5^-463
ans =
0
realmin
ans =
2.2251e-308
Realmin for a double is 2.2251e-308, but since you can have what are called denormalized numbers, you can go just a bit further before doubles just give up.
5. Is infinity larger than 463? Last time I checked, yes, it was.
##### 3 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Stephen23 am 11 Jun. 2017
"I always thought that anything associated with an infinity will result in infinity"
What about 1/N as N->inf? You really should complain to your high school that they did a bad job.
wesleynotwise am 11 Jun. 2017
Nah, I blame myself for not paying attention in the class. Bad student. if 1/N and N -> Inf, I would say it is close to zero, But if 1/ Inf, I would say it is infinity.

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Time Series Events finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by