5
$\begingroup$

The mathematica's version of my coworkers is 5.0, they use UnitStep to derive formula, However, I also want to use the parallel features so used the latest version 11.3. then I found UnitStep in the two versions is different, the UnitStep's derivative in 5.0 is DiracDelta, but not in 11.3. In version 11.3, DiracDelta becomes HeavisideTheta's derivative. I want to know:

  1. Which is the first version where the difference appeared?
  2. If HeavisideTheta[0]=1, is HeavisideTheta in v11.3 equal to UnitStep in v5.0?
  3. Can I replace UnitStep to HeavisdeTheta?

Thanks!

In version 5.0

enter image description here

In version 11.3

enter image description here

$\endgroup$
2
$\begingroup$

This script is from a Mathematica version 6.0 session using 'math.exe'

Mathematica 6.0 for Microsoft Windows (32-bit)
Copyright 1988-2008 Wolfram Research, Inc.

In[1]:= D[#@x, x] & /@ {UnitStep, HeavisideTheta}

Out[1]= {Piecewise[{{Indeterminate, x == 0}}], DiracDelta[x]}

In[2]:=
$\endgroup$
  • $\begingroup$ Thank you for providing these information, you verified my guess at the same time. MMA 6.0 substitutes ArrayFlatten, ConstantArray, Take... for BlockMatrix, ZeroMatrix, TakeMatrix..., so I guess from where UnitStep and HeavisideTheta came to an change. would you proceed to answer question 2 and 3 mentioned above? $\endgroup$ – likehust Apr 19 at 0:35
  • $\begingroup$ @likehust I would if I had access to version 5.0 but I don't. $\endgroup$ – Somos Apr 19 at 1:04
1
$\begingroup$

If HeavisideTheta[0] = 1, is HeavisideTheta in v11.3 equal to UnitStep in v5.0?

For calculus purposes, sure.

version 5.2 session

Can I replace UnitStep with HeavisideTheta?

HeavisideTheta[] is what you should be using in version 6 and later versions, because it's the one now supported extensively by the calculus functions. In earlier functions, you have to settle for UnitStep[].


You can always use $VersionNumber along with conditionals (e.g. If[], Which[]) to write code that does different things depending on the version the code is evaluated in.

If[$VersionNumber >= 6., HeavisideTheta'[x], UnitStep'[x]]
$\endgroup$
  • $\begingroup$ Yesterday, My coworker got different results in MM10 and MM5.0 while running same program codes. Now, I am transferring my own codes from MM10 to MM5.0 in hoping to find a good luck by changing HeavisideTheta[] to UnitStep[], certainly, it's a hard work because involving the replacement of other functions such as ParallelMap, ArrayFlatten, ParallelNeeds, ConstantArray, and so on. $\endgroup$ – likehust Sep 26 at 1:34

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.