20.22.1 problem Problem 27

Internal problem ID [3956]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 10, The Laplace Transform and Some Elementary Applications. Exercises for 10.7. page 704
Problem number : Problem 27
Date solved : Tuesday, March 04, 2025 at 05:20:01 PM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+2 y&=2 \operatorname {Heaviside}\left (t -1\right ) \end{align*}

Using Laplace method With initial conditions

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

Maple. Time used: 3.553 (sec). Leaf size: 25
ode:=diff(y(t),t)+2*y(t) = 2*Heaviside(t-1); 
ic:=y(0) = 1; 
dsolve([ode,ic],y(t),method='laplace');
 
\[ y = -\operatorname {Heaviside}\left (-1+t \right ) {\mathrm e}^{2-2 t}+\operatorname {Heaviside}\left (-1+t \right )+{\mathrm e}^{-2 t} \]
Mathematica. Time used: 0.048 (sec). Leaf size: 26
ode=D[y[t],t]-y[t]==2*UnitStep[t-1]; 
ic={y[0]==1}; 
DSolve[{ode,ic},y[t],t,IncludeSingularSolutions->True]
 
\[ y(t)\to \begin {array}{cc} \{ & \begin {array}{cc} e^t & t\leq 1 \\ -2+2 e^{t-1}+e^t & \text {True} \\ \end {array} \\ \end {array} \]
Sympy. Time used: 0.525 (sec). Leaf size: 29
from sympy import * 
t = symbols("t") 
y = Function("y") 
ode = Eq(2*y(t) - 2*Heaviside(t - 1) + Derivative(y(t), t),0) 
ics = {y(0): 1} 
dsolve(ode,func=y(t),ics=ics)
 
\[ y{\left (t \right )} = - e^{2 - 2 t} \theta \left (t - 1\right ) + \theta \left (t - 1\right ) + e^{- 2 t} \]