# 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.

85 views (last 30 days)
Moses on 22 May 2024
Edited: Torsten on 27 May 2024 at 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 CommentsShow 11 older commentsHide 11 older comments
Moses on 22 May 2024
@Sam Chak, the first one:
syms n
expr1 = (1 + (1i)/n)^(n^2)
VBBV on 22 May 2024
@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 =

Sign in to comment.

### Accepted Answer

I recommend consulting technical support. It's probably a bug.
##### 2 CommentsShow NoneHide None
Moses on 22 May 2024
Yes, it is. Thanks. How can I inform technical support?
Stephen23 on 22 May 2024

Sign in to comment.

### More Answers (2)

David Goodmanson on 22 May 2024
Edited: David Goodmanson on 22 May 2024
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 CommentsShow 1 older commentHide 1 older comment
Torsten on 22 May 2024
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 on 23 May 2024
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.

Sign in to comment.

James Tursa on 22 May 2024
Edited: James Tursa on 23 May 2024
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 CommentsShow 13 older commentsHide 13 older comments
James Tursa on 27 May 2024 at 19:09
Edited: James Tursa on 27 May 2024 at 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 on 27 May 2024 at 21:33
Edited: Torsten on 27 May 2024 at 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.

Sign in to comment.

### Categories

Find more on Programming in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!