19
$\begingroup$

I would like to plot an image of what I call a pentagonal spiral with Mathematica. A sample image of what I'd like to obtain is this (sorry for low-quality):

enter image description here

My initial idea was to get some kind of spiral and reduce the number of PlotPoints, but I just can't seem to get a decent accuracy using either an Archimedes sor a log spiral. The actual attempts are quite dissatisfying, as I am probably taking a wrong approach. I do not have any other ideas: even a reference to mathematical constructs that yield a similar spiral would be more than welcome. I do not know if this construction has a name, hence finding references has proven to be difficult.

What method cold I use to obtain a Plot similar to the one in the picture?

$\endgroup$
1
  • 1
    $\begingroup$ Related: (110848) $\endgroup$
    – Mr.Wizard
    Commented Jun 10, 2017 at 16:39

3 Answers 3

18
$\begingroup$

Late to the party~ A slight modification to make them more similar:

steps = AnglePath@Table[{r-0.015 r^2, 1.002*(2 Pi/5)}, {r, .1, 25, 0.1}];
ls=Thread[{Join[ConstantArray[Opacity@1,7],ConstantArray[[email protected],13]],#}]&/@
Partition[Line/@Thread@{Most@steps,Rest@steps},20];
Graphics[{Red, ls}, Background -> Black]

Effect:

close

This solution focused on the perodic color variation and the decrease in the gaps while extruding.

$\endgroup$
4
  • $\begingroup$ Very nice replication. +1 (Although I suppose it should be flipped upside-down to be even closer.) $\endgroup$
    – Mr.Wizard
    Commented Aug 29, 2016 at 3:35
  • 1
    $\begingroup$ @Mr.Wizard there should be an @ there...... sorry~ $\endgroup$
    – Wjx
    Commented Aug 29, 2016 at 3:42
  • $\begingroup$ I decided to choose this as the correct answer because the graphical result is the most similar to the given image. All the answers were great indeed, and every single one gives something to the whole picture. C.E.'s answer is quick and slick, Mr.Wizard's one lets us manipulate the graphics to obtain a beautiful animation (you can see a sample of it here: (giphy.com/gifs/3o6Zt1PrY1ivErjzUc). Wjx instead worked the details about the colors out: I just wanted to recognize everybody's effort and thank the community. $\endgroup$
    – Lonidard
    Commented Aug 29, 2016 at 10:25
  • $\begingroup$ @bharb thanks for your appreciation! :) $\endgroup$
    – Wjx
    Commented Aug 29, 2016 at 10:27
15
$\begingroup$

It's something like this:

steps = Table[{r, 1.001 (2 Pi/5)}, {r, 1, 25, 0.1}];
Graphics[{Red, Line@AnglePath[steps]}, Background -> Black]

Mathematica graphics

$\endgroup$
15
$\begingroup$

This might do the trick:

Manipulate[
 ParametricPlot[
  #1 {Cos[#2], Sin[#2]} & @@ {t, Log[i] Floor[t]},
  {t, 0, 200}
  , Background -> Black
  , PlotStyle -> Purple
  , Axes -> False
  , PerformanceGoal -> "Quality"
  , PlotRange -> {{-201, 201}, {-201, 201}}
  ],
 {{i, 3.525}, 3.43, 3.6}
]

enter image description here


Since you enjoyed the animation aspect here is nearly verbatim code I wrote 15 years ago:

Animate[ParametricPlot[#1 {Cos[#2], Sin[#2]} & @@ {t, Log[i] Floor[t]}, {t, 0, 200},
   Background -> Black, ImageSize -> 400, PlotPoints -> 150, Axes -> False, 
  PlotRange -> {{-201, 201}, {-201, 201}}], {i, 1, 12.365}, DefaultDuration -> 200, 
 AnimationRepetitions -> 1]

The animation is much too long to practically include as a .GIF here, but I hope you enjoy the patterns that emerge from this simple function.

$\endgroup$
6
  • $\begingroup$ Great answer, indeed.This construct makes it easy to build a cool animation too, although the central pentagon kind of moves around. Is there any way of solving the issue, fixing the center of the spiral? $\endgroup$
    – Lonidard
    Commented Aug 28, 2016 at 19:56
  • $\begingroup$ @bharb Yes, a fixed PlotRange. I should have included that. Fix on the way. $\endgroup$
    – Mr.Wizard
    Commented Aug 28, 2016 at 20:00
  • 1
    $\begingroup$ @bharb Please take a look at the addendum. :-) $\endgroup$
    – Mr.Wizard
    Commented Aug 29, 2016 at 13:28
  • $\begingroup$ I think I'm in love. This is just beautiful! $\endgroup$
    – Lonidard
    Commented Aug 29, 2016 at 13:36
  • $\begingroup$ I felt bold and tried to export the .gif in decent quality. Result: two damn GIGABYTES of gorgeousness. $\endgroup$
    – Lonidard
    Commented Aug 29, 2016 at 14:41

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