In some of the answers to previous work, I was unable to follow some links to documentation on intersections between a spline curve and multiple lines created from a def. I want to grab the points in which a system demand curve and a pump curve intersect. I have tried a few approaches; however, the numpy arrays are empty lists. I have the 8 lists correctly, just nothing in them
There is documentation on intersections between splines and curves in which the x-values must be increasing (which they are in my case), but i couldn't read the documents.
for my code...this is what I have tried
I created a spline curve and would like to find the intersection points of the curves I have created. I tried using the np.intersect1d in my for loop and created my 8 array that I would have hoped to be a 1 long; however, they are empty arrays...help would be appreciated
plt.figure()
xnew = np.linspace(Flow_Rate.min(),Flow_Rate.max(),300)
power_smooth = spline(Flow_Rate,Pump_Head,xnew)
plt.plot(xnew,power_smooth)
plt.show()
Changing_diameter = [0.06985, .0762, .08255, .0889, .09525, .1016, .10795, .1143]
def H_l(x):
reyn = ((density*(x*(1.6667*10**-5))/Area)*d_diameter)/(v_vis)
return Length/d_diameter*(x/Area)**2/(2*g)*64./reyn
Head = H_l(Q_si)
Changing_head = []
for i in range(len(Changing_diameter)):
d_diameter = Changing_diameter[i]
Head = H_l(Q_si)
Changing_head = []
plt.xlim(-5,100)
plt.ylim(-5,50)
plt.plot(Q_imp,Head,label=d_diameter)
np.array(Q_imp)
np.array(Head)
print(np.intersect1d(Q_imp, Head, assume_unique = False))
plt.legend()
plt.show()
My expected result would be to be a list that is one item long with just the intersection between the spline and the curves created