Finding the Answer to Summing a Matrix
|
A user poses a question in the Mathcad Collaboratory User Forums on Monday evening at 6:09 PM, "I'm trying to sum the elements of a matrix. Any suggestions?"
By 6:44 PM, a power user has posted the program below, and the conversation continues, with other power users posting alternate solutions and discussing the merits of each, including speed and compactness in both Mathcad version 11 and Mathcad version 14. |
|
The Collab as it's fondly known, is also the place to argue the merits of Mathcad units and algorithms; find out how to use scripts; run and compare your sheets with other users; connect with Mathcad experts in your field; and search for examples beyond what's covered in the documentation. And don't forget here's a place to suggest new features and get them recorded.
Summing a Matrix |
|
Finally for those who want to know, here are some suggested methods and refinements of those methods to summing a matrix |
|
Try out the attached files in Mathcad 11 or Mathcad 14, then post your solutions in the Collab for someone else to comment on. |
|
Here are two more methods posted by other power users in the Collab. |
|
This one looks straightforward, but the iteration over M is costly for larger matrices. |
|
And here it is with no range variable needed. |
|
This version takes advantage of the built-in feature that sums elements of rows. It still requires looping (over elements in A. |
|
What each step produces... |
|
Mathcad examples contributed by Jean Giraud, Tom Gutman, Richard Jackson, and Richard Messeder. |
[PRINTER FRIENDLY VERSION]
|