Say I have a very trivial function
$$ V\left(r\right)=\begin{cases} -V_{0} & 0\leq r\leq R\\ 0 & r>R \end{cases} $$ with $V_{0}>0$ and $R>0$. I would like to let Mathematica solve the differential equation
$$ u''\left(r\right)+k^{2}u\left(r\right)=V\left(r\right)u\left(r\right) $$
in the $r>0$ region with boundary conditions $u(0)=0$ and such that the solution and it's derivative match at $r=R$. Is there a simple way for this? A way generalizable to other piecewise functions? Using $k=1$ and $V_{0}=1$ I have attempted
DSolve[{u''[r] + u[r] (1 + UnitStep[1 - r]) == 0, u[0] == 0}, u[r], {r, 0, Infinity}]
I get no result, Mathematica just shows back my input.
Piecewise
to representV[r]
. Understand, though, thatDSolve
cannot solve all ODEs. $\endgroup$Piecewise
I get exactly the same problem. Since it's a very trivial equation, which has a simple analytic (piecewise) solution, I am hoping to get it withDSolve
. $\endgroup$DSolve[{u''[r] + u[r] (1 + UnitStep[1 - r]) == 0, u[0] == 0}, u[r], r]
$\endgroup$