14.18.5 problem 5

Internal problem ID [2689]
Book : Differential equations and their applications, 4th ed., M. Braun
Section : Chapter 2. Second order differential equations. Section 2.11, Differential equations with discontinuous right-hand sides. Excercises page 243
Problem number : 5
Date solved : Monday, January 27, 2025 at 06:06:35 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y&=\left \{\begin {array}{cc} \cos \left (t \right ) & 0\le t <\frac {\pi }{2} \\ 0 & \frac {\pi }{2}\le t \end {array}\right . \end{align*}

Using Laplace method With initial conditions

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

Solution by Maple

Time used: 1.108 (sec). Leaf size: 40

dsolve([diff(y(t),t$2)+y(t)=piecewise(0<=t and t<Pi/2,cos(t),t>=Pi/2,0),y(0) = 3, D(y)(0) = -1],y(t), singsol=all)
 
\[ y = \frac {\left (\left \{\begin {array}{cc} 6 \cos \left (t \right )+\sin \left (t \right ) \left (t -2\right ) & t <\frac {\pi }{2} \\ \frac {\left (\pi -4\right ) \sin \left (t \right )}{2}+5 \cos \left (t \right ) & \frac {\pi }{2}\le t \end {array}\right .\right )}{2} \]

Solution by Mathematica

Time used: 0.048 (sec). Leaf size: 55

DSolve[{D[y[t],{t,2}]+y[t]==Piecewise[{{Cos[t],0<=t<Pi/2},{0,t>=Pi/2}}],{y[0]==3,Derivative[1][y][0] ==-1}},y[t],t,IncludeSingularSolutions -> True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} 3 \cos (t)-\sin (t) & t\leq 0 \\ \frac {1}{4} (10 \cos (t)+(-4+\pi ) \sin (t)) & 2 t>\pi \\ 3 \cos (t)+\frac {1}{2} (t-2) \sin (t) & \text {True} \\ \end {array} \\ \end {array} \]