83.44.14 problem Ex 14 page 48

Internal problem ID [19471]
Book : A Text book for differentional equations for postgraduate students by Ray and Chaturvedi. First edition, 1958. BHASKAR press. INDIA
Section : Book Solved Excercises. Chapter III. Ordinary linear differential equations with constant coefficients
Problem number : Ex 14 page 48
Date solved : Monday, March 31, 2025 at 07:19:38 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

\begin{align*} y^{\prime \prime }+a^{2} y&=\cos \left (a x \right ) \end{align*}

Maple. Time used: 0.006 (sec). Leaf size: 29
ode:=diff(diff(y(x),x),x)+a^2*y(x) = cos(a*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\left (2 c_2 a +x \right ) \sin \left (a x \right )+2 \cos \left (a x \right ) c_1 a}{2 a} \]
Mathematica. Time used: 0.032 (sec). Leaf size: 41
ode=D[y[x],{x,2}]+a^2*y[x]==Cos[a*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {\left (1+4 a^2 c_1\right ) \cos (a x)+2 a (x+2 a c_2) \sin (a x)}{4 a^2} \]
Sympy. Time used: 0.124 (sec). Leaf size: 29
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(a**2*y(x) - cos(a*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- i a x} + C_{2} e^{i a x} + \frac {x \sin {\left (a x \right )}}{2 a} \]