# Manipulating Vectors and Matrices

GoldSim Quick Tour (10 of 23)

In many systems, you may want to create and manipulate elements that represent collections of data, rather than individual items. For example, you may want to create an element that represents your company's revenue for each of the last five years, or an element that represents the salmon population in each of 20 streams.

To address these kinds of problems, GoldSim allows you to create and manipulate vectors and matrices (collectively referred to as arrays). The example to the right is an array that represents the salmon population in each of 20 streams over a 5 year period.

In addition to adding data in the form of vectors and matrices, you can manipulate these arrays in equations. For example, you could create an Expression element, and define it as:

2 * Salmon_Population

The output of the Expression would be an array, identical to the Salmon_Population array, except each item of the array would be two times greater. If required, you can access a particular item of the array in an equation. For example,

Salmon_Population[BearCreek, 1996]

references a single value representing the salmon population in Bear Creek in 1996. GoldSim also provides a wide variety of special operators that allow you to manipulate arrays. For example, the expression

Sumc(Salmon_Population)

would result in a vector representing the sum of all items in each column of the array. That is, for this example, this would convert the matrix (a 2-D array) to a vector (a 1-D array) representing the total salmon population (summed over all streams) for each year.