1

I'm trying to find the point where my data passes through some critical value (e.g. passes through zero), and I want to numerically approximate where that critical value occurs. I can do it 'by hand' for one case but need to generalize so that I can quickly repeat the process a few dozen times across all of my data.

I've thought about using scipy.optimize but I'm using real discrete data that doesn't follow an analytic function that I can use to call fsolve.

Here's some code and a pyplot image showing what I mean. If this were my data, I would want to estimate where the red circle occurs, knowing that it will not occur directly on top of my discrete points.

x = np.arange(0, 2,.2)
f = 3-x**2-x

plt.scatter(x,f,marker='v')
plt.plot(x,f)
plt.hlines(0,0,2)
plt.scatter(1.3,0,color='r',zorder=10)

https://i.stack.imgur.com/2Uusr.png

mneedham
  • 45
  • 4

1 Answers1

1

The simplest method - you could interpolate your data in x and y to make it "more" continuous. Then see where the minimum between 0 and y occurs.

foxpal
  • 586
  • 4
  • 14