Plotting cosine with Python
<p>I plot a cosine sampled at 400 points in the interval -5 .. +5 using python for n=1..4:</p>

<pre><code>import matplotlib.pyplot as plt
import numpy

for n in range(1,5):
    x = numpy.linspace(-5,5,num=400)
    series = numpy.cos(1e4/n*x)
    plt.figure()
    plt.plot(series)
</code></pre>

<p>But for n = 3 the plot looks not like a cosine which I think is due to sampling error. How can I achieve a smooth cosine plot with constant samples for different frequencies (i.e. different n)?</p>
