วาดกราฟ exponential sums

พอดีว่าไปเห็นกราฟที่วาดจาก Exponential sums จากเวบ https://www.maths.unsw.edu.au/about/exponential-sums แล้วดูว่าสวยดีเลยอยากลองทำดูบ้างด้วย Mathematica

การวาดกราฟจาก exponential sums หรือที่เขียนอยู่ในรูปแบบ \sum_{n=1}^N e^{2\pi if(n)} ที่ทำนี้ก็คือถ้าเราค่อยๆบวกเข้าไปทีละเทอมและเอาค่าที่ได้มาพล็อตกราฟใน complex plane โดยที่แกนนอนคือจำนวนจริงและแกนตั้งคือจำนวนจินตภาพ ลองดูที่โค้ดน่าจะเข้าใจมากขึ้นครับ

fn[n_] := Log[n]^4
NP = 5000;
ls = Accumulate[Table[Exp[2 \[Pi] I fn[n]] // N, {n, 1, NP}]];
Manipulate[
 ListPlot[{Re@#, Im@#}\[Transpose] &@(ls[[1 ;; np]]), Joined -> True, 
  AspectRatio -> Full, PlotStyle -> Black, 
  PlotRange -> {{-5, 70}, {-60, 20}}]
 ,
 {np, 1, NP, 1, Appearance -> "Labeled"}]

 

fn[n_] := n/dd + n^2/mm + n^3/yy /. {dd -> 23, mm -> 11, yy -> 78}
NP = 10000;
ls = Accumulate[Table[Exp[2 \[Pi] I fn[n]] // N, {n, 1, NP}]];
Manipulate[
 ListPlot[{Re@#, Im@#}\[Transpose] &@(ls[[1 ;; np]]), Joined -> True, 
  AspectRatio -> Full, PlotStyle -> Black]
 ,
 {np, 3, NP, 1}]

 

 

 

 

%d bloggers like this: