20.12.15 problem Problem 34

Internal problem ID [3809]
Book : Differential equations and linear algebra, Stephen W. Goode and Scott A Annin. Fourth edition, 2015
Section : Chapter 8, Linear differential equations of order n. Section 8.10, Chapter review. page 575
Problem number : Problem 34
Date solved : Sunday, March 30, 2025 at 02:09:02 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 23
ode:=diff(diff(y(x),x),x)+y(x) = 4*cos(2*x)+3*exp(x); 
dsolve(ode,y(x), singsol=all);
 
\[ y = \sin \left (x \right ) c_2 +\cos \left (x \right ) c_1 -\frac {4 \cos \left (2 x \right )}{3}+\frac {3 \,{\mathrm e}^{x}}{2} \]
Mathematica. Time used: 0.02 (sec). Leaf size: 30
ode=D[y[x],{x,2}]+y[x]==4*Cos[x]*3*Exp[x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {12}{5} e^x (2 \sin (x)+\cos (x))+c_1 \cos (x)+c_2 \sin (x) \]
Sympy. Time used: 0.077 (sec). Leaf size: 27
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - 3*exp(x) - 4*cos(2*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 {3 e^{x}}{2} - \frac {4 \cos {\left (2 x \right )}}{3} \]