Improve performance of operation on numpy trigonometric functions
<p>I have a rather large code which I need to optimize. After some analysis using <code>time.time()</code>, I've found that the line that takes up the most processing time (it is executed thousands of times) is this one:</p>

<pre><code>A = np.cos(a) * np.cos(b) - np.sin(a) * np.sin(b) * np.sin(c - d)
</code></pre>

<p>where all the variables can be randomly defined with:</p>

<pre><code>N = 5000
a = np.random.uniform(0., 10., N)
b = np.random.uniform(0., 50., N)
c = np.random.uniform(0., 30., N)
d = np.random.uniform(0., 25., N)
</code></pre>

<p>Is there a way to improve the performance of the calculation of <code>A</code>? As I'm already using <code>numpy</code>, I'm pretty much out of ideas. </p>