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** - Learn all about the Community Ranking System, a fun gamification element of the PTC Community.
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

Jun 10, 2012
12:44 PM

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

Jun 10, 2012
12:44 PM

A question about Units in MathCad Prime 2.0

I'm being "lazy" and using MathCad Prime (as I used MathCad) as a very souped-up calculator. I'm working with a 16-bit Digital-to-Analog Converter that has a range of ±10v, so I defined a unit DAU (D/A Unit) as 32768/10, and gave it the units of 1/V (where "V" is the units Volts).

The signal I'm sending through the D/A is the position of a sled, controlled by a stepper motor, where 8000 "steps" corresponds to 4.92 inches of travel. So I define a SU (Stepper Unit) as 4.92/8000 in (where "in" is the unit Inches).

Finally, I want to have the full range (10V) of the D/A converter correspond to 36" of travel. So what is the conversion factor from Stepper Units to D/A units?

Easy -- it is 1 SU times 10V/36 in times DAU. It does, indeed, give me the right answer, but the units show up as 1/V times V, i.e my Volts units do not cancel. I'll attach a file to illustrate what I mean.

Why don't the units cancel? Does explicitly declaring a "reciprocal unit" confuse MathCad? Is there a workaround that fixes this problem? Or is it a bug?

11 REPLIES 11

Jun 10, 2012
01:41 PM

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

Jun 10, 2012
01:41 PM

I used the same spreadsheet and did another problem, and the Volts cancelled! Indeed, simply copying the last "math" line below the final text box and re-evaluating it gets rid of the V/V units. Seems like a bug, but not a very serious one ...

Jun 11, 2012
01:52 AM

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

Jun 11, 2012
01:52 AM

They do cancel out, just delete the units.

MIke

Jun 11, 2012
10:34 AM

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

Jun 11, 2012
10:34 AM

If one simply "cancels the units" by hand, then why use units at all? The point of using units in MathCad, it seems to me, is to let MathCad handle conversion factors for you, and to do some (what we used to call) "Unit Checking" to see if your calculation is wildly off because you forgot a term. [I'm reminded of complicated College Physics problems, where once you balanced the equations so all the units came out, you probably had the numbers arranged correctly].

As I note below, if you simply repeat the expression that has the un-cancelled units a second time, MathCad "does the right thing" and cancels them as it should have done the first time. This is called Having Your Cake and Eating It, Too.

BS

Jun 11, 2012
06:26 AM

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

Jun 11, 2012
06:26 AM

I have seen some instances where Prime failed to recognise a typed unit as a unit. If this werre the case for the "V" in "1/V" then "1/V" times a unit "V" would not cancel. (Selecting "V" from the pull-down unit tool should cure that.

Jun 11, 2012
10:30 AM

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

Jun 11, 2012
10:30 AM

Fred,

Thanks for the suggestion. However, pasting the V from the "units" tool (whereever it was used) didn't work. I also tried, when defining DAU, to put the units in the denominator of the expression (instead of creating a 1/V unit for the whole thing), but that generated an error.

What does work is to simply put a copy of the expression that generates the 1/V * V "unit" to the right (or below) so that it evaluates again -- the second time, the units cancel (as they should). So it is clearly a "minor bug".

Jun 11, 2012
01:24 PM

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

Jun 11, 2012
01:24 PM

It's because you have a V in the units placeholder. Delete the evaluated answer, and then type "=" to evaluate it again. You will see a unitless answer. If you now type V in the units placeholder Mathcad is forced to add a 1/V so that the units still balance. You will get the same effect with any unit, or combination of units, typed into the units placeholder.

Jun 11, 2012
02:14 PM

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

Jun 11, 2012
02:14 PM

I'm puzzled by your statement that I have a "V in the units placeholder". What you see is what I typed into MathCad Prime (up to the "=" after the expression that results in the 1/V * V units). Curiously enough, I was sufficiently intrigued by your comment that I opened a blank sheet and typed in the three lines of Math again -- to my great surprise, the "extra units" are no longer there! It's not at all clear to me why it works once, but not twice (oohh, the submitted example was from a different PC, though that shouldn't be an issue, should it?).

BS

Jun 11, 2012
02:46 PM

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

Jun 11, 2012
02:46 PM

Are you sure you didn't type V in the place holder in the first place.

Mike

Jun 11, 2012
03:03 PM

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

Jun 11, 2012
03:03 PM

Yes, absolutely sure. I just typed the "=" sign, and let it evaluate. WYSIWIG (What You See Is What I Got).

BS

Jun 11, 2012
03:05 PM

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

Jun 11, 2012
03:05 PM

Fair enought. All I did was delete the unit and Mathcad accepted it, problem sorted 🙂

Mike

Jun 11, 2012
03:48 PM

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

Jun 11, 2012
03:48 PM

It's not at all clear to me why it works once, but not twice (oohh, the submitted example was from a different PC, though that shouldn't be an issue, should it?).

It's one of those things that will probably remain a mystery. Unless it happens again, I wouldn't worry about it.