1
$\begingroup$

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!

$\endgroup$
  • 2
    $\begingroup$ Have you tried 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. $\endgroup$ – Carl Lange Apr 17 at 9:48
  • 4
    $\begingroup$ The question arises: what for? $\endgroup$ – user64494 Apr 17 at 9:50
  • $\begingroup$ Maybe use UnitStep instead? $\endgroup$ – Chip Hurst Apr 17 at 12:34
  • $\begingroup$ @user64494 @Chip Hurst, I use the HeavisideTheta to control boundary condition during symbolic formula derivation and the final numerical calculation, which involving Heaviside's derivative and HeavisideTheta[0], so Unitstep doesn't meet the situation. $\endgroup$ – likehust Apr 17 at 15:19
  • $\begingroup$ @Carl Lange, thanks, the method you talked about is feasible, can you tell me how to write this code fragment into init.m file and make every .nb file load them automatically every time? $\endgroup$ – likehust Apr 17 at 15:30
3
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ Thank 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. $\endgroup$ – likehust Apr 18 at 7:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.