84.44.8 problem 37.19

Internal problem ID [22405]
Book : Schaums outline series. Differential Equations By Richard Bronson. 1973. McGraw-Hill Inc. ISBN 0-07-008009-7
Section : Chapter 37. Second Order Boundary Value Problems. Supplementary problems
Problem number : 37.19
Date solved : Thursday, October 02, 2025 at 08:38:23 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

With initial conditions

\begin{align*} y \left (\frac {\pi }{2}\right )&=\frac {\pi }{2} \\ y^{\prime }\left (0\right )&=1 \\ \end{align*}
Maple. Time used: 0.009 (sec). Leaf size: 10
ode:=diff(diff(y(x),x),x)+y(x) = x; 
ic:=[y(1/2*Pi) = 1/2*Pi, D(y)(0) = 1]; 
dsolve([ode,op(ic)],y(x), singsol=all);
 
\[ y = \cos \left (x \right ) c_1 +x \]
Mathematica. Time used: 0.036 (sec). Leaf size: 12
ode=D[y[x],{x,2}]+y[x]==x; 
ic={y[Pi/2]==Pi/2,Derivative[1][y][0] ==1}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to x+c_1 \cos (x) \end{align*}
Sympy. Time used: 0.035 (sec). Leaf size: 8
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(-x + y(x) + Derivative(y(x), (x, 2)),0) 
ics = {y(pi/2): pi/2, Subs(Derivative(y(x), x), x, 0): 1} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} \cos {\left (x \right )} + x \]