I always meet the HeavisideTheta[0] = 1 during my work, every time I need to use the function Replace[] to finish the job, which has been harassing me. So I want to know if there's a method to set HeavisideTheta[0] = 1 permanently, or copy the definition of HeavisideTheta to a new file and rewrite it to a new package(.m or .wl file) meeting my will. In the post Add a global rule for HeavisideTheta[0], Mauricio Fernández proposed a global assumption method, but it is not convenient because I have to call the Simplify everytime. Thank you!
Asked
Active
Viewed 741 times
1
likehust
- 693
- 3
- 8
1 Answers
4
As discussed in the comments, you can set this by Unprotecting the symbol, like so:
Unprotect[HeavisideTheta]
HeavisideTheta[0]=1
Protect[HeavisideTheta]
Note that this may cause some issues with functions that expect HeavisideTheta[0] to be 0.
Carl Lange
- 13,065
- 1
- 36
- 70
-
1Thank you, I have taken your solution, write
Unprotect[HeavisideTheta]; HeavisideTheta[0]=1;HeavisideTheta[0.0]=1; Protect[HeavisideTheta];into the init.m in the directory of C:\ProgramData\Mathematica\Kernel, and realized what I wanted. – likehust Apr 18 '19 at 07:43
Unprotect[HeavisideTheta],HeavisideTheta[0]=1,Protect[HeavisideTheta]as suggested in one of the comments in the linked question? That would be the usual way to do this, if you had to. Beware that it might break things, though. – Carl Lange Apr 17 '19 at 09:48UnitStepinstead? – Greg Hurst Apr 17 '19 at 12:34HeavisideThetato control boundary condition during symbolic formula derivation and the final numerical calculation, which involving Heaviside's derivative andHeavisideTheta[0], soUnitstepdoesn't meet the situation. – likehust Apr 17 '19 at 15:19