I am computing the path of a particle near a black hole by performing Runge Kutta on an ODE (details unnecessary, proven to work correctly). The function has parameters h
which I input as a function of b
and v
. I run the path through all v = np.arange(0.001,1,0.01)
and for each v i vary b
. I want to determine the minimum b
for which the particle at each v doesnt get captured i.e. the radius first does NOT reach r = 1, so I increase it in small increments using a loop.
The issue in my code if even though I have a different resulting h
in each case of v
, the minimum b
i require is calculated to be the same for all v
. Do you see where this problem arises?
Fourth Order Runge Kutta to solve 2nd order derivative
#vary v from 0 to 1
def obtainBCRIT():
vel = np.arange(0.001, 1, 0.01)
b = 0.01
bvalues = []
for i in vel:
radii = remove_negatives(calcCoords(1, b, i)[1])
while len([*filter(lambda x: x < 1, remove_negatives(radii))]) > 0:
b += 0.01
radii= remove_negatives(calcCoords(1, b, i)[1])
bvalues.append(b)
print("for velocity = " +str(i) + " final b = " + str(b) )
print(" radii = " + str(radii))
print(" b values = " +str(bvalues))
return(bvalues, vel)