74.21.2 problem 16

Internal problem ID [16640]
Book : INTRODUCTORY DIFFERENTIAL EQUATIONS. Martha L. Abell, James P. Braselton. Fourth edition 2014. ElScAe. 2014
Section : Chapter 5. Applications of Higher Order Equations. Exercises 5.3, page 249
Problem number : 16
Date solved : Tuesday, January 28, 2025 at 08:25:47 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

With initial conditions

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

Solution by Maple

Time used: 1.092 (sec). Leaf size: 21

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

Solution by Mathematica

Time used: 13.333 (sec). Leaf size: 83

DSolve[{D[x[t],{t,2}]+x[t]==Piecewise[{{Cos[t],0<=t<Pi},{0,t>=Pi}}],{x[0]==0,Derivative[1][x][0 ]==0}},x[t],t,IncludeSingularSolutions -> True]
 
\[ x(t)\to \sin (t) \left (\int _1^t\cos (K[1]) \left ( \begin {array}{cc} \{ & \begin {array}{cc} \cos (K[1]) & 0\leq K[1]<\pi \\ 0 & \text {True} \\ \end {array} \\ \end {array} \right )dK[1]-\int _1^0\cos (K[1]) \left ( \begin {array}{cc} \{ & \begin {array}{cc} \cos (K[1]) & 0\leq K[1]<\pi \\ 0 & \text {True} \\ \end {array} \\ \end {array} \right )dK[1]\right )+\cos (t) \left ( \begin {array}{cc} \{ & \begin {array}{cc} -\frac {1}{2} \sin ^2(t) & 0<t\leq \pi \\ 0 & \text {True} \\ \end {array} \\ \end {array} \right ) \]