-
Notifications
You must be signed in to change notification settings - Fork 1
/
drawCentrifuge.wl
65 lines (59 loc) · 1.63 KB
/
drawCentrifuge.wl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
BeginPackage["Centrifuge`drawCentrifuge`"]
PlotCentrifuge::usage = "PlotCentrifuge[z, roots]";
DrawCentrifugeSols::usage = "DrawCentrifugeSols[solutions]";
Begin["`Private`"]
PlotCentrifuge[z_, roots_] := Module[{},
PlotComplexBase[roots] := ListPlot[
{Re[#], Im[#]} & /@ roots,
AxesOrigin -> {0, 0},
Axes -> False,
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}},
ImagePadding -> 0,
AspectRatio -> 1,
Frame -> False,
FrameLabel -> {{Im, None}, {Re, None}},
PlotStyle -> Directive[GrayLevel[0.7], PointSize[0.2]]
];
PlotComplex[z] := ListPlot[
{Re[#], Im[#]} & /@ z,
AxesOrigin -> {0, 0},
Axes -> False,
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}},
ImagePadding -> 0,
AspectRatio -> 1,
Frame -> False,
FrameLabel -> {{Im, None}, {Re, None}},
PlotStyle -> Directive[Red, PointSize[.2]]
];
(*Return*)
Show[
Graphics@Circle[{0, 0}, 1],
PlotComplexBase[roots],
PlotComplex[z],
ImageSize -> Tiny
]
]
DrawCentrifugeSols[solutions_] := Module[{numSubSets, roots, n, solsTable, i},
n = Length[solutions[[1]]];
roots = solutions[[1]];
numSubSets = Length[solutions[[2]]];
solsTable = {{"Elements", "Representation"}};
(*Loop over subsets*)
For[i = 1, i <= numSubSets, i++,
solsTable = Append[
solsTable,
{solutions[[2]][[i]][[1]],
PlotCentrifuge[#, roots] & /@ solutions[[2]][[i]][[2]]}
]
];
Print["Roots for ", n, " holes: ", roots];
Print["Solutions:"];
(*Return*)
Grid[solsTable,
Background -> {None, {Lighter[Yellow, .9], None}},
Alignment -> {{Center, Left}},
Dividers -> {All, All}
]
]
End[];
EndPackage[];