When I run *Mathematica* to get the solution of a differential equation it gives the result in terms of inverse function.

DSolve[y'[t] == ε/Sqrt[1 + k/y[t]^2], y[t], t]

enter image description here

My question is how can we extract the actual solution from the result without the inverse function or what will be an exact solution?

  • 5
    $\begingroup$ Why do you think it's even possible? It looks like it's the same case as a simple y == x + Log[x] - there is a solution for x, but it's not elementary; it's just x == inverse of y. The thing is that you'd need to solve the output for #1 - that, given the square roots, logs etc., seems unlikely. $\endgroup$ – corey979 Jan 13 '17 at 13:16
  • 2
    $\begingroup$ If you still didn't get it after corey979 comment, then probably you will get from here? mathematica.stackexchange.com/questions/16770/… or from here mathematica.stackexchange.com/questions/15978/… $\endgroup$ – zhk Jan 13 '17 at 15:18

You can treat the InverseFunction like a normal function, plot it, build the derivative ...

     dsol = 
     DSolve[y'[t] == \[CurlyEpsilon]/Sqrt[1 + k/y[t]^2] && y[0] == a, y, t]

     (*   {{y -> 
          InverseFunction[(1/Sqrt[k + #1^2])
          Sqrt[1 + 
          k/#1^2] #1 (Sqrt[k] Log[#1] - 
          Sqrt[k] Log[k + Sqrt[k] Sqrt[k + #1^2]] + Sqrt[
          k + #1^2]) &][
          t \[CurlyEpsilon] + (1/Sqrt[a^2 + k])
          a Sqrt[(a^2 + k)/
          a^2] (Sqrt[a^2 + k] + Sqrt[k] Log[a] - 
          Sqrt[k] Log[k + Sqrt[k] Sqrt[a^2 + k]])]]}}    *)

Define your y

    y[t_, \[CurlyEpsilon]_, k_, a_] = y[t] /. First[dsol]

    Plot[Evaluate@y[t, 1/10, 2, 1], {t, 0, 100}]

enter image description here

    Plot[Evaluate[D[y[t, 1/10, 2, 1], t]], {t, 0, 100}]

enter image description here


In my opinion, the solution obtained by you is useless. It is difficult to work with. If I were you, I will use the ParametricNDSolve command, adding the parameter $a$ to $k,\epsilon$ in such a way:

sol = ParametricNDSolve[{Derivative[1][y][t] == \[Epsilon]/
 Sqrt[1 + k/y[t]^2], y[0] == a},  y, {t, 0, 10}, {a, \[Epsilon], k}];
y1 = y[1, 0.1, 2] /.  sol;
y1[2] /. sol


Plot[y1[t], {t, 0, 10}]

enter image description here

The above plot suggests a solution which is very close to linear.

  • 1
    $\begingroup$ If you plot over a longer range ($0 < t < 100$, for example), you will find that the function is most assuredly not linear. It does look linear over the range you've plotted, but any function will look linear if you plot it over a small enough range. $\endgroup$ – Michael Seifert Jan 13 '17 at 16:13
  • $\begingroup$ @ Michael Seifert : The numeric solution from my answer is reliable on $[0,10]$ only. The one is close to linear there. $\endgroup$ – user64494 Jan 13 '17 at 17:15
  • $\begingroup$ Good point. Still, the solutions in general will not be fully linear; try plotting y[0.1, 0.1, 2] from t = 0 to t = 50 (after adjusting the time range). The solutions will be roughly linear when the solution satisfies $y(t) \gg \sqrt{k}$, which is the regime you plotted. (Also, they'll be roughly exponential when $y(t) \ll \sqrt{k}$.) $\endgroup$ – Michael Seifert Jan 13 '17 at 20:29
  • $\begingroup$ @ Michael Seifert : The nonlinearity of the solutions is obvious. The ODE form clearly says the derivative is not constant. $\endgroup$ – user64494 Jan 13 '17 at 21:06

Your Answer

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

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