89.16.35 problem 35

Internal problem ID [24685]
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 : 35
Date solved : Thursday, October 02, 2025 at 10:47:03 PM
CAS classification : [[_2nd_order, _missing_x]]

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

With initial conditions

\begin{align*} y \left (\pi \right )&=0 \\ y^{\prime }\left (\pi \right )&=1 \\ \end{align*}
Maple. Time used: 0.013 (sec). Leaf size: 18
ode:=4*diff(diff(y(x),x),x)+y(x) = 2; 
ic:=[y(Pi) = 0, D(y)(Pi) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = -2 \sin \left (\frac {x}{2}\right )-2 \cos \left (\frac {x}{2}\right )+2 \]
Mathematica. Time used: 0.008 (sec). Leaf size: 21
ode=4*D[y[x],{x,2}]+y[x]== 2; 
ic={y[Pi]==0,Derivative[1][y][Pi] ==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to -2 \left (\sin \left (\frac {x}{2}\right )+\cos \left (\frac {x}{2}\right )-1\right ) \end{align*}
Sympy. Time used: 0.053 (sec). Leaf size: 17
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + 4*Derivative(y(x), (x, 2)) - 2,0) 
ics = {y(pi): 0, Subs(Derivative(y(x), x), x, pi): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = - 2 \sin {\left (\frac {x}{2} \right )} - 2 \cos {\left (\frac {x}{2} \right )} + 2 \]