Skip to main content
added 73 characters in body
Source Link
Nasser
  • 147.3k
  • 12
  • 156
  • 364

Fyi, report to WRI as suggedted. [CASE:4956902]


This ode is similar to one here but for some reason DSolve could not able to solve this. This ode is from a textbook

My question is: What is the reason it can't solve this since it is similar to the one in the above link, and any workaround to make DSolve solve this one?

I solved by hand below as well. I used the Trace commands by Michael E2 from the above answer, but it did not help me figure where it went wrong and I am not good at internal tracing of Mathematica functions.

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]
(* {} *)

The solution it should have given is y[x]->-Log[4-x] as shown below.

Verification of solution

mysol = y -> Function[{x}, -Log[4 - x]]
ode /. mysol

Mathematica graphics

ic/.mysol

Mathematica graphics

Hand solution

\begin{align*} y^{\prime\prime} & =y^{\prime}e^{y}\\ y\left( 3\right) & =0\\ y^{\prime}\left( 3\right) & =1 \end{align*} Let $p=y^{\prime}$, then $y^{\prime\prime}=\frac{dp}{dx}=\frac{dp}{dy}\frac{dy}{dx}=\frac{dp}{dy}p$. The ode becomes \begin{align*} \frac{dp}{dy}p & =pe^{y}\\ \frac{dp}{dy} & =e^{y} \end{align*} Which has the solution \begin{equation} p=e^{y}+c_{1}\tag{1}% \end{equation} Using initial conditions given by $p\left( 3\right) =1,y\left( 3\right) =0$ the above becomes $$ 1=1+c_{1} $$ Hence $c_{1}=0$ and the solution (1) simplifies to \begin{align*} p & =e^{y}\\ \frac{dy}{dx} & =e^{y} \end{align*} This is separable. $$ e^{-y}dy=dx $$ Integrating gives \begin{equation} -e^{-y}=x+c_{2}\tag{2} \end{equation} But $y\left( 3\right) =0$, hence $$ -1=3+c_{2} $$ Therefore $c_{2}=-4$ and (2) becomes \begin{align*} -e^{-y} & =x-4\\ e^{-y} & =4-x\\ -y & =\ln\left( 4-x\right) \\ y & =-\ln\left( 4-x\right) \end{align*}

Attempt at Tracing using Michael E2's code

ClearAll[y,x];
ode=y''[x]==y'[x]*Exp[y[x]];
ic={y[3]==0,y'[3]==1};
Trace[DSolve[{ode,ic},y[x],x],s_Solve:>HoldForm[s]->s,TraceInternal->True]//Flatten//Column

Mathematica graphics

This ode is similar to one here but for some reason DSolve could not able to solve this. This ode is from a textbook

My question is: What is the reason it can't solve this since it is similar to the one in the above link, and any workaround to make DSolve solve this one?

I solved by hand below as well. I used the Trace commands by Michael E2 from the above answer, but it did not help me figure where it went wrong and I am not good at internal tracing of Mathematica functions.

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]
(* {} *)

The solution it should have given is y[x]->-Log[4-x] as shown below.

Verification of solution

mysol = y -> Function[{x}, -Log[4 - x]]
ode /. mysol

Mathematica graphics

ic/.mysol

Mathematica graphics

Hand solution

\begin{align*} y^{\prime\prime} & =y^{\prime}e^{y}\\ y\left( 3\right) & =0\\ y^{\prime}\left( 3\right) & =1 \end{align*} Let $p=y^{\prime}$, then $y^{\prime\prime}=\frac{dp}{dx}=\frac{dp}{dy}\frac{dy}{dx}=\frac{dp}{dy}p$. The ode becomes \begin{align*} \frac{dp}{dy}p & =pe^{y}\\ \frac{dp}{dy} & =e^{y} \end{align*} Which has the solution \begin{equation} p=e^{y}+c_{1}\tag{1}% \end{equation} Using initial conditions given by $p\left( 3\right) =1,y\left( 3\right) =0$ the above becomes $$ 1=1+c_{1} $$ Hence $c_{1}=0$ and the solution (1) simplifies to \begin{align*} p & =e^{y}\\ \frac{dy}{dx} & =e^{y} \end{align*} This is separable. $$ e^{-y}dy=dx $$ Integrating gives \begin{equation} -e^{-y}=x+c_{2}\tag{2} \end{equation} But $y\left( 3\right) =0$, hence $$ -1=3+c_{2} $$ Therefore $c_{2}=-4$ and (2) becomes \begin{align*} -e^{-y} & =x-4\\ e^{-y} & =4-x\\ -y & =\ln\left( 4-x\right) \\ y & =-\ln\left( 4-x\right) \end{align*}

Attempt at Tracing using Michael E2's code

ClearAll[y,x];
ode=y''[x]==y'[x]*Exp[y[x]];
ic={y[3]==0,y'[3]==1};
Trace[DSolve[{ode,ic},y[x],x],s_Solve:>HoldForm[s]->s,TraceInternal->True]//Flatten//Column

Mathematica graphics

Fyi, report to WRI as suggedted. [CASE:4956902]


This ode is similar to one here but for some reason DSolve could not able to solve this. This ode is from a textbook

My question is: What is the reason it can't solve this since it is similar to the one in the above link, and any workaround to make DSolve solve this one?

I solved by hand below as well. I used the Trace commands by Michael E2 from the above answer, but it did not help me figure where it went wrong and I am not good at internal tracing of Mathematica functions.

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]
(* {} *)

The solution it should have given is y[x]->-Log[4-x] as shown below.

Verification of solution

mysol = y -> Function[{x}, -Log[4 - x]]
ode /. mysol

Mathematica graphics

ic/.mysol

Mathematica graphics

Hand solution

\begin{align*} y^{\prime\prime} & =y^{\prime}e^{y}\\ y\left( 3\right) & =0\\ y^{\prime}\left( 3\right) & =1 \end{align*} Let $p=y^{\prime}$, then $y^{\prime\prime}=\frac{dp}{dx}=\frac{dp}{dy}\frac{dy}{dx}=\frac{dp}{dy}p$. The ode becomes \begin{align*} \frac{dp}{dy}p & =pe^{y}\\ \frac{dp}{dy} & =e^{y} \end{align*} Which has the solution \begin{equation} p=e^{y}+c_{1}\tag{1}% \end{equation} Using initial conditions given by $p\left( 3\right) =1,y\left( 3\right) =0$ the above becomes $$ 1=1+c_{1} $$ Hence $c_{1}=0$ and the solution (1) simplifies to \begin{align*} p & =e^{y}\\ \frac{dy}{dx} & =e^{y} \end{align*} This is separable. $$ e^{-y}dy=dx $$ Integrating gives \begin{equation} -e^{-y}=x+c_{2}\tag{2} \end{equation} But $y\left( 3\right) =0$, hence $$ -1=3+c_{2} $$ Therefore $c_{2}=-4$ and (2) becomes \begin{align*} -e^{-y} & =x-4\\ e^{-y} & =4-x\\ -y & =\ln\left( 4-x\right) \\ y & =-\ln\left( 4-x\right) \end{align*}

Attempt at Tracing using Michael E2's code

ClearAll[y,x];
ode=y''[x]==y'[x]*Exp[y[x]];
ic={y[3]==0,y'[3]==1};
Trace[DSolve[{ode,ic},y[x],x],s_Solve:>HoldForm[s]->s,TraceInternal->True]//Flatten//Column

Mathematica graphics

Tweeted twitter.com/StackMma/status/1553847983904620550
Source Link
Nasser
  • 147.3k
  • 12
  • 156
  • 364

Why is DSolve unable to solve this second order ode with initial conditions? Any workaround?

This ode is similar to one here but for some reason DSolve could not able to solve this. This ode is from a textbook

My question is: What is the reason it can't solve this since it is similar to the one in the above link, and any workaround to make DSolve solve this one?

I solved by hand below as well. I used the Trace commands by Michael E2 from the above answer, but it did not help me figure where it went wrong and I am not good at internal tracing of Mathematica functions.

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]
(* {} *)

The solution it should have given is y[x]->-Log[4-x] as shown below.

Verification of solution

mysol = y -> Function[{x}, -Log[4 - x]]
ode /. mysol

Mathematica graphics

ic/.mysol

Mathematica graphics

Hand solution

\begin{align*} y^{\prime\prime} & =y^{\prime}e^{y}\\ y\left( 3\right) & =0\\ y^{\prime}\left( 3\right) & =1 \end{align*} Let $p=y^{\prime}$, then $y^{\prime\prime}=\frac{dp}{dx}=\frac{dp}{dy}\frac{dy}{dx}=\frac{dp}{dy}p$. The ode becomes \begin{align*} \frac{dp}{dy}p & =pe^{y}\\ \frac{dp}{dy} & =e^{y} \end{align*} Which has the solution \begin{equation} p=e^{y}+c_{1}\tag{1}% \end{equation} Using initial conditions given by $p\left( 3\right) =1,y\left( 3\right) =0$ the above becomes $$ 1=1+c_{1} $$ Hence $c_{1}=0$ and the solution (1) simplifies to \begin{align*} p & =e^{y}\\ \frac{dy}{dx} & =e^{y} \end{align*} This is separable. $$ e^{-y}dy=dx $$ Integrating gives \begin{equation} -e^{-y}=x+c_{2}\tag{2} \end{equation} But $y\left( 3\right) =0$, hence $$ -1=3+c_{2} $$ Therefore $c_{2}=-4$ and (2) becomes \begin{align*} -e^{-y} & =x-4\\ e^{-y} & =4-x\\ -y & =\ln\left( 4-x\right) \\ y & =-\ln\left( 4-x\right) \end{align*}

Attempt at Tracing using Michael E2's code

ClearAll[y,x];
ode=y''[x]==y'[x]*Exp[y[x]];
ic={y[3]==0,y'[3]==1};
Trace[DSolve[{ode,ic},y[x],x],s_Solve:>HoldForm[s]->s,TraceInternal->True]//Flatten//Column

Mathematica graphics