# how to obtain this solution from dsolve?

This ode

$$y''(x)=y'(x) e^{y(x)}$$

With IC $$y(3)=0,y'(3)=1$$ has solution $$y=\ln\left(\frac{-1}{x-4}\right)$$. DSolve is not able to obtain this solution. Any suggestion for a workaround? Here is the code

ClearAll[y,x]
ode=y''[x]==y'[x]*Exp[y[x]]
ic={y[3]==0,y'[3]==1}
DSolve[{ode,ic},y[x],x]


Maple gives the solution

restart;
ode:=diff(diff(y(x),x),x) = diff(y(x),x)*exp(y(x));
ic:=y(3) = 0, D(y)(3) = 1;
sol:=dsolve([ode,ic],y(x))

#sol := y(x) = ln(-1/(x - 4))


Which according to Mathematica, is valid solution

mapleSol = y -> Function[{x}, Log[-1/(x - 4)]]
ode /. mapleSol // Simplify
eq1 = 0 == Log[-1/(x - 4)] /. x -> 3
eq2 = 1 == D[Log[-1/(x - 4)], x] /. x -> 3

(* True, True, True *)


btw, I think the problem is with solving for constants of integrations from the general solution. Here is a similar example, where Mathematica gives solution if no IC are given, but do not solve it if IC is given

$$y'' = 2 y y'$$ with IC $$y(0)=1,y'(0)=2$$. It gives similar warning as the above when using DSolve

ClearAll[x, y]
ode = y''[x] == 2*y[x]*y'[x]
ic = {y[0] == 1, y'[0] == 2}
DSolve[{ode, ic}, y[x], x]


Maple gives the solution $$y=\tan\left(x+\frac{\pi}{4} \right)$$ which Mathematica verifies it is valid

mapleSol = y -> Function[{x}, Tan[x + Pi/4]]
ode /. mapleSol // Simplify
eq1 = 1 == Tan[x + Pi/4] /. x -> 0
eq2 = 2 == D[Tan[x + Pi/4], x] /. x -> 0

(* True, True, True *)


So it looks like the issue is in the stage of solving for the constants of integration from initial conditions.

Using version 12.3.1

• gensol = DSolve[{ode}, y, x]; ivpsol = Limit[y[x] /. gensol, {C[1], C[2]} -> {0, -4}], but one cannot directly substitute C[1] -> 0 into gensol. Probably why DSolve fails on the IVP. Commented Aug 8, 2021 at 4:57

You can solve it exactly using AsymptoticDSolveValue as follows:

AsymptoticDSolveValue[{y''[x] == y'[x] E^(a y[x]), y[3] == 0,
y'[3] == 1}, y[x], x, {a, 1, 10}] /. a -> 1

• Your parameter $a$ is a nice idea. How about asol = DSolveValue[{y''[x] == y'[x] E^(a y[x]), y[3] == 0, y'[3] == 1}, y[x], x]; ysol = Limit[asol, a -> 1] Commented Aug 8, 2021 at 7:53
Clear["Global*"]

ode = y''[x] == y'[x]*Exp[y[x]];
ic = {y[3] == 0, y'[3] == 1};


Since,

ode === D[y'[x] == Exp[y[x]], x]

(* True *)


Then

sol = DSolve[{y'[x] == Exp[y[x]], ic}, y, x][[1]] // Quiet

(* {y -> Function[{x}, -Log[4 - x]]} *)


This is a solution to the original ode and satisfies the initial conditions

{ode, ic} /. sol

(* {True, {True, True}} *)

• Thanks for the suggestion. But I think strictly speaking, it should be ode === D[y'[x] == Exp[y[x] + c], x] where c is arbitrary constant? Since second order ODE should have general solution that contains two constants of integration. So that your next step would become DSolve[y'[x] == Exp[y[x]] + c, y, x] instead of DSolve[y'[x] == Exp[y[x]] , y, x] and now we are back to square one, since now it can't solve it. So your method basically set one constant of integration to zero at the start. But it does give a solution that satisfies the ODE and IC's. Commented Aug 8, 2021 at 1:14

Perhaps you can solve it in two steps:

First (only one ic y[3] == 0 !)

Y = DSolveValue[{y''[x] == y'[x] E^(  y[x]), y[3] == 0}, y , x] //PowerExpand // Simplify


This solution fullfills

{Y[3], Y'[3]} // Simplify
(*{0, 1 + C[1]}*)


To get the second ic y'[3]==1 set C[1]==0

Limit[ Y[x], C[1] -> 0]
(*-Log[4 - x]*)
`

which gives the expected result!