Why does
Map[Unevaluated, Table[PauliMatrix[i], {i, 1, 3}]
give
{Unevaluated[{{0, 1}, {1, 0}}], Unevaluated[{{0, -I}, {I, 0}}], Unevaluated[{{1, 0}, {0, -1}}]}
while
Table[Unevaluated[PauliMatrix[i]], {i, 1, 3}]
gives
{{{0, 1}, {1, 0}}, {{0, -I}, {I, 0}}, {{1, 0}, {0, -1}}}
I think they should give the same result! Why not?
Tableevaluates it's arguments in a non-standard way. In particular, it Holds it's arguments, explicitly evaluates the second argument (the iterator), substitutes values obtained from the iterator into the first argument and then (importantly!) explicitly evaluates the first argument at those values. – Mark McClure May 05 '13 at 02:14Map. Map always effectively constructs a complete new expression and then evaluates it. And useTrace, I found in the last three steps, mathematica actually remove theUnevaluated, and finally bring back theUnevaluatedhead, why? – matheorem May 05 '13 at 02:49Tableevaluates it's arguments in a non-standard way and (by implication) thatMapdoes not. Thus, when the documentation says thatMap"constructs a complete new expression and then evaluates it", it does so in the standard way. Thus,Map[Unevaluated,{1,2}]produces the same output as{Unevaluated[1],Unevaluated[2]}. – Mark McClure May 05 '13 at 02:58Mapand the step 'substitutes values ....explicitly evaluates the first argument at those values' inTableis two kind of evaluate?!! I still don't understand, Now thatTablehas the attributesHoldAll, it should hold theUnevaluated. It seems that "expr, shift+Enter" and "Evaluate[expr]" is different ? And Map use the first oneTableuse the second? – matheorem May 05 '13 at 03:17Unevaluated[1+1]as input vsEvaluate[Unevaluated[1+1]]as the input. – Mark McClure May 05 '13 at 03:23TableandMaphave different evaluation procedures and that's what leads to this behavior. Also, functions likeUnevaluatedand attributes likeHoldAllare intimately connected with these issues. – Mark McClure May 05 '13 at 03:25Trace, you are ready for David Wagner's book. It will answer your question and many, many more. In particular, see Chapter 7. – m_goldberg May 05 '13 at 05:05