Skip to content

Instantly share code, notes, and snippets.

@adekau
Created March 29, 2020 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adekau/007e669b09ceb0081782ec1c21cb4ac2 to your computer and use it in GitHub Desktop.
Save adekau/007e669b09ceb0081782ec1c21cb4ac2 to your computer and use it in GitHub Desktop.
coeffs = Import["/Users/alexanderdekau/coeffs.json"];
pts = Import["/Users/alexanderdekau/pts.json"];
L = pts // Length;
toComplex[z_] := z[[All, 1]] + I z[[All, 2]];
Cpts = toComplex@pts;
\[Omega][k_, n_] := -2 Pi I k n / L;
Coeff[k_] := 1/L Sum[Cpts[[j]] Exp[\[Omega][k, j - 1]], {j, 1, L}];
mcoeffs = Table[Coeff[k - 1], {k, 1, L}];
coeffs = toComplex@coeffs;
idxed = MapIndexed[{First[#2], #1} &, coeffs];
Parameterize[z_] := Sum[Last[z[[k]]] Exp[I (First[z[[k]]] - 1) t], {k, 1, Length@z}];
ParametricPlot[{Re@#, Im@#} &@Parameterize@idxed, {t, 0, 2 Pi}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment