20.7.17 problem Problem 46

Internal problem ID [3732]
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 46
Date solved : Sunday, March 30, 2025 at 02:06:46 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 28
ode:=diff(diff(y(x),x),x)+2*diff(y(x),x)-3*y(x) = sin(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-3 x} c_2 +{\mathrm e}^{x} c_1 -\frac {1}{6}-\frac {2 \sin \left (2 x \right )}{65}+\frac {7 \cos \left (2 x \right )}{130} \]
Mathematica. Time used: 0.089 (sec). Leaf size: 39
ode=D[y[x],{x,2}]+2*D[y[x],x]-3*y[x]==Sin[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {2}{65} \sin (2 x)+\frac {7}{130} \cos (2 x)+c_1 e^{-3 x}+c_2 e^x-\frac {1}{6} \]
Sympy. Time used: 0.623 (sec). Leaf size: 34
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-3*y(x) - sin(x)**2 + 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} e^{- 3 x} + C_{2} e^{x} - \frac {2 \sin {\left (2 x \right )}}{65} + \frac {7 \cos {\left (2 x \right )}}{130} - \frac {1}{6} \]