Repository: sympy/sympy

Issue:
Heaviside(0) should be undefined
I am working on an optimal-control problem that involves the derivative of a Max(0,x) function, which gives Heaviside(x) as it's derivative.  In the subsequent analysis, any line `y=mx` is tangent to Max(0,x) at x=0, so long as m is in [0,1].  Thus, in the subsequent analysis, it's very useful to treat Heaviside(x) as a generalized function where Heaviside(0) returns the whole interval [0,1].

Currently, Heaviside(0) returns 1/2, and some justification of this case is given.  However, reasonable 
arguements have been made for Heaviside(0) = 1 or 0 as well, and my example above provides a 4th possibility.  The situation reminds me of the argument we had some-time back over how to evaluate 1**oo, which we decided to leave as nan because there was no universally satisfactory convention.

I propose leaving Heaviside(0) as un-defined.  This is the conservative choice, and avoids possibly incorrect assumptions.  A `.subs(Heaviside(0),k)` can then be used if a specific value is desired.

Discussion:

Patch:
diff --git a/sympy/functions/special/delta_functions.py b/sympy/functions/special/delta_functions.py
index c4777c5827..27dabc40e5 100644
--- a/sympy/functions/special/delta_functions.py
+++ b/sympy/functions/special/delta_functions.py
@@ -180,33 +180,12 @@ class Heaviside(Function):
 
     1) ``diff(Heaviside(x),x) = DiracDelta(x)``
                         ``( 0, if x < 0``
-    2) ``Heaviside(x) = < ( 1/2 if x==0 [*]``
+    2) ``Heaviside(x) = < ( undefined if x==0 [*]``
                         ``( 1, if x > 0``
 
     .. [*] Regarding to the value at 0, Mathematica defines ``H(0) = 1``,
            but Maple uses ``H(0) = undefined``
 
-    I think is better to have H(0) = 1/2, due to the following::
-
-        integrate(DiracDelta(x), x) = Heaviside(x)
-        integrate(DiracDelta(x), (x, -oo, oo)) = 1
-
-    and since DiracDelta is a symmetric function,
-    ``integrate(DiracDelta(x), (x, 0, oo))`` should be 1/2 (which is what
-    Maple returns).
-
-    If we take ``Heaviside(0) = 1/2``, we would have
-    ``integrate(DiracDelta(x), (x, 0, oo)) = ``
-    ``Heaviside(oo) - Heaviside(0) = 1 - 1/2 = 1/2``
-    and
-    ``integrate(DiracDelta(x), (x, -oo, 0)) = ``
-    ``Heaviside(0) - Heaviside(-oo) = 1/2 - 0 = 1/2``
-
-    If we consider, instead ``Heaviside(0) = 1``, we would have
-    ``integrate(DiracDelta(x), (x, 0, oo)) = Heaviside(oo) - Heaviside(0) = 0``
-    and
-    ``integrate(DiracDelta(x), (x, -oo, 0)) = Heaviside(0) - Heaviside(-oo) = 1``
-
     See Also
     ========
 
@@ -237,8 +216,6 @@ def eval(cls, arg):
             raise ValueError("Function defined only for Real Values. Complex part: %s  found in %s ." % (repr(im(arg)), repr(arg)) )
         elif arg.is_negative:
             return S.Zero
-        elif arg.is_zero:
-            return S.Half
         elif arg.is_positive:
             return S.One
 


Test patch:
diff --git a/sympy/functions/special/tests/test_delta_functions.py b/sympy/functions/special/tests/test_delta_functions.py
index 7a12636e01..dd14bbdf7e 100644
--- a/sympy/functions/special/tests/test_delta_functions.py
+++ b/sympy/functions/special/tests/test_delta_functions.py
@@ -47,7 +47,7 @@ def test_DiracDelta():
 
 
 def test_heaviside():
-    assert Heaviside(0) == 0.5
+    assert Heaviside(0).func == Heaviside
     assert Heaviside(-5) == 0
     assert Heaviside(1) == 1
     assert Heaviside(nan) == nan
diff --git a/sympy/integrals/tests/test_integrals.py b/sympy/integrals/tests/test_integrals.py
index 507ef9adcd..8481f161ea 100644
--- a/sympy/integrals/tests/test_integrals.py
+++ b/sympy/integrals/tests/test_integrals.py
@@ -438,7 +438,6 @@ def test_integrate_DiracDelta():
     # This is here to check that deltaintegrate is being called, but also
     # to test definite integrals. More tests are in test_deltafunctions.py
     assert integrate(DiracDelta(x) * f(x), (x, -oo, oo)) == f(0)
-    assert integrate(DiracDelta(x) * f(x), (x, 0, oo)) == f(0)/2
     assert integrate(DiracDelta(x)**2, (x, -oo, oo)) == DiracDelta(0)
     # issue 4522
     assert integrate(integrate((4 - 4*x + x*y - 4*y) * \