Array Origin |
The built-in Mathcad variable ORIGIN represents the starting index of all arrays; the default value for ORIGIN is 0. This value dictates which array elements can exist. For example, using the default settings, there cannot be an array element −1. The Mathcad expression
v-1 := 0
produces an error indicating that the subscript was too small for the vector.
To change the ORIGIN for the whole worksheet, choose Worksheet Options from the Tools menu and go to the Built-in Variables tab, then enter a new value in the dialog.
You can also reset the ORIGIN locally by redefining it in your worksheet, for example
ORIGIN := 1
sets the array index ORIGIN to 1 for all arrays below this definition. You may wish to reset it this way, rather than changing the value in the Worksheet Options, so it is obvious to anyone reading your worksheet which value has been set. If you wish the new value of ORIGIN to affect every array in your sheet, you can also use a global definition.
You can set ORIGIN to any integer, positive or negative.