14.18.4 problem 4

Internal problem ID [2688]
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 : 4
Date solved : Monday, January 27, 2025 at 06:06:34 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Using Laplace method With initial conditions

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

Solution by Maple

Time used: 1.050 (sec). Leaf size: 41

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

Solution by Mathematica

Time used: 0.065 (sec). Leaf size: 54

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