Given a set of coupled nonlinear equations I want to extract the boundary points that appears in the interpolation function obtained as an output to NDSolve function and then to define them directly as $r_{min}$ and $r_{max}$ respectively.

More specifically my code is given by:

A = Exp[-EulerGamma/2] + 3.66*10^(-10)
sol = NDSolve[{h'[r] ==  h[r]f[r]+1,f[r] == -h[r]x[r]^2,x'[r]== -h[r]x[r],h[5]== 5,f[5]==0,x[5]== A*Exp[-12.5]},{h,f,x},{r,-10^(50),10^(50)},MaxSteps-> 1000,PrecisionGoal->70,WorkingPrecision->70,AccuracyGoal->70]

The output is given by:

enter image description here

which means that the boundary points are: $$ r_{min} = -63.42767159534372314743575944962536112508774436140873584436462308694243 $$ $$ r_{max} = 59.59887472641839166667576516071824661172770432996431126358438280519370 $$

How to extract directly the boundary points without mechanically to copy the boundry points from InterpolatingFunction using ctrl+C and then ctrl+V?


1 Answer 1


We can use "Domain" to extract the values.

{rmin, rmax} = (h /. sol[[1]])["Domain"][[1]];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.