72.5.31 problem 27

Internal problem ID [14638]
Book : DIFFERENTIAL EQUATIONS by Paul Blanchard, Robert L. Devaney, Glen R. Hall. 4th edition. Brooks/Cole. Boston, USA. 2012
Section : Chapter 1. First-Order Differential Equations. Exercises section 1.6 page 89
Problem number : 27
Date solved : Thursday, March 13, 2025 at 04:11:27 AM
CAS classification : [_quadrature]

\begin{align*} y^{\prime }&=y^{2}-4 y+2 \end{align*}

With initial conditions

\begin{align*} y \left (3\right )&=1 \end{align*}

Maple. Time used: 0.158 (sec). Leaf size: 32
ode:=diff(y(t),t) = y(t)^2-4*y(t)+2; 
ic:=y(3) = 1; 
dsolve([ode,ic],y(t), singsol=all);
 
\[ y = 2-\sqrt {2}\, \tanh \left (\frac {\left (\sqrt {2}\, \operatorname {arctanh}\left (\frac {\sqrt {2}}{2}\right )+2 t -6\right ) \sqrt {2}}{2}\right ) \]
Mathematica. Time used: 0.053 (sec). Leaf size: 69
ode=D[y[t],t]==y[t]^2-4*y[t]+2; 
ic={y[3]==1}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \frac {\sqrt {2} \left (e^{2 \sqrt {2} t}+e^{6 \sqrt {2}}\right )}{\left (1+\sqrt {2}\right ) e^{2 \sqrt {2} t}+\left (\sqrt {2}-1\right ) e^{6 \sqrt {2}}} \]
Sympy. Time used: 0.467 (sec). Leaf size: 80
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-y(t)**2 + 4*y(t) + Derivative(y(t), t) - 2,0) 
ics = {y(3): 1} 
dsolve(ode,func=y(t),ics=ics)
 
\[ t - \frac {\sqrt {2} \log {\left (y{\left (t \right )} - 2 - \sqrt {2} \right )}}{4} + \frac {\sqrt {2} \log {\left (y{\left (t \right )} - 2 + \sqrt {2} \right )}}{4} = - \frac {\sqrt {2} \log {\left (1 + \sqrt {2} \right )}}{4} + \frac {\sqrt {2} \log {\left (-1 + \sqrt {2} \right )}}{4} + 3 - \frac {\sqrt {2} i \pi }{4} \]