Hi guys, basically what I am trying to do is see whether my graphical solution to an ODE will give a zero at the correct point. For a certain set of initial conditions, this should be the case up until some point where the zeros will vanish (or occur after that specified point). I tried to do this on code but it is not working how I thought - I want to have it see whether x[t-spec] == 0 and if it does, then I will add a certain value (0.000015) to “r” (from the code) and check the next set of initial conditions (and if they satisfy the x[t-spec] == 0 as well, then add a 0.000015 to r). I am interested in finding the “r” value at which beyond it, there will be no more zeros at that specified point. Here is my code below:
r = 0 (*defines the critical radius variable*)
For[i = 0.000015, i = 1.5, i += 0.000015] { (*iterates through initial condition values*)
s = NDSolve[{x'[
t] - (2.5*10^-25) ((1.2*10^31 ((9*10^-6) - (1.5*10^-3) t) \
(5*10^5 ((9*10^-6) - (1.5*10^-3) t) - 1000000 x[t] +
3) (5*10^5 ((9*10^-6) - (1.5*10^-3) t) +
1000000 x[t] -
3)/(1000000000000 ((9*10^-6) - (1.5*10^-3) t)^2 +
1000000000000 x[t]^2 - 6000000 x[t] + 9)^(7/
2)) - ((3 ((9*10^-6) - (1.5*10^-3) t)^3 -
12 ((9*10^-6) - (1.5*10^-3) t) x[t]^2))/(x[
t]^2 + ((9*10^-6) - (1.5*10^-3) t)^2)^(7/2)) == 0,
x[0] == i*10^-6}, x, {t, 0, 1}]
Plot[Evaluate[x[t] /. s], {t, 0, .1}] (*plots sol'n to diff eq*)
If[{x[.006] /. s} == 0, r = r + 0.000015, r = r] (*checks if zero at specified time - adds .000015 to r if true)
}
Print[r]
The logic makes sense but it seems like I am having trouble with the syntax. I am most concerned with the last two lines in the loop - where I plot and evaluate to see whether there is a zero at the specified time. Any help with this would be needed! Also, whenever I run it, I keep getting it showing up as r = 0, so I’m guessing it’s not adding to “r” - that’s the only clue I can see so far. Thanks for the help! Please reply if you have any questions about this so I can clear it up if you’re unsure on something I said!