# How are Symbolic Vectors Defined?

It is my understanding that undefined symbols are considered scalars, so I can't index variables that aren't defined.

It is possible to define a symbol as a vector of symbols as follows, allowing each symbol to be individually addressable:

y1
y2
y = {y1, y2}
y[[1]]


Is it possible to create an n-dimensional vector of real numbers?

One possible use case is taking the Jacobian of a function at a point.

x = {x1, x2}; (* Tedious to do by hand if n is large *)
x // MatrixForm

f = {-x[[1]] + x[[1]]*x[[2]],   -x[[2]]};
f // MatrixForm

A = D[f, {x}] /. {x1->0, x2->0}; (* The Jacobian of F at (0, 0) *)
A // MatrixForm


• I think you might be wanting Indexed (reference.wolfram.com/language/ref/Indexed.html). Mar 11, 2023 at 0:29
• Perhaps. If I used Indexed notation, what would I substitute for the ReplaceAll clause in this example? (/. {x1->0, x2->0}) Mar 11, 2023 at 0:46
• Nice example of Indexed posted. Thanks @Alan! Mar 11, 2023 at 0:54

xs = Array[Indexed[x, #] &, 2]  (* {Subscript[x, 1],Subscript[x, 2]} *)
xs[[1]]  (* Subscript[x, 1] *)
f = {-xs[[1]] + xs[[1]]*xs[[2]], -xs[[2]]};
f // MatrixForm  (* nice symoblic matrix *)

A = D[f, {xs}] /. {xs[[1]] -> 0, xs[[2]] -> 0}; (* Jacobian of F at (0,0)*)
A // MatrixForm  (* what you have above *)


Try this:

SymbolicVector[symbol_Symbol, row_Integer?Positive] := ToExpression[
Array[ToString[symbol] <> ToString[FromDigits[{##}]] &, row]]


Test:

SymbolicVector[y, 3]
(*{y1, y2, y3}*)