# Error Messages/42525

## Error message

``` More than one implicit dimension is not allowed in the same array.  In this case, a
reference to an array with two implicit dimensions results as the local identifier 'Tmp'
falls out of scope.  As local value 'Tmp' leaves scope, its list value becomes
an implicit dimension.
```

## Cause

An implicit dimension of an array is an a dimension that does not correspond to an index. Implicit dimensions result when array values are combined with list values, such as in the following expression:

`A*[1, 2, 3, 4]`

In the result, we have four products of A, but we have no name for this list of products, so we don't have a natural way to refer to that dimension.

If we were to combine values each containing its own implicit dimension, then we'd have two implicit dimensions in the same array -- that might happen if we attempted to evaluate something like this:

`[1, 2, 3] * [4, 5, 6, 7, 8]`

You might think this would be a rectangular array with 15 elements, but how would we refer to the dimensions of this array? What if we wanted to sum over the longer dimension? We'd have no way to identify the dimension of interest in an expression. To avoid this ambiguity, Analytica requires that you have at most one implicit dimension in an array.

Implicit dimensions can also be held in local values. Consider this expression:

`Local Tmp := [1, 2, 3] Do (`
`Tmp*[4, 5, 6, 7, 8]`
`)`

In this example, `Tmp` is not an index object (if you want it to be, use Index..Do instead of Var..Do). Once `Tmp` falls out of lexical scope, there is am ambiguity here. The result would be a 3x5 array, but both dimensions are implicit.

The case that cases the error seen here is similar to this, except that the array that has the multiple implicit dimensions is contained within a reference. This would be illustrated by this example:

`Local Tmp := [1, 2, 3] Do \(Tmp*[4, 5, 6, 7, 8])`

Notice the backslash (\), which is the reference operator here. The array contained inside the reference has two implicit dimensions.

## Remedy

There are two remedies that may be applicable here.

The first is to use a local index in place of the local value, such that the above example would become:

`LocalIndex Tmp := [1, 2, 3] Do \(Tmp*[4, 5, 6, 7, 8])`

By using a local index for `Tmp`, the index object itself can outlive its own lexical scope and be part of the result. The result then would be a reference to an array with one local index and one implicit index.

The other possibility is to swallow only one of the two dimensions into to reference, keeping the other dimensions outside the reference. Doing this prevents the two dimensions from becoming implicit dimensions of the same array. The above example would be written as one of these:

`Local Tmp := [1, 2, 3] Do \[Tmp](Tmp*[4, 5, 6, 7, 8])`
`Local Tmp := [1, 2, 3] Do \[Null](Tmp*[4, 5, 6, 7, 8])`

The first case becomes a list of three references, each to an array containing a list of five elements. The second case becomes a list of five references, each reference pointing to a list of three elements.