In[22]:= Outer[Inactivate[Times], {x, y, z}, {x, y, z}]
Out[22]= {{x^2, x y, x z}, {x y, y^2, y z}, {x z, y z, z^2}}
So, how to Inactivate the Times which is used to generate the matrix elements?
In[22]:= Outer[Inactivate[Times], {x, y, z}, {x, y, z}]
Out[22]= {{x^2, x y, x z}, {x y, y^2, y z}, {x z, y z, z^2}}
So, how to Inactivate the Times which is used to generate the matrix elements?
You want to use just Inactive, like Inactive[Times], specifically:
Outer[Inactive[Times], {1, 2, 3}, {4, 5, 6}]
Inactivate works on whole expressions, wrapping the heads in Inactive, but Inactivate[Times] is operating on just the expression Times, which is a raw symbol with no head. You already know the specific head you want to inactivate, so just wrap it in Inactive directly.
Outer[Inactive[Times], {x, y, z}, {x, y, z}]
I have no idea why your approach is not working - good question! But in any case you can try this:
Outer[Inactive@Times, {x, y, z}, {x, y, z}]
or - if it is for displaying reasons:
Outer[CenterDot, {x, y, z}, {x, y, z}]
Sorry, Eric, I saw your answer too late! But I still don’t understand why
Inactivate[Outer[Times, {x, y, z}, {x, y, z}], Times]
is not working.
I suppose that
Inactivate[Outer[Times, {x, y, z}, {x, y, z}], Times]
does not inactivate Times is because Times does not appear in Outer[Times, {x, y, z}, {x, y, z}] as head of an expression. The documentation is somewhat unclear on this. Compare:
Inactivate[g[f], f]
Inactivate[f[g], f]
Yes - that appears to be the reason, because this is working:
Inactivate[Outer[Times[#1, #2] &, {x, y, z}, {x, y, z}], Times]
Thank you, @Gianluca Gorni, and best regards! – Henrik
To understand a complex problem, the best approach is to first comprehend the simplest scenario. Regarding the question discussed here, I believe the following comparison can best illustrate the fundamental reason:
In[1]:= (*
find the clue as below:
*)
Inactive[x+x]//FullForm
Inactivate[x+x]//FullForm
Out[1]//FullForm= Inactive[Plus[x,x]]
Out[2]//FullForm= Inactive[Plus][x,x]