82.33.6 problem Ex. 6

Internal problem ID [18820]
Book : Introductory Course On Differential Equations by Daniel A Murray. Longmans Green and Co. NY. 1924
Section : Chapter VI. Linear equations with constant coefficients. Examples on chapter VI, page 80
Problem number : Ex. 6
Date solved : Thursday, March 13, 2025 at 01:00:02 PM
CAS classification : [[_2nd_order, _linear, _nonhomogeneous]]

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

Maple. Time used: 0.005 (sec). Leaf size: 72
ode:=diff(diff(y(x),x),x)-a^2*y(x) = exp(a*x)+exp(n*x); 
dsolve(ode,y(x), singsol=all);
 
\[ y \left (x \right ) = \frac {c_{2} \left (a^{4}-a^{2} n^{2}\right ) {\mathrm e}^{-a x}+\left (c_{1} a^{2}+\frac {1}{2} a x -\frac {1}{4}\right ) \left (a -n \right ) \left (a +n \right ) {\mathrm e}^{a x}-a^{2} {\mathrm e}^{n x}}{a^{4}-a^{2} n^{2}} \]
Mathematica. Time used: 0.128 (sec). Leaf size: 121
ode=D[y[x],{x,2}]-a^2*y[x]==Exp[a*x]+Exp[n*x]; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {e^{-a x} \left (4 a^4 \left (c_1 e^{2 a x}+c_2\right )+2 a^3 x e^{2 a x}-a^2 \left (e^{2 a x} \left (1+4 c_1 n^2\right )+4 e^{x (a+n)}+4 c_2 n^2\right )-2 a n^2 x e^{2 a x}+n^2 e^{2 a x}\right )}{4 a^2 (a-n) (a+n)} \]
Sympy. Time used: 0.149 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
a = symbols("a") 
n = symbols("n") 
y = Function("y") 
ode = Eq(-a**2*y(x) - exp(a*x) - exp(n*x) + Derivative(y(x), (x, 2)),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = C_{2} e^{- a x} + \left (C_{1} + \frac {x}{2 a}\right ) e^{a x} - \frac {e^{n x}}{a^{2} - n^{2}} \]