Cette deuxième solution à cet ODE est-elle correcte?

Dec 25 2020

Mathematica V 12.2 sous Windows 10. J'utilisais Mathematica pour vérifier ma solution pour cet ODE. Mathematica donne 2 solutions. Une idée d'où vient la deuxième solution? et est-ce correct?

Voici ma solution et la solution de 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]}} *)

Seule la deuxième solution vérifie. Et c'est ce que j'ai obtenu aussi. La question est: comment Mathematica a-t-il obtenu le premier ci-dessus?

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

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

Ma solution: l'ODE $$ \frac{ \mathop{\mathrm{d}y}}{\mathop{\mathrm{d}x}} = 2 \sqrt{y +1}\, \cos \left(x \right) $$est séparable. D'où
\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*} Les conditions initiales sont maintenant utilisées pour résoudre $c_{1}$. Substituer$x=\pi$ et $y=0$ dans la solution ci-dessus donne une équation à résoudre pour la constante d'intégration. \begin{align*} \sqrt{1} &= c_{1} \end{align*} Mais $\sqrt{1}=1$, prenant la racine principale. Par conséquent\begin{align*} c_1 &= 1 \end{align*} Substituer $c_{1}$ trouvé ci-dessus dans la solution générale donne $$ \sqrt{y \left(x \right)+1} = \sin \left(x \right)+1 $$ Résoudre pour $y \left(x \right)$ donne \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*}

De ce qui précède, je vois que Mathematica doit avoir obtenu deux solutions pour $c_1$ comme $\pm 1$ en prenant $\sqrt 1$.

Ce n'est qu'alors qu'il obtiendra ces deux solutions. Lorsque$c_1 = -1$, la première solution qu'il montre sortira. Et quand$c_1= 1$, la deuxième solution sortira.

La première solution de Mathematica est-elle correcte? Mathematica aurait-il seulement obtenu$c_1 = 1$ et pas $c_1 = \pm 1$?

Réponses

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 *)