69.18.1 problem 590

Internal problem ID [18376]
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. Initial value problem. Exercises page 140
Problem number : 590
Date solved : Thursday, October 02, 2025 at 03:11:07 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

With initial conditions

\begin{align*} y \left (0\right )&=2 \\ y^{\prime }\left (0\right )&=-2 \\ \end{align*}
Maple. Time used: 0.014 (sec). Leaf size: 9
ode:=diff(diff(y(x),x),x)+y(x) = -2*x+2; 
ic:=[y(0) = 2, D(y)(0) = -2]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = 2-2 x \]
Mathematica. Time used: 0.008 (sec). Leaf size: 10
ode=D[y[x],{x,2}]+y[x]==2*(1-x); 
ic={y[0]==2,Derivative[1][y][0] ==-2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to 2-2 x \end{align*}
Sympy. Time used: 0.037 (sec). Leaf size: 7
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x + y(x) + Derivative(y(x), (x, 2)) - 2,0) 
ics = {y(0): 2, Subs(Derivative(y(x), x), x, 0): -2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = 2 - 2 x \]