73.21.6 problem 30.10 (a)

Internal problem ID [15546]
Book : Ordinary Differential Equations. An introduction to the fundamentals. Kenneth B. Howell. second edition. CRC Press. FL, USA. 2020
Section : Chapter 30. Piecewise-defined functions and periodic functions. Additional Exercises. page 553
Problem number : 30.10 (a)
Date solved : Thursday, March 13, 2025 at 06:11:13 AM
CAS classification : [_quadrature]

\begin{align*} y^{\prime }&=\left \{\begin {array}{cc} 0 & t <1 \\ 1 & 1<t <3 \\ 0 & 3<t \end {array}\right . \end{align*}

Using Laplace method With initial conditions

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

Maple. Time used: 10.011 (sec). Leaf size: 19
ode:=diff(y(t),t) = piecewise(t < 1,0,1 < t and t < 3,1,3 < t,0); 
ic:=y(0) = 0; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = \left \{\begin {array}{cc} 0 & t <1 \\ t -1 & t <3 \\ 2 & 3\le t \end {array}\right . \]
Mathematica. Time used: 0.007 (sec). Leaf size: 23
ode=D[y[t],t]==Piecewise[{ {0,t<1},{1,1<t<3},{0,t>3}}]; 
ic={y[0]==0}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} 0 & t\leq 1 \\ t-1 & 1<t\leq 3 \\ 2 & \text {True} \\ \end {array} \\ \end {array} \]
Sympy. Time used: 0.142 (sec). Leaf size: 7
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(-Piecewise((0, t < 1), (1, (t > 1) & (t < 3)), (0, t > 3)) + Derivative(y(t), t),0) 
ics = {y(0): 0} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = \begin {cases} 0 & \text {for}\: t < 1 \\t - 1 & \text {for}\: t < 3 \\2 & \text {otherwise} \end {cases} \]