89.16.37 problem 37

Internal problem ID [24687]
Book : A short course in Differential Equations. Earl D. Rainville. Second edition. 1958. Macmillan Publisher, NY. CAT 58-5010
Section : Chapter 9. Nonhomogeneous Equations: Undetermined coefficients. Exercises at page 140
Problem number : 37
Date solved : Thursday, October 02, 2025 at 10:47:05 PM
CAS classification : [[_2nd_order, _missing_y]]

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

With initial conditions

\begin{align*} y \left (0\right )&=1 \\ y \left (1\right )&={\frac {1}{2}} \\ \end{align*}
Maple. Time used: 0.032 (sec). Leaf size: 30
ode:=diff(diff(y(x),x),x)+diff(y(x),x) = 1+x; 
ic:=[y(0) = 1, y(1) = 1/2]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \frac {x^{2}}{2}-\frac {{\mathrm e}^{-x}}{{\mathrm e}^{-1}-1}+\frac {1}{1-{\mathrm e}} \]
Mathematica. Time used: 0.029 (sec). Leaf size: 33
ode=D[y[x],{x,2}]+D[y[x],{x,1}]==  x+1; 
ic={y[0]==1,y[1]==1/2}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {-e x^2+x^2-2 e^{1-x}+2}{2-2 e} \end{align*}
Sympy. Time used: 0.098 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + Derivative(y(x), x) + Derivative(y(x), (x, 2)) - 1,0) 
ics = {y(0): 1, y(1): 1/2} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x^{2}}{2} - \frac {1}{-1 + e} + \frac {e e^{- x}}{-1 + e} \]