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$
0

1 Answer 1

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)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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