7
$\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$
6
  • $\begingroup$ Can I summarize the question as, you need a UnitStep that differentiates to DiracDelta? Is there any other feature required? $\endgroup$
    – xzczd
    Nov 8, 2019 at 5:04
  • $\begingroup$ @xzczd , Thanks for your attention, we always got different results using UnitStep in MMA 5.X and MMA 11.3 to derive symbolic formulas, we also have used HeavisideTheata in 11.3 to derive, but the results are different from correct results, so our work group use 5.0 when deriving symbolic formulas ,then use 11.3 when calculating and plotting because the graphics are better in 11.3 than in 5.0. $\endgroup$
    – likehust
    Nov 8, 2019 at 7:01
  • $\begingroup$ @xzczd ,I want to know if I can copy the function UnitStep in 5.0 as a package to 11.3 like in Matlab copying a function definition file to a work folder, or can I use a command in 11.3 to call UnitStep locating in 5.0 directory? Thank you. $\endgroup$
    – likehust
    Nov 8, 2019 at 7:02
  • $\begingroup$ I think it's hard (if not impossible) because UnitStep is a built-in function. Perhaps some clever use of mathlink (Now it's called WSTP link) will help? I've no idea. "We also have used HeavisideTheta in 11.3 to derive, but the results are different from correct results" This sounds strange, can you show a specific example? $\endgroup$
    – xzczd
    Nov 8, 2019 at 7:05
  • 1
    $\begingroup$ Well, I still think it's better to figure out why 11.3 doesn't deduce the correct result. Creating a minimal example should not be too hard. Anyway, it's your choice. $\endgroup$
    – xzczd
    Nov 8, 2019 at 7:28

2 Answers 2

3
$\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$
2
  • $\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, 2019 at 0:35
  • $\begingroup$ @likehust I would if I had access to version 5.0 but I don't. $\endgroup$
    – Somos
    Apr 19, 2019 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$
1
  • $\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, 2019 at 1:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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