For the definitions,
t = 1;
f[x_, y_] := t (x + y);
v[3] := {1, 1};
g[u_] := f[v[u][[1]], v[u][[2]]];
the following two expressions yield different results, despite the only difference being the name of the iterator.
Table[g[s], {s, 3, 3}]
Table[g[t], {t, 3, 3}]
I believe this is related to how Table
applies the value of its variables, as mentioned in https://mathematica.stackexchange.com/a/23533.
Are there other functions that behave similarly (albeit bizarrely)? Other than using a different variable name for the iterator, are there good ways to avoid this issue?
Comments
Post a Comment