Indexing array variables is a necessary part of mathematic documents and programs. Fortunately, Mathcad Prime handles these details somewhat elegantly in most cases. It’s a beautiful thing when it works. Unfortunately some people struggle with an array solution error, and I wanted to make sure I added this tip for their benefit.

Array Solution Error

In the image below I have selected the variable S_C[rh] to bring your attention to it. There are no array index subscripts attached to the variables. Mathcad intuitively knows to create the respective array because one or more variables in the calculations were composed of an index themselves. As stated before, this usually either works beautifully, or it does not calculate; one or the other. In this case I did not know anything was wrong until I was adjusting the hub modeling and noticed how astronomically bad the values were.

Mathcad Array Error

Add Variable Array Indexes

In the following image I have selected the same equation; notice the index subscripts designated with a preceding “[“. You may also notice the differences in the results. Compare the images: the difference lies somewhere between “tolerable” and “falling from the sky in flames”. Mathcad has no problem if you want to run 20 pages of errors based on one array-gone-bad.

Mathcad Array errors

In this case I simply added the indexes where appropriate. The array solution, as well as the remaining calculations updated properly. The keystrokes for adding the subscript index is “[“.

If you want to avoid these errors altogether, go ahead and add the indexes to your variables wherever they are pertinent. I prefer to let Mathcad handle this part of arrays for me, but after days of troubleshooting, I’m beginning to reconsider.