Hello there ! I am pretty sure that this kind of question is not very welcomed in here, but I have no choice other than posting my question here.
I know that defining functions in Mathematica is like f[x_] := x
, but I have came across a function definition that I cant figure out its functionallity the function is like below:
update2[0,0,p_] := if[RandomReal[] <= p, {1,1, p}, {3,0,p}];
update2[0,_,p_] := {5,0,0};
update2[1,0,p_] := {2,1,0};
update2[1,b_,p_] := {0,0, p*(1/2)};
update2[2,_,_] := {2,0,0};
update2[3,0,p_] := {0,0,Min[p * 2, 1/2]};
update2[3,b_,p_] := {0,0,p*(1/2)};
update2[5,_,_] := {5,0,0}
this function is called on elements of three arrays like s,b, p
that are of length n
It would be very great If anyone could explain what this function is doing.