Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Summing Values in Matrix 1

Status
Not open for further replies.

Keiker74

Structural
Jun 8, 2005
8
Does anyone know how I can add all the values in a i,j matrix. I want my program to generate a matrix using the following:

i =: 1..n
j =: 1..m

Matrices can be created for numerous values of n and m. An example is shown below:

L(i,j) = i*j

Where i and j are the indices, not functions for L. This creates a create a n x m matrix which is what I want but I want my MathCAD program to sum all values in the Matrix L for various i and j values. For instance if n=2 and m=2,

L = [ 1 2:
2 4]

I want my value for the sum equal to 1 + 2 + 2 + 4 = 9.
Note I set my Array Origin to 1. Any help would be greatly appreciated.
 
Replies continue below

Recommended for you

Why can't you use the summation function from the Calculus Toolbar?

TTFN



 
I have worked with the summation function for some time now. I thought i could not define matrices using this approach but apparently I wasn't defining the function correctly. Thank you for your help. I figured it out.
 
If you have large matrices, and/or have a lot of them to sum, you might find that

rows(L)*cols(L)*mean(L)

is quicker than using the summation operators. It is on my PC in ver 11.2a.

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor