Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

** Community Tip** - New to the community? Learn how to post a question and get help from PTC and industry experts!
X

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Jan 18, 2023
11:01 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 18, 2023
11:01 PM

Matrix Bug? Storing an integer zero in a matrix of mixed items gets returned as a value with unit

Mathcad Prime 8.0.0.0.0.0.0

So I am trying to store mixed data in a matrix. It is the only way to pass optional parameters to a user defined function. One of the parameters I am trying to pass is an integer (in my case representing the number of passes of welds in a welded structure). But when I supply a zero, my program reads the number as 0•m (or whatever units I set the document to.

See the attached Mathcad Prime sheet. Here is a screenshot if you can't duplicate my error

One possible workaround is to resolve the value this way: a / SIUnitsOf(a)

That should strip any value that is in meters of it's unit, but will not work for other units like when Unit System = USCS

Any other suggestions?

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

Jan 19, 2023
10:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 19, 2023
10:03 AM

I don't think that its necessary to ask for different length units as 0 m= 0 ft = 0 cm ...

If your intention is to strip off the unit from any quantity that is zero, regardless of the unit, the following should do he job a swell

nj=0 is TRUE even if nj is a zero valued quantity with an attached unit.

10 REPLIES 10

Jan 18, 2023
11:19 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 18, 2023
11:19 PM

Actually I am surprised that Prime adds the unit as (on contrary to Mathcad 14/15) its not using SUC (Static Unit Control) anymore.

Use the predefined "unit" zero instead of 0.

But note the lowercase "z" as otherwise ...

Just noticed that pseudounits "rad" and "rev" will do the job as well:

Jan 18, 2023
11:29 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 18, 2023
11:29 PM

It’s a neat idea @Werner_E but I do not think it is user friendly enough for most engineers that already struggle with Mathcad. The user need to input a ‘quantity’ and we engineers are SO used to numbers (no thanks to Excel).

Right now if I test if the number is 0•ft or 0•m, I can catch the bug and report a real zero:

I guess I should add 0•cm for CGS

This way the engineer can go ahead and supply an integer quantity of zero.

But do you notice in my examples that some situations it is a real zero and others it is 0•m? Prime should not behave like this--it is too erratic to rely on. THAT'S IT!!! BACK TO EXCEL!!!

Jan 18, 2023
11:50 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 18, 2023
11:50 PM

But do you notice in my examples that some situations it is a real zero and others it is 0•m?

Yes, I did and it looks confusing on first sight. You sure may consider reporting it as a buggy behaviour at PTC support.

On the other hand there is a pattern - whenever the matrix contains a plain number (different from zero) like the 2 or the 1 in your examples, the zero is not "enriched" by a "suitable" unit. I guess the documentation explains that this is exactly the reason for the units/constants "zero" and "Zero" and that they should be used in such cases.

Reasoning is that many user are used to use zeros without units when units are meant. So Prime adds the units if the matrix contains apart from the zeros only quantities with the same unit (strings don't count). When other units or plain numbers are involved, too, Prime can't tell which unit to assign and refrains from doing so.

But I agree that at first glance this behaviour appears inconsistent.

Prime should not behave like this--it is too erratic to rely on.

I sure would second that, yes! Prime should take the input as is And if the used means 0 volt or 0 meter must add the unit also when assigning values in a matrix. This would be consistent behaviour.

THAT'S IT!!! BACK TO EXCEL!!!

Excel? NO!!! Sure not!!! Maple, MatLab or, if you have a perpetual licence, real Mathcad (15 or 11). But sure no spreadsheet software! Excel is more danger than help when it comes to engineering projects.

Jan 19, 2023
12:10 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 19, 2023
12:10 AM

Well, I meant it to sound like a joke and you got it 🙂

But the sad truth unfortunately, we engineers (at least structural engineers) make gazillion dollars solving a gazillion engineering problems with 'vulgar math' as opposed to 'academic math' (if these term make any sense). Like, there is a simple shortcut key for partial derivatives, "Ctrl-D", yet no shortcuts for simply changing the number of decimals of results or simple font size +/-. I don't think there is a single engineer in my company that has ever performed a partial derivative, except in their masters/doctorate classes.

The real laugh, imho, is when you go to the homepage www.mathcad.com, the first sentence is "Engineering calculations are essential for product design." They are pushing this on engineers because there is real money there (we have no shortage of work). But PTC still thinks that the 'academic math' approach is where the money is but it's keeping many engineers stick with Excel.

I really really *want* to like Prime. It looks great. But there are so many short comings when it comes to simple vulgar math.

Edit: Maybe 'accessible math' is a better term for 'vulgar math'

Jan 19, 2023
12:53 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 19, 2023
12:53 AM

Yeah, Mathcad/Prime __could__ be a great tool, but unfortunately not the way PTC handles the "development".

There will be not much change, though, and so we have to take it as it is or leave it alone.

Jan 19, 2023
09:17 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 19, 2023
09:17 AM

Too true, too true. You ain't gonna see that on there website.

My latest fix is this: I broke out the different data into their own lists (turned out simpler with the future calculations) and made a specific test for the different zero unit values:

And I used your idea to specify the zero constant. The resulting lists are all variables regardless when I change the unit system to any of the three. My only fear is if rounding errors can possibly creep up with some update so I should also round then check the values.

Thanks for the discussion @Werner_E

Jan 19, 2023
10:03 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 19, 2023
10:03 AM

I don't think that its necessary to ask for different length units as 0 m= 0 ft = 0 cm ...

If your intention is to strip off the unit from any quantity that is zero, regardless of the unit, the following should do he job a swell

nj=0 is TRUE even if nj is a zero valued quantity with an attached unit.

Jan 19, 2023
12:46 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 19, 2023
12:46 PM

Even better! This is a simple fix that I can leave in for good. Thanks @Werner_E -- you get all the Kudos

Jan 23, 2023
05:09 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 23, 2023
05:09 PM

so @Werner_E, it seems like Mathcad is working as it is supposed to as per their technical response. They pointed me to this article: https://www.ptc.com/en/support/article/cs280864

They say it's for legacy calculations but I though Prime was standing on it's own? Anyway, it's too random of a chance for me to allow mathcad to do whatever it wants for stored values. I will have to keep testing the results to force it the way I want and always test mathcad results to make sure they make sense.

Jan 23, 2023
07:22 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator

Jan 23, 2023
07:22 PM

Considering legacy calculation??

Because of SUC it was not necessary in legacy Mathcad to assign a unit for zero valued quantities.

So a lot of older worksheets fail to work correct just because of this. PTC has dropped SUC (and it wasn't a bad idea doing so) and that way also drop compatibility to legacy sheets in some parts. So It would have been better to consequently demand for units in zero valued quantities and on the other hand also treat a zero without a unit just as that and not adding a unit because Prime thinks that this might be what the user meant.