title: Python - Find all intersection points of 2 graphs
body: <p>I'm trying to find all the intersection points of two graphs and display them on the final plot. I've looked around and tried multiple things, but I haven't been able to obtain what l'm looking for. </p>
  
  <p>Currently, I attempting to generate a list wherein the intersection points would be listed, though I keep getting the following error: </p>
  
  <blockquote>
    <p>The truth value of an array with more than one element is ambiguous.
    Use <code>a.any()</code> or <code>a.all()</code>.</p>
  </blockquote>
  
  <pre><code>import numpy as np
  from scipy.optimize import fsolve
  import matplotlib.pyplot as plt
  
  
  x = np.arange(-7.0, 7.0, 0.05)
  
  def y(x):
      return np.sin(x)*(0.003*x**4 - 0.1*x**3 + x**2 + 4*x + 3)
  
  def g(x):
      return -10 * np.arctan(x)
  
  def intersection(x):
      if (y(x) - g(x)) == 0:
          print y.all(x)
  
  plt.plot(x, y(x), '-')
  plt.plot(x, g(x), '-')
  
  plt.show()
  </code></pre>