Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- n = 20;
- Manipulate[
- f[l_] := Accumulate[Join[{{0, 0}}, MapIndexed[#1 (
- With[{i = #2[[1]]},
- N[{Sin[2 Pi i/k], Cos[2 Pi i / k]}]
- ]
- ) &, l]]];
- partitions = IntegerPartitions[n];
- paths = f /@ partitions;
- Graphics[
- {
- Thick,
- Opacity[0.5],
- PointSize[Large],
- Table[
- {
- ColorData["DarkRainbow"][i/Length[paths]],
- Line[paths[[i]]],
- Point[paths[[i, -1]]]
- },
- {i, Length[paths]}
- ]
- }
- ],
- {k, 3, 20, 1}
- ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement