44.3.15 problem 23

Internal problem ID [6996]
Book : A First Course in Differential Equations with Modeling Applications by Dennis G. Zill. 12 ed. Metric version. 2024. Cengage learning.
Section : Chapter 1. Introduction to differential equations. Review problems at page 34
Problem number : 23
Date solved : Sunday, March 30, 2025 at 11:33:26 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

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