title: Simulating a logarithmic spiral galaxy in python
body: <p>I am simulating a logarithmic spiral galaxy using python. Using the parametric equations,</p>
  
  <p><code>x= a*exp(b*theta)*cos(theta)</code>
  and
   <code>y= a*exp(b*theta)*sin(theta)</code></p>
  
  <p>I used numpy.random for getting the random distribution of stars. The sample code is given below. </p>
  
  <pre><code>import random
  from math import *
  from pylab import *
  import numpy as np
  
  n=100000
  a= 1
  b=0.6
  th =np.random.randn(n)
  x= a*exp(b*th)*cos(th)
  y=a*exp(b*th)*sin(th)
  x1 = a*exp(b*(th))*cos(th+ pi)
  y1=a*exp(b*(th))*sin(th + pi)
  plot(x,y,"*")
  plot(x1, y1,"*")
  show()
  </code></pre>
  
  <p>The resulting image is shown below
  <a href="http://i.stack.imgur.com/ZXQKU.png" rel="nofollow">spiral galaxy with two arms</a></p>
  
  <p>What I need:
  1) stars should be radially distributed in the spiral galaxy. I got the distribution only along the arms.
  2) Both arms should be blue. Here I have one arm with blue color and other with green.</p>
  
  <p>After simulating this, I need to rotate the galaxy. Any help regarding this would be appreciable.</p>
  
  <p>**edit: I got both the arms in blue color using <code>plot(x1, y1,"b*")</code> </p>