Tip 90. Vector of initial data and vector of answer

Fig. 90. Vector of initial data and vector of answer

Very often during calculation in Mathcad it is necessary to create a function program that would take multitude of initial data as the arguments and would gave the answer as set of constants. The solution of such by the following technology is showed in the fig. 90. Initial data[1] (argument of the function W) are the matrix where the left column keeps the name of input data but the right one keeps initial data. When this matrix is presented as the argument of our function W, then the right half (in our case they are numerical constants) is cut by the operator M<1> . The elements of this right part are shoved about this program at once. The answers structure repeats the structure of initial data: the matrix is written on the last line of the program in the fig. 90. Its left column is designation (description) of outputted data but the right one is calculated data: textual and numerical constants. Now (see below part of the fig. 90) if we change initial data (analyzable water composition), then well obtain new calculation data (water quality coefficient). If it is necessary to output only one numerical value then the function W has to be called with inferior index W()0,1 (hardness of water).

[1] The problem about water quality coefficients by its ionic composition is solved (see labels on different mineral waters), if somebody is interested in it. Here (as in all other tips of the book) the main point is to understand the method of solution the problem in Mathcad but not the problem itself.