Search code examples
mathcalculusdifferential-equations

Is there a math function that increases when >0 and constant when <0 WITHOUT using piecewise functions


Is there a mathematical function that is constant at 0, but once it hits 0, it begins increasing. I dont care what kind of increasing function it is: e, parabola, etc. I am trying to avoid piecewise function.


Solution

  • The simplest is x + abs(x), though technically abs(x) is itself piecewise.

    If you want something smoother, then try x^3 + abs(x^3), or any higher, odd exponent.

    And another option that avoids using abs and is actually continuous: x + sqrt(x^2)