I am having trouble with using NDSolve`Reinitialize when the system consists of a piecewise function.
If we define the ODE system
simplesys = {r'[t] == Piecewise[{{1, 0<= t <=10}, {0, 10<= t <=20}}, 0], r[0] == 0};
and process the equations with
state = First @ NDSolve`ProcessEquations[simplesys, r, t]
this works perfectly fine. However, when I try to reinitialize the ODE system with a new initial condition:
newstate = NDSolve`Reinitialize[state, {r[0] == 2}]
this fails with the message:
NDSolve`Reinitialize::ntcs: Cannot solve constraint equations for initial conditions.
This is due to the piecewise function in the system. I don't have this problem for other types of systems, and it only occurs when I have a piecewise function. How can I solve this issue?
Comments
Post a Comment