32.6.20 problem Exercise 12.20, page 103

Internal problem ID [5885]
Book : Ordinary Differential Equations, By Tenenbaum and Pollard. Dover, NY 1963
Section : Chapter 2. Special types of differential equations of the first kind. Lesson 12, Miscellaneous Methods
Problem number : Exercise 12.20, page 103
Date solved : Sunday, March 30, 2025 at 10:23:44 AM
CAS classification : [[_linear, `class A`]]

\begin{align*} y^{\prime }+a y&=b \sin \left (k x \right ) \end{align*}

Maple. Time used: 0.002 (sec). Leaf size: 38
ode:=diff(y(x),x)+a*y(x) = b*sin(k*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-a x} c_1 -\frac {b \left (k \cos \left (k x \right )-\sin \left (k x \right ) a \right )}{a^{2}+k^{2}} \]
Mathematica. Time used: 0.077 (sec). Leaf size: 40
ode=D[y[x],x]+a*y[x]==b*Sin[k*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {b (a \sin (k x)-k \cos (k x))}{a^2+k^2}+c_1 e^{-a x} \]
Sympy. Time used: 0.155 (sec). Leaf size: 39
from sympy import * 
x = symbols("x") 
a = symbols("a") 
b = symbols("b") 
k = symbols("k") 
y = Function("y") 
ode = Eq(a*y(x) - b*sin(k*x) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- a x} + \frac {a b \sin {\left (k x \right )}}{a^{2} + k^{2}} - \frac {b k \cos {\left (k x \right )}}{a^{2} + k^{2}} \]