88.22.14 problem 18

Internal problem ID [24174]
Book : Elementary Differential Equations. By Lee Roy Wilcox and Herbert J. Curtis. 1961 first edition. International texbook company. Scranton, Penn. USA. CAT number 61-15976
Section : Chapter 5. Special Techniques for Linear Equations. Exercises at page 160 (Laplace transform)
Problem number : 18
Date solved : Thursday, October 02, 2025 at 10:00:27 PM
CAS classification : [[_2nd_order, _with_linear_symmetries]]

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

Using Laplace method With initial conditions

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