75.17.26 problem 576

Internal problem ID [16996]
Book : A book of problems in ordinary differential equations. M.L. KRASNOV, A.L. KISELYOV, G.I. MARKARENKO. MIR, MOSCOW. 1983
Section : Chapter 2 (Higher order ODEs). Section 15.3 Nonhomogeneous linear equations with constant coefficients. Superposition principle. Exercises page 137
Problem number : 576
Date solved : Thursday, March 13, 2025 at 09:07:09 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.006 (sec). Leaf size: 26
ode:=diff(diff(y(x),x),x)-2*diff(y(x),x)+2*y(x) = exp(x)*sin(1/2*x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {\left (\left (-4 c_{1} +\frac {1}{2}\right ) \cos \left (x \right )-2+\left (x -4 c_{2} \right ) \sin \left (x \right )\right ) {\mathrm e}^{x}}{4} \]
Mathematica. Time used: 0.081 (sec). Leaf size: 67
ode=D[y[x],{x,2}]-2*D[y[x],x]+2*y[x]==Exp[x]*Sin[x/2]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to e^x \left (\cos (x) \int _1^x-\sin ^2\left (\frac {K[2]}{2}\right ) \sin (K[2])dK[2]+\sin (x) \int _1^x\cos (K[1]) \sin ^2\left (\frac {K[1]}{2}\right )dK[1]+c_2 \cos (x)+c_1 \sin (x)\right ) \]
Sympy. Time used: 0.823 (sec). Leaf size: 22
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*y(x) - exp(x)*sin(x/2)**2 - 2*Derivative(y(x), x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{2} \cos {\left (x \right )} + \left (C_{1} - \frac {x}{4}\right ) \sin {\left (x \right )} + \frac {1}{2}\right ) e^{x} \]