TransWikia.com

Question about DSolve (nonlinear ODE)

Mathematica Asked on March 3, 2021

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}=dxRightarrow intfrac{du}{u^2}=int dxRightarrow -frac{1}{u}=x+c
y'(0)=1rightarrow u(0)=1Rightarrow -frac{1}{0+c}=1Rightarrow c=-1
end{gather*}

Therefore
begin{gather*}
u=-frac{1}{x-1}Rightarrow frac{dy}{dx}=-frac{1}{x-1}Rightarrow intfrac{dy}{dx}=-intfrac{1}{x-1}Rightarrow y=-ln|x-1|+c_2
y(0)=1rightarrow 1=-ln(1)+c_2Rightarrow 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.

One Answer

Clear["Global`*"]

eqn = y''[x] == (y'[x])^2 && y[0] == 1 && y'[0] == 1;

sol = DSolve[eqn, y, {x, -∞, 1}][[1]]

(* Solve::incnst: Inconsistent or redundant transcendental equation. After reduction, the bad equation is 1+Subscript[[ConstantC], 1] == 0.

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

Verifying Mathematica's solution,

eqn /. sol

(* True *)

Since x < 1, this is equivalent to your hand-derived solution

sol2 = Log[Abs[x - 1]^-1] + 1;

(y[x] /. sol) == sol2 // Simplify[#, x < 1] &

(* True *)

Correct answer by Bob Hanlon on March 3, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP