2
$\begingroup$

Is there a way in Mathematica to create an n-dimensional vector, where each element is a given scalar? I have tried the Array function, as the documentation center suggests for tensors, but it generates indexed values.

$\endgroup$
3
$\begingroup$
ArrayReshape[Range @ 6, {2, 3}] // MatrixForm

enter image description here

ArrayReshape[ConstantArray[1, 12], {2, 3, 2}] // MatrixForm

enter image description here

Or

ConstantArray[1, {2, 3, 2}]

(Same output)

|improve this answer|||||
$\endgroup$

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.