66.2.42 problem Problem 57

Internal problem ID [13870]
Book : Differential equations and the calculus of variations by L. ElSGOLTS. MIR PUBLISHERS, MOSCOW, Third printing 1977.
Section : Chapter 2, DIFFERENTIAL EQUATIONS OF THE SECOND ORDER AND HIGHER. Problems page 172
Problem number : Problem 57
Date solved : Monday, March 31, 2025 at 08:15:42 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.002 (sec). Leaf size: 25
ode:=diff(diff(y(x),x),x)+y(x) = sin(3*x)*cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 -\frac {\sin \left (2 x \right )}{6}-\frac {\sin \left (4 x \right )}{30} \]
Mathematica. Time used: 0.127 (sec). Leaf size: 30
ode=D[y[x],{x,2}]+y[x]==Sin[3*x]*Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 \cos (x)-\frac {1}{15} \sin (x) (6 \cos (x)+\cos (3 x)-15 c_2) \]
Sympy. Time used: 0.559 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - sin(3*x)*cos(x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} - \frac {\sin {\left (2 x \right )}}{6} - \frac {\sin {\left (4 x \right )}}{30} \]