I try to solve the following IVP (found in a textbook): $\frac{d^2y}{dx^2}=\left(\frac{dy}{dx}\right)^2$ with $y(0)=1$ and $y'(0)=1$. I use reduction of order. Say $u=\frac{dy}{dx}$. Thus $\frac{du}{dx}=u^2$. This is a separable equation \begin{gather*} \frac{du}{u^2}=dx\Rightarrow \int\frac{du}{u^2}=\int dx\Rightarrow -\frac{1}{u}=x+c\\ y'(0)=1\rightarrow u(0)=1\Rightarrow -\frac{1}{0+c}=1\Rightarrow c=-1 \end{gather*} Therefore \begin{gather*} u=-\frac{1}{x-1}\Rightarrow \frac{dy}{dx}=-\frac{1}{x-1}\Rightarrow \int\frac{dy}{dx}=-\int\frac{1}{x-1}\Rightarrow y=-\ln|x-1|+c_2\\ y(0)=1\rightarrow 1=-\ln(1)+c_2\Rightarrow c_2=1 \end{gather*} and the solution of the IVP is $y=\ln|x-1|^{-1}+1$. I tried to verify the obtained solution with Mathematica's DSolve. I got
DSolve[(y^′′)[x] == Derivative[1][y][x]^2 &&
y[0] == 1 && Derivative[1][y][0] == 1, y[x], {x, -∞, 1}]
During evaluation of Solve::incnst: Inconsistent or redundant transcendental equation. After reduction, the bad equation is 1+Subscript[\[ConstantC], 1] == 0.
(* {{y[x] -> 1 - Log[1 - x]}} *)
DSolve[(y^′′)[x] == Derivative[1][y][x]^2 &&
y[0] == 1 && Derivative[1][y][0] == 1, y[x], {x, 1, ∞}]
During evaluation of Solve::incnst: Inconsistent or redundant transcendental equation. After reduction, the bad equation is 1+Subscript[\[ConstantC], 1] == 0.
(* {{y[x] -> 1 + I π - Log[-1 + x]}} *)
How can one force Mathematica to provide the solution found by hand? Thanks in advance.
Log[z]
with a particular branch chosen so thatLog[-1] == I*Pi
. $\endgroup$