58.1.38 problem 38

Internal problem ID [9109]
Book : Second order enumerated odes
Section : section 1
Problem number : 38
Date solved : Wednesday, March 05, 2025 at 07:24:01 AM
CAS classification : [[_2nd_order, _missing_x]]

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

Maple. Time used: 0.003 (sec). Leaf size: 14
ode:=diff(diff(y(x),x),x)+y(x) = 1; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \cos \left (x \right ) c_{1} +\sin \left (x \right ) c_{2} +1 \]
Mathematica. Time used: 0.012 (sec). Leaf size: 17
ode=D[y[x],{x,2}]+y[x]==1; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to c_1 \cos (x)+c_2 \sin (x)+1 \]
Sympy. Time used: 0.059 (sec). Leaf size: 14
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) + Derivative(y(x), (x, 2)) - 1,0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{1} \sin {\left (x \right )} + C_{2} \cos {\left (x \right )} + 1 \]