# Matlab got this wrong: Limit as n goes to infinity: (1+(i/n))^(n^2). Matlab says it's exp(2), which is wrong. Pls confirm.

378 visualizzazioni (ultimi 30 giorni)
Moses il 22 Mag 2024 alle 1:03
Modificato: Torsten il 27 Mag 2024 alle 21:34
Matlab got this wrong: Limit as n goes to infinity: (1+(i/n))^(n^2). Matlab says it's exp(2), which is wrong.
##### 13 CommentiMostra 11 commenti meno recentiNascondi 11 commenti meno recenti
Moses il 22 Mag 2024 alle 4:00
@Sam Chak, the first one:
syms n
expr1 = (1 + (1i)/n)^(n^2)
VBBV il 22 Mag 2024 alle 9:10
@Moses if you are investigating the expr1 as given by @Sam Chak, then from the standard form of limit, defined for n, your expression should be
syms n
limit((1 + (1i)/n^2)^(n^2),n,inf)
ans =

Accedi per commentare.

### Risposta accettata

I recommend consulting technical support. It's probably a bug.
##### 2 CommentiMostra NessunoNascondi Nessuno
Moses il 22 Mag 2024 alle 12:44
Yes, it is. Thanks. How can I inform technical support?
Stephen23 il 22 Mag 2024 alle 12:51

Accedi per commentare.

### Più risposte (2)

David Goodmanson il 22 Mag 2024 alle 7:10
Modificato: David Goodmanson il 22 Mag 2024 alle 8:52
Hi Moses,
not every expression has a limit, or should. That's the case here, as anyone can check. For large n the function zips around (nearly) a circle, and it's interesting that the circle is not the unit circle but has, for large n, radius e^(1/2) = 1.6487 as a limit.
The plot below brings up a question: why do the lines connecting the points stay near the perimeter of the circle? It seems like the line connecting point n to point n+1 could cut across the circle, but it doesn't happen. This suggests a large-n limit for the angle between point n and point n+1 and that is correct, with a value of 1 radian.
The finite limit e^2 is an error as you said.
n = 1:100;
y = (1+i./n).^(n.^2);
plot(y) % complex plane
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Torsten il 22 Mag 2024 alle 13:04
WolframAlpha returns the expression without modifications. This could either indicate that the software was not able to compute it or (what would be the correct answer) that the limit does not exist.
David Goodmanson il 23 Mag 2024 alle 6:22
Hi Moses,
the function does move around a circle in the complex plane, but it is not the unit circle. See the direct numerical calculation in the answer above.
The absolute value of the function is
(abs(1+i/n))^(n^2)
= (sqrt(1+1/n^2))^(n^2)
= ((1+1/n^2)^(1/2))^(n^2)
= ((1+1/n^2)^(n/2))^(1^2) % since (x^a)^b = (x^b)^a = x^(ab)
and since
limit m-->inf (1+1/m)^m = e
the result, which is the radius of the circle, is e^(1/2) as stated in the answer.

Accedi per commentare.

James Tursa il 22 Mag 2024 alle 19:26
Modificato: James Tursa il 23 Mag 2024 alle 1:08
I have been looking at this for a couple of days now and have finally convinced myself that this limit doesn't exist and MATLAB is in error. Since you are raising a complex number to a potentially fractional power in this limit expression, and such operations are multi-valued for complex numbers, I would question whether the limit should exist at all simply on that basis. But suppose we restrict ourselves to integer n to avoid that discussion. Start with this expression:
(1 + i/n) ^ (n^2)
Extract the magnitude of the inner part so we are left with the form ( r * u ) ^ (n^2) where u is a unit complex number:
[ sqrt(1 + 1/n^2) * (1 + i/n) / sqrt(1 + 1/n^2) ) ] ^ (n^2)
Separate the magnitude out:
sqrt(1 + 1/n^2) ^ (n^2) * [ (1 + i/n) / sqrt(1 + 1/n^2) ) ] ^ (n^2)
Rewrite the magnitude part using 1/2 exponent instead of sqrt():
[ (1 + 1/n^2) ^ (1/2) ] ^(n^2)
Rearrange:
[ (1 + 1/n^2) ^ (n^2) ] ^(1/2)
The limit of the inside part is clearly e, so we have the magnitude converging to:
e^(1/2)
Now for the unit complex number part, we have a point on the complex unit circle raised to a positive integer power, so the result will clearly also be on the complex unit circle. The question is, does this converge to a particular point or not? To examine that, consider the triangle where it came from and just examine the angle of this triangle:
The angle x associated with our unit complex number is the same as the original triangle it came from, so we have:
tan(x) = (1/n) / 1 = 1/n
So
x = atan(1/n)
The taylor series for atan() is:
syms y
taylor(atan(y))
ans =
So for small angles we can just use y, or in our case 1/n.
Since our complex unit vector is raised to the power n^2, we can just multiply that by our small angle to get the expected resulting angle:
(1/n) * n^2 = n
Thus, as n -> infinity, the angle grows without bound.
In conclusion, although the magnitude of the original expression converges to e^(1/2), the angle does not converge, hence the overall limit does not converge. For large n, with a magnitude of e^(1/2) and an angle of n, the original expression (1 + 1i/n)^(n^2) will be pretty close to:
exp(1/2) * (cos(n) + 1i * sin(n)) = exp(1/2 + 1i * n)
##### 15 CommentiMostra 13 commenti meno recentiNascondi 13 commenti meno recenti
James Tursa il 27 Mag 2024 alle 19:09
Modificato: James Tursa il 27 Mag 2024 alle 19:23
@Torsten Yes I did find that link interesting! And I suspect you are correct as it probably wouldn't be too hard to massage the proof in that link to fit our case (e.g., pick n large enough so that magnitude being close to exp(1/2) is sufficiently < ϵ and then copy the rest of the proof from there). As a consequence, it is also interesting that even though the original set (sequence of points) is countable (since they map to the positive integers), the set of all subsets must be uncountable since a portion of them map to a real dense set of points.
Torsten il 27 Mag 2024 alle 21:33
Modificato: Torsten il 27 Mag 2024 alle 21:34
As a consequence, it is also interesting that even though the original set (sequence of points) is countable (since they map to the positive integers), the set of all subsets must be uncountable since a portion of them map to a real dense set of points.
Yes, like the rationals are dense in the reals. Each element of the uncountable set of reals can be approximated by the countable set of the rationals with arbitrary precision.

Accedi per commentare.

### Categorie

Scopri di più su Programming in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by