New answers tagged

3

You can do this by either using Unevaluated or by Blocking the key: Clear[assoc, x]; assoc = <|x -> 1|> x = 2; assoc assoc[x] assoc[Unevaluated[x]] Block[{x}, Lookup[assoc, x]] <|x -> 1|> <|x -> 1|> Missing["KeyAbsent", 2] 1 1 To obtain the keys without evaluating them, use the newly added (in V12, IIRC) 2nd argument ...


5

Your code is working as intended, I would think: Q[q_, x1_, y1_, l1_, l2_, l3_, l4_] := Module[{x2, y2, x3, y3, x4, y4, theta1, theta2}, x2 = x1 + l1 Cos[q]; y2 = y1 + l1 Sin[q]; (*others*) {x2, y2, y3, x3, theta1, theta2} ] Q[q, 0, 0, 3, 5, 2, 4] This returns: {3 Cos[q], 3 Sin[q], y3$62555, x3$62555, theta1$62555, theta2$62555} The ...


13

This usually means you've exported a local symbol from the context in which it was localized. Consider: Module[{x}, x] (* x$24939 *) Your results may vary. The Module localizes x to avoid conflicting with any previous definition. x$24939 is just another symbol similar to x, but with $24939 added to its name to insure that there's no confusion with any ...


Top 50 recent answers are included