http://vle-models.wur.nl/wiki/index.php?title=Data_structures&feed=atom&action=historyData structures - Revision history2020-04-04T13:26:37ZRevision history for this page on the wikiMediaWiki 1.26.2http://vle-models.wur.nl/wiki/index.php?title=Data_structures&diff=983&oldid=prevWim: conform NSM help2010-06-17T20:18:56Z<p>conform NSM help</p>
<a href="http://vle-models.wur.nl/wiki/index.php?title=Data_structures&diff=983&oldid=975">Show changes</a>Wimhttp://vle-models.wur.nl/wiki/index.php?title=Data_structures&diff=975&oldid=prevRobot: Created page with ' The power of NSM originates for a large part from the extensive use of multiple dimensions: The grouping of values into data structures makes it easy to handle large amounts of …'2010-06-17T19:58:31Z<p>Created page with ' The power of NSM originates for a large part from the extensive use of multiple dimensions: The grouping of values into data structures makes it easy to handle large amounts of …'</p>
<p><b>New page</b></p><div><br />
The power of NSM originates for a large part from the extensive use of multiple dimensions: The grouping of values into data structures makes it easy to handle large amounts of data. It also simplifies data administration.<br />
<br />
<br />
<br />
[The multiple dimensions is also its weakest part. Manipulation involves large data structures, more memory ]<br />
<br />
<br />
<br />
Example 1: matrices and structures<br />
<br />
Consider a variable WeightOfJohn as a single value, for example the weight of an individual named John.<br />
<br />
WeightOfJohn = 78.5; < kg ><br />
<br />
Here the variable WeightOfJohn constists of one value. Compare this with the variable Weights where we put in all the weights of the family of John Doe.<br />
<br />
Weights = 78.5, 59.3, 20, 5; <kg><br />
<br />
Where the first weight is John�s weight, the second weight is the weight of his wife Jane , the third is the weight of his son Steven and the last is from his baby Alice. So we can put a variable Name next to weight with the names of the family members:<br />
<br />
Name = "John", "Jane", "Steven", "Alice";<br />
<br />
As you can see the variables can consist of numeric values or of text values. In NSM you cannot mix these values within a single variable. Both variables have one dimension consisting of four elements. The variable WeightOfJohn as defined earlier constist of one element and in this case has also one dimension. Should we regroup the variable Name as<br />
<br />
John Jane<br />
<br />
Steven Alice<br />
<br />
with the parents in the first row and the children in the second row (and males in first column and females in second column) than the variable names has two dimension each of length two. In NSM we call this variable a matrix of size 2 x 2. The variable Weights with four values is than a matrix of size 4 and WeightOfJohn a matrix of size one. Scalars (single values without a dimension) do not exist in NSM, except for empty variables with no values at all => verwijzing <=). The regrouping in NSM is done by the Redim() function. In the example above we could regroup the variable Weights also to a 2 x 2 matrix. So Weights = Redim(Weights; 2,2)<br />
<br />
78.5 59.3<br />
<br />
20 5<br />
<br />
After one year the family has another daughter, Jenny. In the current matrix, there is no space for Jenny. All rows of a matrix have the same length, the length of that specific dimension. So do all columns. If the family is allowed to have more than one male and one female child, we need another data structure for this family:<br />
<br />
NameStruct = {NamesMale; NamesFemales};<br />
<br />
With<br />
<br />
NameMales = "John"," Steven"<br />
<br />
NameFemales = "Jane", "Alice", "Jenny"<br />
<br />
Now we call NameMales is a matrix of size 2 and NameFemales a matrix of size 3. The variable NameStruct is a structure consisting of two matrices, in this case two one-dimensional matrices. Note that is this structure, there is no information anymore on who are the parents and who are the children. If this information was more important than about the sexes, the structure would be<br />
<br />
NameStruct = {NamesParents; NamesChildren};<br />
<br />
With<br />
<br />
NamesParents = "John"," Jane"<br />
<br />
NamesChildren = "Steven", "Alice", "Jenny"<br />
<br />
We could also make a structure of four matrices: the names of the male adults, the female adults, the male children and the female children.<br />
<br />
<br />
<br />
Example 2: more than 2 dimensions<br />
<br />
The head of a school wants to know how her students are doing. She asks each teacher for the average results of their class:<br />
<br />
AverageResults = 7.0, 6.5, 8.1, 6.6, 7.2, 7.7<br />
<br />
The variable AverageResults consists of a one-dimensional matrix with the first element representing the average results of the first class, second of second class etc�<br />
<br />
On second thought, these average values are a rather coarse measure and she decides she needs the class average results for each examination period. The variable she is now interested in will be a two-dimensional matrix. The first dimension represents the classes and has length = six. The second dimension represents the examination periods, and its length will equal the number of examination periods over the year.<br />
<br />
( ''de a�s worden dan vervangen door echte getallen'' )<br />
<br />
<br />
<br />
If the head of the school wants to differentiate between the results of boys and girl students, she could add another dimension. This would represent sex and have length = two. The result is a 6 (classes) x 4 (examination periods) x2 (sexes) matrix<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
An inspector supervises five schools. He gets the results of the heads of all the schools. They al send a 6x4x2 matrix, which the inspector can combine into a 6 (classes) x4 (examination periods) x 2 (sexes) x 5 (schools) matrix:<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
[[category:NSM functions]]</div>Robot