max-values from each row across multiple vectors
- March 28, 2025
- 1 reply
- 920 views
I am using Mathcad Express 10 to calculate the stress and deflection of components under a specific load case. To avoid having to create a copy of the calculation for each component, I want to perform the calculation using vectors and matrices simultaneously for all components and their values.
Unfortunately, I don't have access to the full version of Mathcad so I can't use any programming.
However, when I switch the calculation to vectors, a problem occurs that I cannot solve. I have created a minimal example, see attached file.
There are three vectors (v1 - v3) which all have the same length. The length of the vectors results from the number of different components to be calculated and is not fixed but can change. Therefore, the solution must work with any vector length.

What I am trying to achieve: I need the maximum values of each line from the vectors for the calculation later on. The resulting vector then has the maximum value from all the first rows of the vectors in its row 1 and so on for the next rows. The picture below shows the desired result.

To achieve this I have come up with the following solution:
- I create the matrix M1 to "combine" the vectors.

- Then I create the function v_max(v,n) to determine the maximum value of a given row of the matrix.

- I create the variable m that contains the range that represents the row indices of the matrix in order to be able to apply the function v_max to the entire matrix.

The calculation of v_max(M1,m) produces the expected result: a vector with the max values of each row of the vectors v1 - v3. But: I cannot continue calculating with this result or assign it to a variable. Error: “This value must be an integer”.

I understand that Mathcad expects an integer as an index here, but why can Mathcad create the result vector as described but not assign it to a variable or calculate with it?
If anyone has any other ideas on how to determine the respective max values from the vectors (Mathcad Express only), I would be very grateful for that too!
Thanks in advance for your help!


