Skip to main content
1-Visitor
August 13, 2013
Solved

Error: These values cannot be compared

  • August 13, 2013
  • 4 replies
  • 7555 views

Hello everyone,

I have had to convert a MathCAD spreadsheet from one of the old formats to Prime 2.0 and I am having trouble with program functionality. The spreadsheet is essentially a group of sub-programs or routines that are called on in a larger program further down in the sheet (pg. 37). At this point the program will not run due to a "These values cannot be compared" error. I have converted similar worksheets with essentially the same sub-programs and sub routines and not had this problem. The error appears to be the Evolve sub-program (Pg. 33) but it does not provide the source ofthe error.

Any explanation as to what is wrong and how to fix it would be appreciated.

Best answer by Werner_E

OK, I gave it a last try and found the reason for the error but you will have to find out what causes Prime to give different results than Mathcad.

In the routine used to calculate xxx there is a loop which iterates the local variable t from 0 to 7200 (tmax/Delta_t). When t is 1483 the error is thrown because spybot gets complex and when Evolve() is called with that parameter, Evolves calls Er() with spybot as param and Er compares it with another variable for size which is not possible for complex numbers. I didn't bother to further investigate in finding out what causes spybot to take a complex value.

I changed the file by putting all above Evolve() in a collapsed area and deleted all after the calculation of xxx in the hope for a better performance (with not much success).

I turned the calculation of xxx in a function. The argument of that function (xxxfunc()) is the time value at which the calculation would stop (because a return is triggered) just before the call of Evolve() and return the values which would be fed into Evolve.

Its really a shame we don't have trace() anymore in Prime.

4 replies

1-Visitor
August 13, 2013

Don't be fooled by the document name. It is only considered a "Working Model" in MathCAD 15.

24-Ruby IV
August 14, 2013

1. Please call functions after its creating:

f(x, y, z):=....

f(1, 2, 3)=

and see an answer or... an error message.

2. We can have in Mathcad Prime values with different dimentions in matrix:

MatrixUnits.png

1-Visitor
August 22, 2013

Which functions do you see that are called prior to their creation? I cannot find any and the error is not that there is an undefined function or variable.

Also, I know that getting rid of the "removing dimensions" step would be much cleaner, but they did function in the old version and so I'd rather not remove that portion without exploring all of the options. It is so engrained in all of the subroutines and the final Program that I'm fairly sure that removing it at this point would make a huge mess. Unless you have any ideas on how to do this more simply?

1-Visitor
August 22, 2013

It seems to be pointing me to this portion of the Evolve subroutine. It looks exactly the same as a spreadsheet that I converted previously (that functioned normally). I'm still not sure what exactly is wrong with this or how this is causing the error.

Picture1.png

24-Ruby IV
August 23, 2013

Sorry - the function round has 2 arguments.

25-Diamond I
August 23, 2013

Valery Ochkov wrote:

Sorry - the function round has 2 arguments.

You MAY use 2 arguments with round(), but you mustn't - the second argument defaults to zero. So the syntax in the shown code snippet is OK!

Valery, maybe you confused it with Round() (note the capital R) - here you need two arguments.

Werner_E25-Diamond IAnswer
25-Diamond I
August 24, 2013

OK, I gave it a last try and found the reason for the error but you will have to find out what causes Prime to give different results than Mathcad.

In the routine used to calculate xxx there is a loop which iterates the local variable t from 0 to 7200 (tmax/Delta_t). When t is 1483 the error is thrown because spybot gets complex and when Evolve() is called with that parameter, Evolves calls Er() with spybot as param and Er compares it with another variable for size which is not possible for complex numbers. I didn't bother to further investigate in finding out what causes spybot to take a complex value.

I changed the file by putting all above Evolve() in a collapsed area and deleted all after the calculation of xxx in the hope for a better performance (with not much success).

I turned the calculation of xxx in a function. The argument of that function (xxxfunc()) is the time value at which the calculation would stop (because a return is triggered) just before the call of Evolve() and return the values which would be fed into Evolve.

Its really a shame we don't have trace() anymore in Prime.

19-Tanzanite
August 28, 2013

Well that's interesting! When I clicked on "Reply" I got a message saying "Please note, your reply will need to be approved by a moderator before it is posted in the forum."

Edit: OK. I just figured it out. It applies to everyone, on all forums. At the rate this post is moderated, solving someone's problem will now take weeks rather than hours (I posted last night at 10:30pm, it's now 3:20pm the next day, and still waiting....).

19-Tanzanite
August 29, 2013

Still being moderated?