ode and piecewise function
Hi all,
I am trying to solve, using Sage, an ode which includes a piecewise. For that I wrote the following piece of code which raises an error :
f = piecewise([(RealSet.unbounded_below_open(0),0), (RealSet.unbounded_above_closed(0),10)])
u = function('u')(x)
eqn = 2*diff(u,x) + u == f(x)
u = desolve(eqn, u, ivar=x)
show(expand(u))
Since the error vanishses when I replace the function f
by either of the functions exp
or log
, I guess the problem is coming from the piecewise function. Could anyone help me solve this issue and explain what is wrong here?
Thanks
Hmm, I'm not sure whether our
piecewise
functions are supported with Maxima's ode solvers. Note that Maxima has its own piecewise implementation which may allow this directly within Maxima.Does it mean that I have to switch to Maxima in order to solve such ode?
I don't know; I'm just suggesting that could provide a solution. Of course, for numerical solutions there are good options. Also, I believe Sage does support Dirac and Heaviside functions now so they may work fine with this and
desolve
.