Message Boards Message Boards

Problem with DSolve, piecewise and constants of integration

I'm trying to use DSolve with Piecewise, and I think I've found an error. The solution you get, is a Piecewise defined function, where for each piece there should be a different constant of integration.

Example:

DSolve[{x'[t] - x[t] + Piecewise[{{0, t < 1/2}, {6, t > 1/2}}] == 0}, 
 x[t], {t, 0, 2}]

Mathematica (version 12.0.0.0) gives the following solution:

enter image description here

As you can see, both pieces share the same constant C1, where one would expect find C1 in the first one and C2 in the second one.

On the other hand, when you set initial conditions, the solution is correct, meaning that internally Mathematica uses different constants for each piece. But the solution given without them, is not mathematically correct.

This problem gets worse when you try to solve systems with several differential equations. For instance, for a system with two equations, you get wrong solutions both with and without setting initial conditions.

POSTED BY: Carmen Calvo
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract