# Creating array of symbols: symbol_array

### 12.4.6 Creating array of symbols: symbol_array

The symbol_array command is used for creating multidimensional arrays of symbols. It takes two arguments:

- str, a template string for symbol names.
- dim=n1,n2,…,nm, a sequence of m positive integers.

The return value is an array with m dimensions n1,n2,…,nm with indexed symbols as elements. Symbols are created from the template string str by appending indices. Template string may contain m instances of the character ’%’, k-th of which serves as the placeholder for the k-th dimension index. If placeholders are omitted, indices are simply appended in case m=1, while in case m>1 they are separated from str and each other by the underscore (’_’).

The indices start from 0 in 0-based modes (such as the default mode in Xcas) resp. from 1 in 1-based modes (such as the Maple mode).

#### Examples.

- Input:
  symbol_array("x",5)
- Output:

  ⎡ ⎣ | x0,x1,x2,x3,x4 | ⎤ ⎦

- Input:
  symbol_array("a",2,3)
- Output:

  ⎡
  ⎢
  ⎣

  a0,0 | a0,1 | a0,2
  a1,0 | a1,1 | a1,2

  ⎤
  ⎥
  ⎦

- Input:
  maple_mode(1):; symbol_array("a%%",2,3)
- Output:

  [[a11,a12,a13],[a21,a22,a23]]

- Input:
  maple_mode(0):; s:=symbol_array("a%b%c%",2,3,4)
- Output:

  ⎡
  ⎢
  ⎢
  ⎣

  ⎡
  ⎢
  ⎢
  ⎣

  a0b0c0 | a0b0c1 | a0b0c2 | a0b0c3
  a0b1c0 | a0b1c1 | a0b1c2 | a0b1c3
  a0b2c0 | a0b2c1 | a0b2c2 | a0b2c3

  ⎤
  ⎥
  ⎥
  ⎦

  ,

  ⎡
  ⎢
  ⎢
  ⎣

  a1b0c0 | a1b0c1 | a1b0c2 | a1b0c3
  a1b1c0 | a1b1c1 | a1b1c2 | a1b1c3
  a1b2c0 | a1b2c1 | a1b2c2 | a1b2c3

  ⎤
  ⎥
  ⎥
  ⎦

  ⎤
  ⎥
  ⎥
  ⎦

- Input:
  s[1][2][3]
- Output:

  a1b2c3