## Mathcad needs a "remove units" function.

## Mathcad needs a "remove units" function.

(OP)

I like Mathcad's ability to convert between different units but some times it is nice to remove the units. I know that dividing by the units will work but that is kind of a kludge.

A simple ru(var) function would be nice. Then one can do this

var_unitless = ru(var_with_units)

I have spent too much time fussing with units.

Variables with exponents and returning multiple variables from a function is a pain in the back side.

The c programmer in me wants a type() function too

I am still using Mathcad 13 a lot because it is the devil I know. I haven't upgraded because the upgrades haven't really improved the product from what I have seen so far.

A simple ru(var) function would be nice. Then one can do this

var_unitless = ru(var_with_units)

I have spent too much time fussing with units.

Variables with exponents and returning multiple variables from a function is a pain in the back side.

The c programmer in me wants a type() function too

I am still using Mathcad 13 a lot because it is the devil I know. I haven't upgraded because the upgrades haven't really improved the product from what I have seen so far.

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/

IFPE Hall of Fame Member

## RE: Mathcad needs a "remove units" function.

If you need to strip units (e.g. because you are using an empirical Code expression which is dimensionally inconsistent, and assumes a particular set of units is being used for all terms in the expression), then you need to be

VERYcareful that you are using the correct units when you "strip" the expression. Dividing out the various terms by the units used is an error-free means of creating a dimensionless expression when required; to not do so risks gross error if you happen to be using incorrect units for any of your variables.E.g. the Australian Concrete code defines the characteristic flexural tensile strength of concrete in terms of the compressive strength as being:

f'ctf = 0.6 (f'c)^0.5

This expression only works when the tensile strength and compressive strength are in units of MPa, it won't work when you are using Pa, psi, ksf, etc.

If you try to code the expression exactly as written, Mathcad will return incorrect units of (stress)^0.5 for the flexural tensile strength - which is a surefire sign that you have either made an error in entering your expression, or that the expression is dimensionally inconsistent. Either way - this is one of the best error-trapping features of Mathcad in my opinion.

You need to write the expression dividing f'c (and / or any other terms) by their units to render them dimensionless, and then multiply the solution back by the desired units to get the expression to work. An added bonus is that you can then view your results in whatever units system you like; e.g. you may be using a metric SI source document, but you want to present the results in US customary units for your audience.

Conversely - if you do create dimensionless expressions, there is a chance that someone (maybe even you!) will use your worksheet with incorrect units for the various terms, and get catastrophically incorrect results. This is the main reason that I use Mathcad rather than Excel as my "go-to" engineering calculation tool.

http://julianh72.blogspot.com

## RE: Mathcad needs a "remove units" function.

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Engine-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://engine-tips.com/forumlist.cfm

## RE: Mathcad needs a "remove units" function.

I think I know what you mean. There are some archaic engineering expressions published in the 1800's that americans still use for bridges and planes and rockets which were originally written in unitless form and a pain to solve in Mathcad without removing the units, then putting them back on. It wouldn't be so bad but the empirical equations tend to be the things you want to copy-paste into a report so they have to look like the original thing...

Attempting to develop a universal units stripping function would be dependent on the unit system your empirical equation uses - which is NOT always internally consistent, either!

For example, there is a standard gust velocity equation specified by the FAA (use it as they specify or never fly your plane) that is based on both feet/second and knots at the same time, slugs and pounds at the same time. You could never come up with an automatic function that could deal with that. You have to divide out each variable's units per the intent of the equation.

www.sparweb.ca

## RE: Mathcad needs a "remove units" function.

It also happens when the units are such a pain that they aren't used at all.

Mathcad does not have structures. I often return arrays of target positions, actual positions and control output.

I cannot return an array of arrays when they have different types.

I could do this with a structure.

Now I divide by the units to return an array of unitless arrays.

I have also hand problems with the gas laws where PV^1.4=nRT

I use this formula for sizing and simulating hydraulic accumulators in a system.

The dividing by units looks so screwy when I make videos.

It is just one more thing I must waste time explaining.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/

IFPE Hall of Fame Member

## RE: Mathcad needs a "remove units" function.

But, for a typical empirical formula, you have to explain what the units are anyway, and the person has to have a crib sheet or a giant footnote that captures that information, and can still get it wrong. In this case, it's captured directly in the equation itself, so I think you should spin it that way, "It's a self-documenting empirical formula that eliminates the crib sheet of the correct units needed to make the equation work, and allows you to detect entry errors with the units"

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Engine-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://engine-tips.com/forumlist.cfm

## RE: Mathcad needs a "remove units" function.

But, for a typical empirical formula, you have to explain what the units are anyway,

[/quote]

I do! I just don't use the units feature or Mathcad. You, IRstuff, have seen a few of my Mathcad worksheets on control. I explain the units in text but I don't apply units to the variables.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/

IFPE Hall of Fame Member

## RE: Mathcad needs a "remove units" function.

TTFN (ta ta for now)

I can do absolutely anything. I'm an expert! https://www.youtube.com/watch?v=BKorP55Aqvg

FAQ731-376: Engine-Tips.com Forum Policies forum1529: Translation Assistance for Engineers Entire Forum list http://engine-tips.com/forumlist.cfm

## RE: Mathcad needs a "remove units" function.

On the other hand, all the extra units start to clutter things up if you are manipulating a lot of variables in complicated expressions, so I can see the other side too.

On the third hand (wait I ran out of hands!), maybe those complicated expressions are exactly the times that you most need to carry your units (to avoid errors).

Either way, it is what it is (mathcad isn't going to change).

=====================================

(2B)+(2B)' ?

## RE: Mathcad needs a "remove units" function.

What units should Mathcad assume when you apply the unitless function to get a scalar result? E.g. if the expression has dimensions of "Power", should it present the numerical result as watts, milliwatts, kilowatts, megawatts, horsepower (Imperial hp or metric hp?), BTU/hr, ...

All are commonly used units of power - what should Mathcad assume? How would it know?

And what should it do for empirical dimensionally-inconsistent expressions, like my example of the Code expression for tensile strength of concrete? Such expressions only work if the variables are entered in the correct units - how would Mathcad know whether you have used the right units?

http://julianh72.blogspot.com

## RE: Mathcad needs a "remove units" function.

Peter Nachtwey

Delta Computer Systems

http://www.deltamotion.com

http://forum.deltamotion.com/

IFPE Hall of Fame Member

## RE: Mathcad needs a "remove units" function.

I think you missed my point. Let's say you calculate the power demand of an electrical device to be 250 milliwatts. What scalar value should the "strip units" function return? 250? 0.25?

The calculation is part of a control system for an electric vehicle drive system, with a 100 kW motor. What scalar value does the "strip units" function return for the motor power? 100000? 100? 134 (horsepower)?

http://julianh72.blogspot.com