November 2008
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 Mathcad User Forums at http://collab.mathsoft.com/~mathcad2000 is the place to go for answers to your Mathcad questions for new users and experienced users alike.


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.


Method 1




Method 2




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.



Right-click, choose Save Target As, and change the extension to XMCD and File Type to All to download Mathcad 14 file  or click to download Mathcad 11 file.

Was this article helpful? Let us know.















[PRINTER FRIENDLY VERSION]
HOME

Pro/ENGINEER Manikin - A Human-Centric Approach to Design
PTC Updates
Tips of the Month
Knowledge Base Exclusive
Mathcad Methods
Webcasts & Events
The Solution for High-Speed Machining

Contact PTC | Privacy Policy | PTC Express Archive | Subscribe | Edit Profile

  PTC, 140 Kendrick Street, Needham, MA 02494 USA