0
$\begingroup$

$$\sum_{n=1}^{N} e^{2\pi in\sqrt2}$$

We have to use Accumulate and ListLinePlot, and my implementation so far with upper bound 50 (any upper bound is fine) is having trouble with the complex number. I tried to use Relm, but same thing happens.

Sums= Accumulate[e^(2*pi*I*#*sqrt[2]) & /@ Range[50]];
ListLinePlot[Sums, PlotRange -> All, Filling -> Axis]

enter image description here

$\endgroup$

2 Answers 2

1
$\begingroup$

Your code has many syntax errors, read the manual. And a hint, do not use names that start with a capital letter. Keywords in MMA start like this.

Here is the changed code:

sums = Accumulate[E^(2*Pi*I*#*Sqrt[2]) & /@ Range[50]] // N;
sums = ReIm /@ sums;
sums = ListLinePlot[sums, PlotRange -> All]

enter image description here

$\endgroup$
2
  • $\begingroup$ Tyvm. This is much clearer and helped ne understand. $\endgroup$ Nov 7, 2020 at 19:44
  • 1
    $\begingroup$ Here is another hint for free: Multiplication by Exp[ I phi] is a rotation in the complex plane by the angle phi (in radians). $\endgroup$ Nov 7, 2020 at 19:47
1
$\begingroup$

Since V12, there is ComplexListPlot:

ComplexListPlot[
 Accumulate[E^(2*Pi*I*Range[50]*Sqrt[2])],
 Joined -> True
 ]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.