14.18.7 problem 7

Internal problem ID [2691]
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 : 7
Date solved : Monday, March 31, 2025 at 09:59:32 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+y^{\prime }+7 y&=\left \{\begin {array}{cc} t & 0\le t <2 \\ 0 & 2\le t \end {array}\right . \end{align*}

Using Laplace method With initial conditions

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

Maple. Time used: 0.499 (sec). Leaf size: 135
ode:=diff(diff(y(t),t),t)+diff(y(t),t)+7*y(t) = piecewise(0 <= t and t < 2,t,2 <= t,0); 
ic:=y(0) = 0, D(y)(0) = 0; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = -\frac {\left (\left \{\begin {array}{cc} 13 \sqrt {3}\, \sin \left (\frac {3 \sqrt {3}\, t}{2}\right ) {\mathrm e}^{-\frac {t}{2}}-9 \cos \left (\frac {3 \sqrt {3}\, t}{2}\right ) {\mathrm e}^{-\frac {t}{2}}-63 t +9 & t <2 \\ \left (13 \sqrt {3}\, \sin \left (3 \sqrt {3}\right )-234 \,{\mathrm e}-9 \cos \left (3 \sqrt {3}\right )\right ) {\mathrm e}^{-1} & t =2 \\ {\mathrm e}^{-\frac {t}{2}} \left (-27 \sqrt {3}\, {\mathrm e} \sin \left (\frac {3 \sqrt {3}\, \left (t -2\right )}{2}\right )+13 \sqrt {3}\, \sin \left (\frac {3 \sqrt {3}\, t}{2}\right )-117 \,{\mathrm e} \cos \left (\frac {3 \sqrt {3}\, \left (t -2\right )}{2}\right )-9 \cos \left (\frac {3 \sqrt {3}\, t}{2}\right )\right ) & 2<t \end {array}\right .\right )}{441} \]
Mathematica. Time used: 0.088 (sec). Leaf size: 153
ode=D[y[t],{t,2}]+D[y[t],t]+7*y[t]==Piecewise[{{t,0<=t<2},{0,t>=2}}]; 
ic={y[0]==0,Derivative[1][y][0] ==0}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} \frac {1}{441} e^{-t/2} \left (9 e^{t/2} (7 t-1)+9 \cos \left (\frac {3 \sqrt {3} t}{2}\right )-13 \sqrt {3} \sin \left (\frac {3 \sqrt {3} t}{2}\right )\right ) & 0<t\leq 2 \\ \frac {1}{441} e^{-t/2} \left (117 e \cos \left (\frac {3}{2} \sqrt {3} (t-2)\right )+9 \cos \left (\frac {3 \sqrt {3} t}{2}\right )+\sqrt {3} \left (27 e \sin \left (\frac {3}{2} \sqrt {3} (t-2)\right )-13 \sin \left (\frac {3 \sqrt {3} t}{2}\right )\right )\right ) & t>2 \\ \end {array} \\ \end {array} \]
Sympy
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-Piecewise((t, (t >= 0) & (t < 2)), (0, t >= 2)) + 7*y(t) + Derivative(y(t), t) + Derivative(y(t), (t, 2)),0) 
ics = {y(0): 0, Subs(Derivative(y(t), t), t, 0): 0} 
dsolve(ode,func=y(t),ics=ics)