# Transforming a solution given by DSolve to a more concise form involving Erf?

I would like to solve the following ODE

$$HH^{\prime\prime\prime}+H^\prime=0,$$

in which $H=H(x)\ge 0$. To deal with this 3rd-order monster, I tried

DSolve[H[x]*H'''[x] + H'[x] == 0, H[x], x]


In Version 9, after $6.5$ minutes of calculation, Mathematica gave

Solve[
Integrate[1/Sqrt[2*(C[1]*K[1] + K[1] - K[1]*Log[K[1]]) + C[2]], {K[1], 1, H[x]}]^2
==
(C[3] + x)^2,
H[x]]


I understand that the ODE only has an analytical solution in an implicit form; i.e., the above solution in which K[1] is a dummy variable and H appears in the upper limit of integration with three constants of integration C[1], C[2], C[3].

For convenience, I write the solution in the following form:

$$x=\pm \int_1^{H(x)}\frac{dt}{\sqrt{2(t+c_1t-t\ln t)+c_2}}+c_3. \quad (1)$$

As suggested by the title and the reason why I am asking this question is that I have access to a paper which gives the solution to in a more concise form:

$$x=\pm \sqrt{\pi H_\text{m}} \text{erf}\left(\sqrt{\frac{1}{2}\ln\frac{H_\text{m}}{H}} \right),\quad (2)$$ where $H_\text{m}=\text{max}\{ H(x)\}$ and $\text{erf}(z)=\sqrt{\frac{2}{\pi}}\int_0^z e^{-t^2}dt$.

My question is whether or not I can further reduce or convert the solution given by DSolve to the form in the paper. More specifically

• Can I conclude that answer given by Solve[..., H[x]] is an analytical but implicit solution?

• How can I introduce $H_\text{m}$ into the solution?

• How can I introduce the special function $\text{erf}$ ?

Note that the lower limit of integration in solution from DSolve is $1$, while in the integral for $\text{erf}$ it is $0$.

• I ran DSolve[H[x]*H'''[x] + H'[x] == 0, H[x], x] for over an hour on Version 11.1.1 without receiving an answer of any sort. Jun 3 '17 at 11:10
• @bbgodfrey thanks for your effort! It is very strange. I don't have Version 11; however, I tried it on Version 10.0 twice, every time it even stopped itself without showing any answer after about $10$ mins' calculation on my old laptop (i5@2.5GHz, 8G RAM). In the beginning, I supposed that MMA 9 couldn't give a result. However, MMA 9 really gives the answer and proved again its capability of symbolic calculation!!
– jsxs
Jun 3 '17 at 12:17
• I have heard that DSolve Version 11.1 tries harder to find closed-form solutions and, therefore, can be much slower. Jun 3 '17 at 17:03
• Let me see if I understand. Are you asking for a "change of variable" that would transform expression (1) into expression (2) (or viceversa)? Have you tried taking the derivatives of both expressions and comparing them? It should give you a clue regarding how z is related to H. Jun 3 '17 at 17:38
• @bbgodfrey Try withTimedIntegrate[DSolve[...], 1]. Jun 3 '17 at 23:21

Hindsight is golden:

Block[{C},
Unprotect[C];
C[2] = 0;
Protect[C];
sol = DSolve[H[x]*H'''[x] + H'[x] == 0, H[x], x]
]


Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information.

(*
{{H[x] -> E^(1 + C[1] - 2 InverseErf[-(Sqrt[E^(-1 - C[1]) (x + C[3])^2]/Sqrt[π])]^2)]},
{H[x] -> E^(1 + C[1] - 2 InverseErf[Sqrt[E^(-1 - C[1]) (x + C[3])^2]/Sqrt[π]]^2)]}}
*)


The maximum of H is clearly when InverseErf is zero, which is when x == -C[3]. We can use that fact to solve for C[1], which turns out to have the same value in both solutions of the ODE.

Map[
Simplify[Solve[#, C[1], Reals], Hm > 0] &,
Hm == H[x] /. sol /. x -> -C[3]
]
(*  {{{C[1] -> -1 + Log[Hm]}}, {{C[1] -> -1 + Log[Hm]}}}  *)

sol = sol /. {C[1] -> -1 + Log[Hm]} // Simplify
(*
{{H[x] -> E^(-2 InverseErf[-(Sqrt[((x + C[3])^2/Hm)]/Sqrt[π])]^2) Hm},
{H[x] -> E^(-2 InverseErf[Sqrt[(x + C[3])^2/Hm]/Sqrt[π]]^2) Hm}}
*)

• Nice answer (+1). Thanks also for your comment above. Jun 4 '17 at 0:15

In general, the integral in (2) in the question should not be equal to the right side of (1), because the former contains one constant, and the latter contains three. To resolve this matter, begin with the integrand

1/Sqrt[2*(C[1]*t + t - t*Log[t]) + C[2]];


and simplify it by assuming

Simplify[% /. {C[1] -> c - 1, C[2] -> 0}]
(* Sqrt[2] Sqrt[t (c - Log[t])] *)


Now integrate.

FullSimplify[Integrate[%, t], c - Log[t] > 0] /. c -> Log[hm]
(* -Sqrt[hm] Sqrt[π] Erf[Sqrt[Log[hm] - Log[t]]/Sqrt[2]] *)


which is, indeed, equal to the right side of (1), if t is identified as H[x}. In other words, the two expressions are equal only for the choice of constants, {C[1] -> Log[hm] - 1, C[2] -> 0}, C[3] -> 0}. Strangely, the integration is much slower, if C[1] is set to Log[hm] - 1 immediately. Better to set it first to c - 1 as above and only later set c to Log[hm].