- #1
Hepth
Gold Member
- 464
- 40
I have a heaviside function:
where the letters correspond to functions, and the number of functions is arbitrary.
I want to make a replacement so that
or something similar.
I wish to take the inputs to the heaviside function, and create an "If" statement out of them.
So if I have a function that contains this HeavisideTheta, I can do a replacement as:
(though that obviously won't work)Any suggestions?
Code:
HeavisideTheta[a,b,c,d,e,...]
where the letters correspond to functions, and the number of functions is arbitrary.
I want to make a replacement so that
Code:
HeavisideTheta[a_]:> If[a>0,1,0]
HeavisideTheta[a_,b_]:>If[a>0,1,0] If[b>0,1,0]
I wish to take the inputs to the heaviside function, and create an "If" statement out of them.
So if I have a function that contains this HeavisideTheta, I can do a replacement as:
Code:
F[x,y]/.{HeavisideTheta[a__]:> Product[If[a[[i]]>0,1,0],{i,1,Length[a]}]
Last edited: