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

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

max function applied on matrix/vector with strings gives inconsistent results

tthys
1-Newbie

max function applied on matrix/vector with strings gives inconsistent results

Please check the sheet attached.

If I use the max-function on a matrix filled with strings, it returns a result.

If I use the same function on a column of the matrix, it gives an error ("These values must all be of one type")

If I assign the column of the matrix to a new variable, but don't evaluate and then use the max function on the new variable it errors

If I assign the column to a new variable and evaluate, then use the max function, it gives a result

If I write a little program and search the max of a column with different values, it errors but in the same program, if I search the max of a column (transpose of a row in this case) with identical values, it doesn't error.

Can anybody explain this inconsistent behaviour?

1 ACCEPTED SOLUTION

Accepted Solutions
Werner_E
24-Ruby V
(To:tthys)

This is really a crazy bug. A simple double transpose of the matrix does the job, too:

So a suitable workaround function could be

Its a pity that we can't create user functions with a variable number of arguments.

View solution in original post

6 REPLIES 6
Fred_Kohlhepp
23-Emerald I
(To:tthys)

Nothing a little brute force can't cure:

Werner_E
24-Ruby V
(To:tthys)

> Can anybody explain this inconsistent behaviour?

No. I would call it a bug and you may report it to PTC.

But you should note that PTC is not really interested in bug reports and so they only offer to do so for paying customers under maintenance - probably just to make them feel better.

tthys
1-Newbie
(To:Werner_E)

I can imagine they're not to eager to put time and resources in fixing bugs in Mathcad 15 while they have all that work laying around making Prime look like something decent...

Werner_E
24-Ruby V
(To:tthys)

Here is a workaround for this bug. A new function max for 1 single argument, so you may want to rename it max1 - otherwise you can't use max with more than 1 arguments.

Werner_E
24-Ruby V
(To:tthys)

This is really a crazy bug. A simple double transpose of the matrix does the job, too:

So a suitable workaround function could be

Its a pity that we can't create user functions with a variable number of arguments.

tthys
1-Newbie
(To:Werner_E)

I think I'll go for this solution, as silly as it looks...

Top Tags