As a result of solving an ODE system using ParametricNDSolveValue I obtain 4 functions, each of them a ParametricFunction depending on the parameter specified in ParametricNDSolveValue.

Even though what I want looks 'simple' to me, I've searched through the documentation and this site with no success, so here goes my question:

Can I transform my solution ParametricFunction into an expression of some kind? The motivation is manipulating this expression, and this may involve different software.

If that's not possible, is there any other way in Mathematica to solve a $2\times 2$ system of ODEs at a point with a free parameter? Here's the question where I first asked about that.


1 Answer 1


Towards your highlighted question: The answer is no. ParametricFunction objects are actually not pure functions but rather information containers that enable Mathematica to quickly generate InterpolatingFunctions once a numerical parameter is supplied. There is usually a complicated numerical solver involved in this and so there is no simple analytical expression into which a ParametricFunction could be transformed to.

Similar are InterpolatingFunction objects: They represent piecewise-polynomial functions or rather enough information so that numerical evaluation of the underlying functions can be done (more or less) efficiently. While it would be possible to turn an InterpolatingFunction into a Piecewise expression, it would not be meaningful as there are usually thousands (or even millions) of cases to be distinguished; the output expression would be nothing a human mind would find elevating.

If you look for symbolic solutions to ODE then try DSolve instead of NDSolve. But do not expect that you find a symbolic solution in general. In fact, most ODEs do not have closed form solutions.

  • $\begingroup$ Incidentally, given a ParametricFunction with variable x and parameter a, is there a good way to fix x and generate an InterpolatingFunction dependent on a? Or rather a bivariate InterpolatingFunction dependent on both x and a? What is the difference between a bivariate InterpolatingFunction and a ParametricFunction? Sorry for tandem questioning, I hope these are related close enough to not be offensive. $\endgroup$
    – Gravifer
    Dec 14, 2022 at 9:32
  • $\begingroup$ From this answer I believe using FunctionInterpolate is not very desirable? What would be an idiomatic alternative? $\endgroup$
    – Gravifer
    Dec 14, 2022 at 9:53
  • 1
    $\begingroup$ You can simply sample a ParametricFunction on a regular grid and use that to construct an InterpolatingFunction. Of course, a bit of accuracy will be lost, but maybe that is acceptable for you. $\endgroup$ Dec 14, 2022 at 11:59
  • $\begingroup$ It is tricky for me, as I actually need to do an improper integration with this function. so the result is really sensitive to the vincinity of the singularity. $\endgroup$
    – Gravifer
    Dec 14, 2022 at 13:00

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.