Questa seconda soluzione a questa ODE è corretta?

Dec 25 2020

Mathematica V 12.2 su Windows 10. Stavo usando Mathematica per verificare la mia soluzione per questo ODE. Mathematica fornisce 2 soluzioni. Qualche idea da dove provenga la seconda soluzione? ed è corretto?

Ecco la mia soluzione e la soluzione di Mathematica

ClearAll[y, x];
ode = y'[x] == 2*Sqrt[1 + y[x]]*Cos[x];
sol = DSolve[{ode, {y[Pi] == 0}}, y, x]

 (* {{y->Function[{x},-2 Sin[x]+Sin[x]^2]},{y->Function[{x},2 Sin[x]+Sin[x]^2]}} *)

Solo la seconda soluzione verifica. Ed è anche quello che ho ottenuto. La domanda è: come ha fatto Mathematica ad ottenere il primo sopra?

Assuming[Element[x, Reals], Simplify@(ode /. sol[[1]])]
  (* Cos[x] Sin[x] == Cos[x] *)

Assuming[Element[x, Reals], Simplify@(ode /. sol[[2]])]
   (* True *)

La mia soluzione: l'ODE $$ \frac{ \mathop{\mathrm{d}y}}{\mathop{\mathrm{d}x}} = 2 \sqrt{y +1}\, \cos \left(x \right) $$è separabile. Quindi
\begin{align*} \left(\frac{1}{2 \sqrt{y +1}}\right)\mathop{\mathrm{d}y}&= \cos \left(x \right)\mathop{\mathrm{d}x}\\ \int \left(\frac{1}{2 \sqrt{y +1}}\right)\mathop{\mathrm{d}y}&= \int \cos \left(x \right)\mathop{\mathrm{d}x}\\ \sqrt{y +1} &= c_{1}+\sin \left(x \right) \end{align*} Le condizioni iniziali vengono ora utilizzate per risolvere $c_{1}$. Sostituzione$x=\pi$ e $y=0$ nella soluzione precedente fornisce un'equazione da risolvere per la costante di integrazione. \begin{align*} \sqrt{1} &= c_{1} \end{align*} Ma $\sqrt{1}=1$, prendendo la radice principale. Perciò\begin{align*} c_1 &= 1 \end{align*} Sostituzione $c_{1}$ trovato sopra nella soluzione generale dà $$ \sqrt{y \left(x \right)+1} = \sin \left(x \right)+1 $$ Risolvendo per $y \left(x \right)$\begin{align*} y(x)+1 &= (1+\sin(x))^2 \\ y(x)+1 &= (1+\sin^2(x)+2 \sin(x)) \\ y(x) &= \sin^{2}x +2 \sin(x) \end{align*}

Da quanto sopra, vedo che Mathematica deve aver ottenuto due soluzioni per $c_1$ come $\pm 1$ durante l'assunzione $\sqrt 1$.

Solo allora otterrà queste due soluzioni. Per quando$c_1 = -1$, la prima soluzione che mostra verrà fuori. E quando$c_1= 1$, verrà fuori la seconda soluzione.

La prima soluzione di Mathematica è corretta? Mathematica avrebbe dovuto ottenere solo quello$c_1 = 1$ e non $c_1 = \pm 1$?

Risposte

Vixillator Dec 27 2020 at 09:34
ClearAll[y, x, ode, sol];

(* The given equation ode is a non-linear (quadratic) ODE, which yields two 
   solutions, as expected. Since both solutions satisfy the ODE they are both correct.
   Note that the ODE is equivalent to: y'[x]^2 == 4*(1 + y[x])*Cos[x]^2 *)

ode = y'[x] == 2*Sqrt[1 + y[x]]*Cos[x];
sol = DSolve[{ode, {y[Pi] == 0}}, y[x], x]

(* OUT: {{y[x] -> -2 Sin[x] + Sin[x]^2}, {y[x] -> 2 Sin[x] + Sin[x]^2}} *)

(* In order to obtain a single solution, we need to reduce the ODE to
a quasi-linear ODE, by defining an auxiliary boundary condition, say
at x=0, that will constrain the solution to the one that we seek *)

bcNew = ode /. x -> 0

(* OUT: y'[0] == 2 Sqrt[1 + y[0]] *)

solNew = DSolve[{ode, y[Pi] == 0 && bcNew}, y[x], x]

(* OUT: {{y[x] -> 2 Sin[x] + Sin[x]^2}} *)

(* QED *)