Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just upgraded to the new version of Mathematica because of its new built-in ParametricNDSolve function. I need to solve a first-order non-linear ordinary differential equation that has two parameters. I have no problem obtaining appropriate solutions to this equation, but once I have the solution I need to integrate out the dependence on the parameters. For instance, I would like to write something like


If I have an InterpolationFunction which has two arguments I can very easily integrate over one of the two arguments, but this does not seem possible to do with a ParametricFunction. The best idea I have had so far is to form an InterpolationFunction from the ParametricFunction and then integrate from there, but that seems inefficient and I would like something a little faster and more straightforward. Any help would be greatly appreciated.

share|improve this question
it's always a good idea to post code that works when copying it into a fresh session. – user21 Apr 29 '13 at 6:21

Here is a way:

sol = ParametricNDSolveValue[{-y*a'[x] == (a[x]^2 - 1)*x + a[x], 
   a[-10] == 0.6}, a, {x, -10, 10}, {y}]


NIntegrate[sol[y][t] /. y -> 1, {t, 0, 1}]

or alternatively via a Table:

 Table[NIntegrate[sol[y][t], {t, 0, 1}], {y, 0.1, 1, 0.1}]]

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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