title: Convert array 1:n in matlab to python
body: <p>I have question similar to <a href="https://stackoverflow.com/questions/19938208/converting-matlab-code-to-python">this</a>, and possibly a much simpler one:</p>
  
  <p>We use the</p>
  
  <pre><code>k = 1:n;
  </code></pre>
  
  <p>a lot in Matlab. But in Python I simply struggle to get this simple thing work. I tried using arange, but never really realized what the error is:</p>
  
  <pre><code>&gt;&gt;&gt; arange(1,]10[,1,])
  File "&lt;stdin&gt;", line 1
  arange(1,]10[,1,])
           ^
  SyntaxError: invalid syntax
  &gt;&gt;&gt; arange(1,10[,1,])
    File "&lt;stdin&gt;", line 1
      arange(1,10[,1,])
                  ^
  SyntaxError: invalid syntax
  &gt;&gt;&gt; arange([1,]10[,1,])
    File "&lt;stdin&gt;", line 1
      arange([1,]10[,1,])
                  ^
  SyntaxError: invalid syntax
  &gt;&gt;&gt; np.arange
  &lt;built-in function arange&gt;
  &gt;&gt;&gt; arange([1], 10[,1])
    File "&lt;stdin&gt;", line 1
      arange([1], 10[,1])
                     ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>I went to the <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html" rel="nofollow noreferrer">numpy website</a> and tried to give the syntax there, but again:</p>
  
  <pre><code>&gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; np.arange([1],10[,1],dtype=None)
    File "&lt;stdin&gt;", line 1
      np.arange([1],10[,1],dtype=None)
                       ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>I wouldn't have written this post just to clarify something of this sort, but my point is why is this simplest Matlab command so very complicated in Python? I even used <a href="https://github.com/victorlei/smop" rel="nofollow noreferrer">this tool</a> to convert .m codes to .py codes, with little effect.</p>
  
  <p>EDIT after the post from @mskimm: Thanks! One related question. To write something very similar to the following in Matlab:</p>
  
  <pre><code>n = 100;
  k = 1:n;
  z = (n-k)./(n-k-1);
  plot(k,log(z))
  </code></pre>
  
  <p>I ended up writing this in Python:</p>
  
  <pre><code>from __future__ import division
  import numpy as np
  import matplotlib.pyplot as plt
  
  # test code to check the shape of a curve
  n = 100
  k = np.arange(1,n+1)
  z = (n - k) / (n - k - 1)
  
  fig = plt.figure()
  ax = fig.gca()
  
  plt.plot(k, np.log(z))
  plt.show()
  </code></pre>
  
  <p>Is this the right way of doing it? Or there is a better way of doing the <code>plot()</code> ?</p>