# Question:How to have Maple solve this simple ODE?

## Question:How to have Maple solve this simple ODE?

Maple 2021

The worksheet here shows a couple of failed attempts at coaxing Maple to calculate the general solution of a pretty simple second order ODE.  I have also included the expected solution which I  have calculated by hand.  Perhaps I am missing a key trick.  Any ideas?

The ODE that I am actually interested in is significantly more complex. The one in the worksheet is a much simplified "bare bones" specimen that exhibits the issue that I am facing.

Attempt to solve with Heaviside

 > restart;
 > de := diff(u(x),x\$2) = Heaviside(x - a)*u(x);

dsolve fails:

 > dsolve(de);

Attempt to solve with piecewise

 > restart;
 > de := diff(u(x),x\$2) = piecewise(x < a, 0, 1)*u(x);

 > dsolve(de);

Error, (in dsolve) give the main variable as a second argument

 > dsolve(de, u(x));

Error, (in dsolve) give the main variable as a second argument

 >
 >

The solution is easy to calculate by hand

We just solve the (quite trivial) DE over the intervals  and x>a

separately, and patch the two solutions by requiring the continuity

of  and  at .  We get

 > sol := piecewise(x < a,         x*c[1] + c[2],         ((a*c[1] + c[1] + c[2])*exp(x))/(2*exp(a)) + ((a*c[1] - c[1] + c[2])*exp(-x))/(2*exp(-a)));