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

4-Participant

## Finding the Max Value from Part of a Matrix

Please see the attached file. I need a simple and elegant solution for finding the max value from part of a single column matrix. Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
23-Emerald II
(To:JJ_9094500)

Here are some variants on the answers already given plus an additional one that allows you to choose whichever elements you want from A.

Note that the functions were written in Mathcad Prime Express 7.  Express does not have programming and so breaks a function down into a sequence of successive (functional) steps.

Mathcad Prime Express 7 worksheet attached.

Stuart

9 REPLIES 9
19-Tanzanite
(To:JJ_9094500)

24-Ruby II
(To:JJ_9094500)

Hi,

Martin Hanák
23-Emerald III
(To:JJ_9094500)

Or, in one go, and irrespective of the value of ORIGIN:

Prime4 file attached.

Success!
Luc

8-Gravel
(To:JJ_9094500)

23-Emerald II
(To:JJ_9094500)

Here are some variants on the answers already given plus an additional one that allows you to choose whichever elements you want from A.

Note that the functions were written in Mathcad Prime Express 7.  Express does not have programming and so breaks a function down into a sequence of successive (functional) steps.

Mathcad Prime Express 7 worksheet attached.

Stuart

17-Peridot
(To:JJ_9094500)

Hello, I can confirm that submatrix() and programs are applicable and are the intended approach.

However, getting back to initial request to "simple and elegant solution": Utilizing simple Mathcad definition capabilities, please compare this:

23-Emerald II
(To:MWunder)

See the second line in my response - the shuffle was just there to randomize the data for test purposes (and provide a function that is potentially useful in other circumstances).

(the image is just a continuation of the OP's original)

Stuart

17-Peridot
(To:StuartBruff)

Well I see. Thank you for the reminder.

Seems that the initial post caused a lot of elegant and other related solutions.

I'd say that this solves the issue anyway.

What you think?

23-Emerald II
(To:MWunder)

@MWunder wrote:

Well I see. Thank you for the reminder.

Seems that the initial post caused a lot of elegant and other related solutions.

I'd say that this solves the issue anyway.

What you think?

On the surface, I agree that it would appear closed.

However, I'm always curious as to what the source of the problem is.  For example, why the max of the first 3 of 20 items, and why "matrix" instead of "vector"?  Sometimes, there's a bit more to the story that can invalidate the proposed solutions or make them just a subset - eg, the user might want to specify a column of a matrix or realize they need the location of the item as well.

Stuart

Announcements