44.3.22 problem 30

Internal problem ID [7003]
Book : A First Course in Differential Equations with Modeling Applications by Dennis G. Zill. 12 ed. Metric version. 2024. Cengage learning.
Section : Chapter 1. Introduction to differential equations. Review problems at page 34
Problem number : 30
Date solved : Sunday, March 30, 2025 at 11:33:40 AM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.004 (sec). Leaf size: 55
ode:=diff(diff(y(x),x),x)+y(x) = exp(x^2); 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {\sqrt {\pi }\, {\mathrm e}^{\frac {1}{4}} \left (i \sin \left (x \right )-\cos \left (x \right )\right ) \operatorname {erf}\left (i x -\frac {1}{2}\right )}{4}-\frac {\left (i \sin \left (x \right )+\cos \left (x \right )\right ) \sqrt {\pi }\, {\mathrm e}^{\frac {1}{4}} \operatorname {erf}\left (i x +\frac {1}{2}\right )}{4}+\cos \left (x \right ) c_1 +\sin \left (x \right ) c_2 \]
Mathematica. Time used: 0.059 (sec). Leaf size: 80
ode=D[y[x],{x,2}]+y[x]==Exp[x^2]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to -\frac {1}{4} \sqrt [4]{e} \sqrt {\pi } \left (\text {erf}\left (\frac {1}{2}-i x\right ) \cos (x)+\text {erf}\left (\frac {1}{2}+i x\right ) (\cos (x)+i \sin (x))-\text {erfi}\left (\frac {1}{2} (2 x+i)\right ) \sin (x)\right )+c_1 \cos (x)+c_2 \sin (x) \]
Sympy. Time used: 3.720 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(y(x) - exp(x**2) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \left (C_{1} - \int e^{x^{2}} \sin {\left (x \right )}\, dx\right ) \cos {\left (x \right )} + \left (C_{2} + \int e^{x^{2}} \cos {\left (x \right )}\, dx\right ) \sin {\left (x \right )} \]