I have a set of ODEs solved with NDSolve which returns InterpolatingFunctions. When I am trying to plot them, it takes a long time to render. I am guessing that adaptive subdivision for the sharp features makes it slow. My question is: since the interpolation was done internally before NDSolve returns, is there any way we can obtain the list of data points NDSolve used to interpolate? Thanks.
Asked
Active
Viewed 358 times
3
-
2https://mathematica.stackexchange.com/questions/184132/debugging-ndsolve-to-see-numerical-values-at-each-time-step/184251#184251, https://mathematica.stackexchange.com/questions/28337/whats-inside-interpolatingfunction1-4, https://mathematica.stackexchange.com/questions/151845/taking-part-of-an-interpolatingfunction/152861#152861 – Michael E2 Apr 21 '20 at 19:49
-
1Related: https://mathematica.stackexchange.com/questions/134222/easy-way-to-plot-ode-solutions-from-ndsolve – Michael E2 Apr 21 '20 at 19:54
1 Answers
6
iF = y /. NDSolve[{y'[x] == y[x] Cos[x + y[x]], y[0] == 1}, y, {x, 0, 30}][[1]]
You can access the list of Properties of InterpolatingFunction object using
PropertyList[iF]
{"Coordinates", "DerivativeOrder", "Domain", "ElementMesh", "Evaluate", "GetPolynomial", "Grid", "InterpolationMethod", "InterpolationOrder", "MethodInformation", "Methods", "OutputDimensions", "Periodicity", "PlottableQ", "Properties", "QuantityUnits", "Unpack", "ValuesOnGrid"}
or
iF["Methods"]
same list
You can access the property p using iF[p]. For example,
iF["InterpolationOrder"]
{3}
iF["Coordinates"] // Short[#, 3] &
iF["Grid"] // Short[#, 3] &
iF["ValuesOnGrid"] // Short[#, 3] &
etc.
kglr
- 394,356
- 18
- 477
- 896



