Function intersections

Date:2009-07-31 (last modified), 2009-07-31 (created)

Find the points at which two given functions intersect

Consider the example of finding the intersection of a polynomial and a line:



In [2]:
from scipy.optimize import fsolve

import numpy as np

def f(xy):
   x, y = xy
   z = np.array([y - x**2, y - x - 1.0])
   return z

fsolve(f, [1.0, 2.0])
array([ 1.61803399,  2.61803399])

Section author: nokfi