8.11.6 problem 6

Internal problem ID [874]
Book : Differential equations and linear algebra, 3rd ed., Edwards and Penney
Section : Section 5.5, Nonhomogeneous equations and undetermined coefficients Page 351
Problem number : 6
Date solved : Tuesday, March 04, 2025 at 11:56:33 AM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

\begin{align*} 2 y^{\prime \prime }+4 y^{\prime }+7 y&=x^{2} \end{align*}

Maple. Time used: 0.001 (sec). Leaf size: 40
ode:=2*diff(diff(y(x),x),x)+4*diff(y(x),x)+7*y(x) = x^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{-x} \sin \left (\frac {\sqrt {10}\, x}{2}\right ) c_2 +{\mathrm e}^{-x} \cos \left (\frac {\sqrt {10}\, x}{2}\right ) c_1 +\frac {x^{2}}{7}-\frac {8 x}{49}+\frac {4}{343} \]
Mathematica. Time used: 0.025 (sec). Leaf size: 56
ode=2*D[y[x],{x,2}]+4*D[y[x],x]+7*y[x]==x^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {1}{343} \left (49 x^2-56 x+4\right )+c_2 e^{-x} \cos \left (\sqrt {\frac {5}{2}} x\right )+c_1 e^{-x} \sin \left (\sqrt {\frac {5}{2}} x\right ) \]
Sympy. Time used: 0.205 (sec). Leaf size: 42
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x**2 + 7*y(x) + 4*Derivative(y(x), x) + 2*Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x^{2}}{7} - \frac {8 x}{49} + \left (C_{1} \sin {\left (\frac {\sqrt {10} x}{2} \right )} + C_{2} \cos {\left (\frac {\sqrt {10} x}{2} \right )}\right ) e^{- x} + \frac {4}{343} \]