cancel
Showing results for
Did you mean:
cancel
Showing results for
Did you mean:

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

## Returning an array of matrices using a Mathcad program.  6-Contributor

## Returning an array of matrices using a Mathcad program.

This problem came up as a part of a recent linear algebra assignment. In this case, we only use matrix multiplication and transpose, yet at the same time express a nontrivial control flow. There are 5^4=625 matrices to check, so performance is not a concern; I am focusing on ease of use.

For reference, here is the answer to this problem: I have tried to write a Mathcad Program for this purpose. But the problem is that, neither it is returning the whole array of matrices, nor the one output that it gives is correct. It is returning A instead of P. The image of the Mathcad Program is: Please, if anyone can help me in returning an array of matrices that satisfy the given condition, I would be obliged.

1 ACCEPTED SOLUTION

Accepted Solutions  24-Ruby V
(To:MUFASA)

Even no solution contains a zero element, your loops should start from 0 and not from 1.

Note also the by default (you can change that behaviour) arrays are numbered beginning with 0, thats the reason for "i <-- 0". To apply the modulo operation on every element of the matrix T and not on the matrix itself (which makes no sense and results in an error) you have to use vectorization (the arrow over the expression). The temporary matrix T is necessary because we cannot write because if we do so, the matrix multiplication would be done element by element and not the correct way. Se the difference here: So here is one way to find the solutions via brute force: P6 file attached

5 REPLIES 5  23-Emerald III
(To:MUFASA)

Hmm,

The one output it gives is for the last matrix P tried. That is: due to the fact that you did not build an escape into your program.

Did you check this: No wonder: Success!
Luc  6-Contributor
(To:LucMeekes)

Thanks, LucMeekes. This problem uses the modulo 5 operations. I know a little bit of Mathcad, but I have checked it in wxMaxima, the answer is right. I don't know how to use those operations in Mathcad.

This is the website that has solved this problem in Maple, Mathematica & wxMaxima. I just wanted to make the Mathcad version of the same problem. Perhaps my question didn't convey the problem correctly. I'm sharing the link to the problem.

You can visit the website and check for yourself. I would be obliged if you please find a solution to this problem using programming in Mathcad.  23-Emerald III
(To:MUFASA)

As Werner has shown, you have to use the mod function: Success!
Luc  24-Ruby V
(To:MUFASA)

Even no solution contains a zero element, your loops should start from 0 and not from 1.

Note also the by default (you can change that behaviour) arrays are numbered beginning with 0, thats the reason for "i <-- 0". To apply the modulo operation on every element of the matrix T and not on the matrix itself (which makes no sense and results in an error) you have to use vectorization (the arrow over the expression). The temporary matrix T is necessary because we cannot write because if we do so, the matrix multiplication would be done element by element and not the correct way. Se the difference here: So here is one way to find the solutions via brute force: P6 file attached  6-Contributor
(To:Werner_E)

Thank you very much Werner_E 😀😍 & LucMeekes. 