1
$\begingroup$

This is both a math question and a Mathematica question. I am trying to draw a simple spiral, and found this diagram that fits what I am trying to create.

spiral

Implementing the math, using Mathematica, I'd like it to have the following parameters, or something like this.....

spiral[center_, startAngle_, endAngle_, startRadius_, endRadius_, revolutions_]:= ???

Any help would be appreciated.

$\endgroup$
1
  • 3
    $\begingroup$ What had you tried? $\endgroup$ Commented 2 days ago

2 Answers 2

5
$\begingroup$

In the complex plane a spiral that grows linearly with the angle (phase) is simply:

f[r_]= r Exp[2Pi I r]

To plot this in the R^2 plane we must take the real and imaginary part of this by:

spiral[r_]= r ReIm[Exp[2Pi I r]];
ParametricPlot[spiral[r],{r,0,5}]

enter image description here

$\endgroup$
5
$\begingroup$

r1 is start radius, r2 is end radius, re is number of revolutions, a1 is start angle, a2 is end angle.

r1 = 2;
r2 = 5;
re = 3;
a1 = 1 Pi/4;
a2 = 1 Pi/4;

PolarPlot[(
  a2 r1 - a1 r2 + 2 Pi r1 re)/(-a1 + a2 + 
   2 Pi re) + ((-r1 + r2) x)/(-a1 + a2 + 2 Pi re), {x, a1, 2 Pi re + a2}]

Clear[r1, r2, re, a1, a2]

enter image description here

And here is how the eqaution was derived:

eq = u + v x;
eq == r1 /. x -> a1;
eq == r2 /. x -> re 2 Pi + a2;
eq /. Solve[{%%, %}, {u, v}]

{-((-a2 r1 + a1 r2 - 2 Pi r1 re)/(-a1 + a2 + 
    2 Pi re)) - ((-r1 + r2) x)/(a1 - a2 - 2 Pi re)}

Here the same equation use inside ParametricPlot to allow shifting of the center of the spiral.

r1 = 2;
r2 = 5;
re = 3;
a1 = 1 Pi/4;
a2 = 1 Pi/4;
center = {2, 3};

ParametricPlot[
 FromPolarCoordinates@{(a2 r1 - a1 r2 + 2 Pi r1 re)/(-a1 + a2 + 
         2 Pi re) + ((-r1 + r2) x)/(-a1 + a2 + 2 Pi re), x} + center //
   Evaluate, {x, a1, 2 Pi re + a2}]

Clear[r1, r2, re, a1, a2]

enter image description here

In the form of function it would be:

spiral[c_, a1_, a2_, r1_, r2_, re_] := 
 ParametricPlot[
  FromPolarCoordinates@{(a2 r1 - a1 r2 + 2 Pi r1 re)/(-a1 + a2 + 
          2 Pi re) + ((-r1 + r2) x)/(-a1 + a2 + 2 Pi re), x} + c // 
   Evaluate, {x, a1, 2 Pi re + a2}]

spiral[{2, 3}, Pi/4, 3 Pi/4, 2, 5, 7]

enter image description here

For opposite direction of rotation use negative re.

$\endgroup$
2
  • $\begingroup$ Does this plot always have a center at (0,0)? $\endgroup$ Commented 2 days ago
  • $\begingroup$ @TomDeVries Yes. $\endgroup$ Commented 2 days ago

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.