i want to find the smallest "y" number between idx 2-7, but theres something im not doing right. For the moment it prints x = 0.02 and y = 101, i want it to print out x = 0.05 and y = 104. Even if i change the "idx = 3" to a higher number nothing changes.
I have changed it from max to min, therefor some still say max, but i dont think that matters as long as " y[:idx].argmin()" is min?
import numpy as np
# idx: 0 1 2 3 4 5 6 7
x = np.array([0.01, 0.02, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08]) # strain
y = np.array([ 110, 101, 110, 106, 102, 104, 112, 115]) # load
idx = 3
cutoff = 0.08
while x[idx] < cutoff:
idx = idx + 1
max_idx = y[:idx].argmin()
max_x = x[max_idx]
max_y = y[max_idx]
print (max_x)
print (max_y)