<gh_stars>0
from scipy.optimize import fsolve
import numpy as np
import matplotlib.pyplot as plt
# Defining function to simplify intersection solution
def findIntersection(func1, func2, x0):
    return fsolve(lambda x : func1(x) - func2(x), x0)
# Defining functions that will intersect
funky = lambda x : np.cos(x / 5) * np.sin(x / 2)
line = lambda x : 0.01 * x - 0.5
# Defining range and getting solutions on intersection points
x = np.linspace(0,45,10000)
result = findIntersection(funky, line, [15, 20, 30, 35, 40, 45])
# Printing out results for x and y
plt.hist2d(x,line(x))
plt.show()
from scipy.optimize import fsolve
import numpy as np
import matplotlib.pyplot as plt
# Defining function to simplify intersection solution
def findIntersection(func1, func2, x0):
    return fsolve(lambda x : func1(x) - func2(x), x0)
# Defining functions that will intersect
funky = lambda x : np.cos(x / 5) * np.sin(x / 2)
line = lambda x : 0.01 * x - 0.5
# Defining range and getting solutions on intersection points
x = np.linspace(0,45,10000)
result = findIntersection(funky, line, [15, 20, 30, 35, 40, 45])
# Printing out results for x and y
plt.hist2d(x,line(x))
plt.show()
# Defining function to simplify intersection solution # Defining functions that will intersect # Defining range and getting solutions on intersection points # Printing out results for x and y