I have a function I want to evaluate by replacing its arguments with rule, however the result differs from when I manually enter the arguments,e.g.,
Given a functon
test[x_, y_, z_]:= Total@Log[DeleteCases[Chop[{x, y, z, 1 - x - y - z}], 0]]
Evaluation through applying rule yields undesirable answer:
In[2]:= test[x, y, z] /. {x -> 0.5622814903606034, y -> 0.21885925481969834, z -> 0.21885925481969834} Out[2]= -41.0444 + 3.14159 I
Manually entering the arguments gives the right answer:
In[3]:= test[0.5622814903606034, 0.21885925481969834, 0.21885925481969834] Out[3]= -3.61441
However I don’t have the time to enter the variables by hand every time, how do I make the replacing method work?