Is there an efficient way to check if a curve that was obtained as an Interpolating Function (from solving differential equations numerically) passes through a given region?

I am solving for two functions $f(r)$ and $g(r)$ from two coupled differential equations. I need to find the initial conditions for which the two functions pass through a specific point $(f(r)=f_0,g(r)=g_0)$ for any r.

What I had tried, was to solve for $r$ such that $f(r)=f_0$ using FindRoot, and then check if $g(r)==g_0$ for that $r$. Unfortunately, this doesn't work, as my equations depend very strongly on the initial conditions. Any small deviation makes the solution pass through a different point. Additionally, this method does not account for the fact that the curve may cut the $f(r)=f_0$ line multiple times. Since FindRoot finds only one root close to my initial guess for $r$, this method is not very trustworthy.

The second problem doesn't bother me as much as the first, since I expect the solution that I want to intersect $f(r)=f_0$ only once. Ideally, what I need is a method to check if the solution that I get from NDSolve for some set of initial conditions, passes through a region (say, a circle) around $(f_0,g_0)$ even once. If I could do that, I can progressively increase precision for the initial conditions and reduce the size of my region until I get a reasonable approximation for the initial conditions that I need.

  • $\begingroup$ Which do you want to detect, whether the solution passes through a point or through a region? $\endgroup$ – Michael E2 May 5 '16 at 22:06
  • $\begingroup$ Ideally, I want a solution that passes through a point, but I don't think I can get the precise initial conditions directly without it taking a long time to scan my parameter space. So I want to detect it passing through a region, and I can progressively make the region smaller until I have a good enough estimate of the solution I want. $\endgroup$ – Gowri May 5 '16 at 23:22
  • $\begingroup$ Have you seen the Shooting Method? $\endgroup$ – Michael E2 May 5 '16 at 23:33
  • $\begingroup$ Thanks! I'll have a look. This might be what I need. $\endgroup$ – Gowri May 6 '16 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.