Is there any way to construct tensor of any given dimension d and rank r with symbolic entries? i.e., instead of manually constructing one as


for d=3 and r=10, I wish to only feed values of d and r and let Mathematica generate such a tensor.

  • $\begingroup$ Array[T, ConstantArray[10, 3]]? $\endgroup$ – J. M.'s torpor May 31 '16 at 3:06

Just make a function yourself:

tensor[d_, r_] := Outer[t, ##] & @@ ConstantArray[Range[r], d]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.