Skip to main content
1-Visitor
January 25, 2011
Solved

Colouring interpretation - errors in blocks

  • January 25, 2011
  • 4 replies
  • 6644 views

Hello,

I tried to make everything super safe regarding unit handover in programms but the error remains. has anybody an idea what this red colouring woulde mean? The Mathcad error meassge is definitely wrong.

It appears both in Mathcad 14 and 15.

many thanks

Gerfried

Best answer by

Looks like mathcad is complaining that one of the assignments in this block has the units of m^4*kg^2/s^5 or W^2*s or W*J (all are equivalent) but it should have the units of J (energy).

Difficult to tell where the error is within the block, I would guess that it is on the lowest level as it would probably flag a smaller section if the error was in a higher one.

My usual method is to copy the whole program block including the assignment (:=) to a safe place (page to the right) ,right click on the copy & select the disable evaluation option. Now that there is a safe copy, delete the whole block in the 'working copy' & line by line copy the offending code back in until the error re-appears.

hope this helps

Andy

4 replies

1-Visitor
January 25, 2011

My German is very poor, but your error message says (I'm sure you know) that MathCad believes the units are not consistent. Start by checking the units for all parameters in your program--often I find that a built-in value (N is newtons force, for example) is the culprit.

Mathcad error messages are very confusing and often not correct. Good luck.

Fred

Answer
January 25, 2011

Looks like mathcad is complaining that one of the assignments in this block has the units of m^4*kg^2/s^5 or W^2*s or W*J (all are equivalent) but it should have the units of J (energy).

Difficult to tell where the error is within the block, I would guess that it is on the lowest level as it would probably flag a smaller section if the error was in a higher one.

My usual method is to copy the whole program block including the assignment (:=) to a safe place (page to the right) ,right click on the copy & select the disable evaluation option. Now that there is a safe copy, delete the whole block in the 'working copy' & line by line copy the offending code back in until the error re-appears.

hope this helps

Andy

Efried1-VisitorAuthor
1-Visitor
January 25, 2011

Thanks

I was told that the error must lay in the returning of variables with units, but I have removed them all, now.

Either there is a very sophisticated bug of mine or..... I hav eto change the software I work with.

Efried1-VisitorAuthor
1-Visitor
January 25, 2011

After deleting the nasty red parts I got a very interesting new error message which will bring me forward or backwark depending where the error is with me or with Mathcad.

Diese Funktion ist unvereinbar selbstreferenziell

whis could mean

This function is referring to istself in an non consistant way...

keep on hoping...

1-Visitor
January 25, 2011

Ok.

What are the units of P.nEA_m ?

what are the units of the function eff.BB ?

what are the units of Dt ?

At the top you define P.antr_m as 1 W, then have an If block that executes if it's negative. Is the assignment to 1W an attempt to troubleshoot? If it is, then this block would never execute; what happens if you leave the assignment in and cut out the whole If block?

Efried1-VisitorAuthor
1-Visitor
January 25, 2011

Thanks a lot. indeed the logic is odd- it was alterered avoiding error messages 😉

The inconsistent issue pertains I think the error may lay in some function handover...

keep on

January 26, 2011

Hi Gerfried,

There are possibly two issues here -

The first is that MathCad doesn't allow you to assign different units to different parts of the same array (matrix , vector etc)

So although some functions (eg find) can return systems that contain mixed units, it will not allow you to save them to a single variable it has to be referenced as the example.

By the comments in this forum MathCad Prime will allow this - so could be an improvement.

The second is the inconsistent reference & the only time I have seen this error message is when I have had a recursive function.

Usually I am trying to create a time repetative function as in the 2nd example.

I had created the function & after a lot of thought added a 2nd parameter to give me more flexibility on the use.

Unfortunately I didn't update all the internal calls to the function name & MathCad (quite correctly) complained.

Regards

Andy

19-Tanzanite
January 25, 2011

Is this the same program as before?

1-Visitor
January 25, 2011

Richard Jackson wrote:

Is this the same program as before?

I think so. Computer programmers do it again, hoping for a different result 😉