49.11.1 problem 1(a)

Internal problem ID [7665]
Book : An introduction to Ordinary Differential Equations. Earl A. Coddington. Dover. NY 1961
Section : Chapter 2. Linear equations with constant coefficients. Page 93
Problem number : 1(a)
Date solved : Wednesday, March 05, 2025 at 04:49:55 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 21
ode:=diff(diff(y(x),x),x)+4*y(x) = cos(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (2 x \right ) c_{2} +\cos \left (2 x \right ) c_{1} +\frac {\cos \left (x \right )}{3} \]
Mathematica. Time used: 0.024 (sec). Leaf size: 26
ode=D[y[x],{x,2}]+4*y[x]==Cos[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {\cos (x)}{3}+c_1 \cos (2 x)+c_2 \sin (2 x) \]
Sympy. Time used: 0.098 (sec). Leaf size: 20
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(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 (2 x \right )} + C_{2} \cos {\left (2 x \right )} + \frac {\cos {\left (x \right )}}{3} \]