Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
I have a question >> What it is the difference when mathcad write the unit of a resulte inside the brackets [result*Unit] and outside [result]* unit?
is there any difference ? and how to make all units showed the same way?
Thanks in advance
Yusra
Solved! Go to Solution.
If all elements of a vector/matrix are of the same dimension, then Prime uses to place the unit (for all elements) after the matrix and you are also allowed to change this unit to something you like more.
If the matrix contains quantities of different dimensions, Prime places the units right to the values inside the matrix and unfortunately does not allow to change this unit directly. You can write a different unit after the matrix and Prime will change the units inside the matrix accordingly - sometimes with unexpected effects.
In case of nested matrices Prime seems to show units only if all the dimensions in a 'subvector' are the same. Manually editing the unit at the end of the matrix without expanding nested matrices has a strange effect which maybe also could be called a bug...?
If all elements of a vector/matrix are of the same dimension, then Prime uses to place the unit (for all elements) after the matrix and you are also allowed to change this unit to something you like more.
If the matrix contains quantities of different dimensions, Prime places the units right to the values inside the matrix and unfortunately does not allow to change this unit directly. You can write a different unit after the matrix and Prime will change the units inside the matrix accordingly - sometimes with unexpected effects.
In case of nested matrices Prime seems to show units only if all the dimensions in a 'subvector' are the same. Manually editing the unit at the end of the matrix without expanding nested matrices has a strange effect which maybe also could be called a bug...?
Yes, that's why I wrote "without expanding" 😉
does that affect the results, or just the units?
@YA_10963798 wrote:
does that affect the results, or just the units?
In itself, it is only a representation problem of (nested) matrices. But of course the numbers in the matrix are adjusted accordingly if you change the unit at the back.
You also need to be careful if you have NaNs in your results. A NaN will attract the units of the first element with units in a matrix.
I noticed it in this thread: https://community.ptc.com/t5/Mathcad/Vectorizing-SIUnitsOf-over-array-containing-NaN/m-p/981787/highlight/true#M214833
There is a bug report in the system that will hopefully deal with this issue in a (not too distant) future version.
I also found that it was commented on in this thread back in January 2023: https://community.ptc.com/t5/Mathcad/Having-fun-with-NaNs-and-mixed-units-in-matrices/m-p/852699/highlight/true#M204913. I was unaware of this thread until I searched for my thread; I also found the '0' problem and that behaviour should also be addressed as part of the same bug report.
Stuart
Yes my results contain NaN >>> I read the thread , but I don't understand how to solve this bug? should I replace NaN with manual zeros ?
I think I'm facing another problem as well
when I use the results in the following calculation mathcade gives an error ( units are not compatible) although all the varibles in that equation are in same unit (MPa)
I know I can divide them by their units like this:
but this is wrong in engineering ..I can't do that
in previous sheet when all units were represented the same way I didn't get such an error
@YA_10963798 wrote:
Yes my results contain NaN >>> I read the thread , but I don't understand how to solve this bug? should I replace NaN with manual zeros ?
Hi, Yusra.
In this instance, if you haven't explicitly set the NaNs to have units Pa (or kPa), then the bug works for you if you want consistent units, but it should not be relied upon as a future version of Mathcad may change the behaviour. It's also good practice to set values to the appropriate units (which I know you know!).
What would you want to happen?
@YA_10963798 wrote:
I think I'm facing another problem as well
when I use the results in the following calculation mathcade gives an error ( units are not compatible) although all the varibles in that equation are in same unit (MPa)
I know I can divide them by their units like this:
but this is wrong in engineering ..I can't do that
It's wrong in engineering to not take account of units, but it's not wrong to remove units when needed to support the restrictions imposed by the mathematics or the software. For example, units might have to be removed to use a trigonometric or exponential function, or a given software function/method might not support units; indeed, many programming languages have no direct support for units. What would be wrong in the case of Mathcad is not restoring the units after performing such a calculation.
Do you have a link to the worksheet that has the problem?
Stuart
Hi Stuart
Sorry for the late reply.
I want to get f2 without the need to divide the varibles in the function by their units ..Is that possible ? it is on page 19
Thanks in advance
The problem appears to be due to one of the elements having all 43 elements of Mi;c;middle set to all NaNs. This in turn is down to replacing 0s with NaNs but not giving the NaNs suitable units.
Stuart
Thank you Stuart , I appreciate your help .