20.7.3 problem Problem 27

Internal problem ID [3718]
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.3, The Method of Undetermined Coefficients. page 525
Problem number : Problem 27
Date solved : Tuesday, March 04, 2025 at 05:08:17 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.003 (sec). Leaf size: 21
ode:=diff(diff(y(x),x),x)+4*y(x) = 8*sin(2*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \left (c_{1} -2 x \right ) \cos \left (2 x \right )+\sin \left (2 x \right ) c_{2} \]
Mathematica. Time used: 0.031 (sec). Leaf size: 29
ode=D[y[x],{x,2}]+4*y[x]==8*Sin[2*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \sin (x) \cos (x)+(-2 x+c_1) \cos (2 x)+c_2 \sin (2 x) \]
Sympy. Time used: 0.092 (sec). Leaf size: 19
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(4*y(x) - 8*sin(2*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \sin {\left (2 x \right )} + \left (C_{1} - 2 x\right ) \cos {\left (2 x \right )} \]