# Defining value other than 0 or 1 for HeavidSideTheta function

HeavisideTheta function always gives 0 or 1. I wonder if this is possible to define my own value for the HeavisideTheta function other than 0 and 1, say 0.5, only for a specific notebook. Also, how to remove that specific value whenever I want and return its default value 0 or 1. Thanks!

Example:

For the following function,

HeavidsideTheta[0.5-x]

I want

HeavidsideTheta[0.5-x] = 1 when x < 0.5

and

HeavidsideTheta[0.5-x] = 1 when x >= 0.5

Note: This function is a part of other functions of "x" where integrals are involved.

• This may be obvious but you can multiply it by any number or function you like to give what you need. You could write a function f[x_]:= 0.5 HeavisideTheta[x]
– Hugh
Mar 3, 2022 at 11:53
• Please see above example Mar 3, 2022 at 13:04

Try:

moh[x__] := (1/2)*HeavisideTheta @@ {x}


Regarding your example, just reverse the sign, multiply the 'amplitude' and add the minimum:

moh[x__] := 1/2 + (1/2)*HeavisideTheta @@ {-x}
Plot[{moh[t - 1/2]}, {t, 0, 1}, PlotRange -> {0, 1}] You can achieve the same thing by simply adding various step functions: (1/2)*UnitStep[t - 1/2] + UnitStep[-(t - 1/2)].

• Please see the above example Mar 3, 2022 at 13:04
• The line corresponding to -1 should correspond to 1 and the other should 0.5. I don't need the -1 part. Only 1 and 0.5 is required. Mar 3, 2022 at 13:32
• sorry, the first line to 1 and 2nd to 0.5 Mar 3, 2022 at 13:42
• Now it worked. Thanks, Shin Kim!! Mar 3, 2022 at 14:21
a = .5;
b = 3;
c = 2;
Plot[a + (b - a)*HeavisideTheta[x - c], {x, -5, 8},
AxesOrigin -> {0, 0}] Using the Clip command, I show two variations using the 2nd and 3rd argument of the function:

Plot[{
Clip[HeavisideTheta[0.5 - x], {0.3, 0.8}]
, Clip[HeavisideTheta[0.5 - x], {0.3, 0.8}, {2, 4}]
}
, {x, -2, 2}
, PlotRange -> {-0.2, 4.2}
, Exclusions -> None
] 