1

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)

Community
  • 1
  • 1
  • can you give me a few test cases ? What should the values of `b`, `v` and `h` be ? – Pranav Void Sep 28 '19 at 00:33
  • the final b should increase with increasing v, but the exact trend is unknown. the calculation of h is correct so the values it produces are correct. –  Sep 28 '19 at 09:29
  • Don't you have to initialize `b` inside the for loop ? so that `b` is set back to `0.01` for every iteration. This does produce different values of `b`, but I don't know if they are the right. – Pranav Void Sep 28 '19 at 15:28
  • how would i do that? –  Sep 28 '19 at 15:42
  • `for i in vel: b = 0.01`. You remove `b = 0.01` above `bvalues = []` – Pranav Void Sep 28 '19 at 16:05
  • i am so silly yes thats where it was initially meant to be. thanks!! –  Sep 28 '19 at 16:11

0 Answers0