Post Reply 
HP-71B: Min Max from Row or column in a matrix
01-02-2016, 09:26 PM
Post: #2
RE: HP-71B: Min Max from Row or column in a matrix
(01-02-2016 08:17 AM)Erwin Wrote:  I tried to find an easy solution for to find the maximum, the minimum and the sum from rows and columns of a matrix on my HP71b.

I am not at all familiar with the HP71's BASIC dialect, so I can't say much about user-defined functions and passing arguments by reference or value, but all this should be easy to do. The following example is some VBA code that calculates the sum of all matrix elements in the 3rd row of matrix A.

Code:
...
nrows = ubound(a, 1) ' get number of rows
ncols = ubound(a, 2) ' get number of columns

row = 3  ' get sum of elements in 3rd row -- usually this is passed as a parameter of a user-defined function
sum = 0
for j = 1 to ncols
  sum = sum + a(row, j)
next
rowsum = sum
...

As far as I know the UBOUND function is also available in the 71B Math ROM, it returns the highest index of an array. Of course you would write this as a dedicated function rowsum(matrix, row), but since I don't know much about HP71 BASIC... Here the 71B community will know more.

But all this (including min/max functions) is so simple that I wonder if this really is what you are looking for. ;-)

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HP-71B: Min Max from Row or column in a matrix - Dieter - 01-02-2016 09:26 PM



User(s) browsing this thread: 3 Guest(s)