cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X

Hide and show units

illi13
1-Newbie

Hide and show units

Hello!

Is there, in Mathcad, some possibility to hide the units in equation, which is presented using explicit function from Symbolic toolbar, and show unit again at result?

Why Mathcad do not have such possibility to hide units in some part of equation and present them again if this is necessary for example at result?

Best regards,

Illimar Kalk

1 ACCEPTED SOLUTION

Accepted Solutions
MikeArmstrong
5-Regular Member
(To:illi13)

I'm not quite sure I understand what your after.

Can't you assign the value and unit to a variable and then the equation only contains that variable?

Mike

View solution in original post

17 REPLIES 17
MikeArmstrong
5-Regular Member
(To:illi13)

I'm not quite sure I understand what your after.

Can't you assign the value and unit to a variable and then the equation only contains that variable?

Mike

I attach the file (Mathcad 15 trial), where is some explanations.

PhilipOakley
5-Regular Member
(To:illi13)

I see it now.

However it does depend on you already having the numerical values having common units. The ability of MathCAD to do the auto convertion of one unit (e.g. ft) to another (i.e. m) is one of its special tricks.

It may be nice to have a step where there is a "hidden" area of the sheet that implicitly has the conversions, so that those conversions can be shown as one (initial) step of the explicit conversion, so that you then do have a step where all the base units and their dimensions automatically cancel out.

It almost requires a step called "SubstituteUnits" (from the symbolic toolbar) where an entry of "ft" is substituted for "0.305 m", and then you do a "cancel_base_units" stage (i.e. hide them) where you are left with the residual numeric values (except for one set at the very right hand side to ensure correctness), and finally that explicit = result with your choice of units in the place holder [this final step may be two steps if you aren't using a coherent unit like Joule for N.m etc. If you use BTU the number won't match]

I suspect it is a more complicated problem than you suspect, especially is you are needing to retain the report for external checking. There are so many ways that people 'like' their reports and so many ways to go wrong when you hide stuff.

I do think that the "hidden area" concept should be made available though. MathCAD already knows which built in units the sheet uses, so it should be simple to show them as conversion factors down to the base units. (e.g. "Show/Hide units in use" menu)

Philip

RichardJ
19-Tanzanite
(To:illi13)

I have two answers to your question.

The first one is that the symbolic engine does not know about units. It just sees them as undefined variables, and displays them as such.

The second is that displaying the values without the units is not correct. If I assign 2000*gm to the variable then it could be correctly displayed as 2000*gm or as 2*kg. Displaying it as 2 is simply wrong though.

PhilipOakley
5-Regular Member
(To:RichardJ)

Richard Jackson wrote:

the symbolic engine does not know about units. It just sees them as undefined variables, and displays them as such.

Aye, it's a bit pathetic isn't it. The symbolic engine capability (that's the overall integrated capability) really should be a bit better by now !

If there was a 'hidden" reference sheet that had the definitions of the many unit symbols, nicely cascading back to the base units and base dimensions, then it would nicely be able to do the substitutions and then cancellations. That symbolic keyword I suggested could simply be mathcad calling up the reference sheet for the substitutions (even an xmcdz with password protection to hide it from us scoundrels <mischief>)

But unfortunately all that is still wishful thinking <sad>.

Philip

Philip,

I don't get what the hoopla is about.

I don't want units in my symbolic solutions, If I did that, then I would have to remember what units I used when I developed the equation.

On the occation that I might have units in the equation for constants or emperical numbers, Matcad correctly deals with the units in the result, and if I used user defined units, Mathcad resolves those into base units.

I think to do otherwise is asking for user mistakes. (which I am well suited to do on my own).

What the original question was trying to get at or do excapes me.

Maybe what the real problem he was having was not clearing the symbolic definition of the variables (as Mike was discussing)

To clarify a little, if that was indeed the real problem, there are two definitions of a variable, a numeric one and a symbolic one.
w:=2*plf is a numeric definition, after this is defined, if you want a symbolic result, then you must add w:=w, then the symboic
processor will use w; the numeric definition still exists.

any way, that my 2 cents. (my last 2 cents)

Wayne

PhilipOakley
5-Regular Member
(To:wayne)

Hi Wayne,

The units conversion discussion is a long one. There are a number of different approaches as to when and where to do units conversion, and then there is also the option of dimension checking to aid in catching mistakes.

At one end of the scale there is the Excel/Calculator view that dumps all the issues onto the fallible human (always it's the other guy ;-), and at the other end of the scale is the expectation that the software should do it ALL (no matter how stupid I am ;-). I look to have software that supports me as far as is possible and spots my silly mistakes (e.g. I use a spell checker, but I don't let it auto-correct MathCAD to something else!).

I see most of the problems from a UK designer in a specialist defence related area, so I tend to see predictions and calculations for new and innovative designs, where direct re-use of old worksheets is un-common, rather I tend to see re-works and updates of sheets with major new expressions added. In particular I'm in electro-optics where many many calculations use angular measure (ratios and multiplications of). So I often see new calculations which because of some misunderstanding, MathCAD flags as dimensionally inconsistent, which supports the designer in gaining the wider understanding of what is happening. And I also see erroneous ones where the lack of check Angle checking hasn't been noticed, but could have been (automatically).

When folk do stuff in Excel, Matlab, hand calculations, C code, etc, these oversights (and we are all equally fallible) of bad unit conversion or dimensions of results tend to be missed. Some can last for years (in important engineering calculations these rarely exceed 5-10%, 'cos we'd notice otherwise!). There are cases where MathCAD (i.e Mathsoft/PTC) has converted older excel sheets used in some industry and found that they have had those errors for years.

I'm aware that in some US engineering projects where certain codes have to be followed, you need to 'show all working' to allow others to cross check the steps, and be able to repeat the important ones (if desired) by calculator. Which is why MathCAD brought in the "explicit" keyword mechanism. The problem then comes as to how to handle those pesky unit conversions, especially as the symbolic engine (which does the explicit substitution) hasn't been told about them!

I'm fortunate, most of the time, to be working in SI (and its multiples), rather than Imperial, but do have the occasional nautical mile and altitude in ft, but thankfully no forces in pounds, so the unit conversion is more "obvious", but it still gets tricky (when simply taking in numbers) when given distances in inches, etc. I've seen some disasters in plain number calcs (usually resulting in lost time and productivity, rather than real consequences).

So yes, it is a big discussion. MathCAD needs to be flexible and have clear user options to give the user the strength of a real power tool.

Philip

Thanks Phillip,

I have seen some of the posts regarding angular uints, I han't had any problems, but my field perhaps does not have the issues,
what's the problem with a few degrees off when your tarkting and ICBM any way.

When I work with matrices or matrix inputs for programs, I must divide out the units and multiply the result by consistent units. You can do this with and equation and get the requested result, but its extra work.

Thanks,

Wayne

MikeArmstrong
5-Regular Member
(To:wayne)

When I work with matrices or matrix inputs for programs, I must divide out the units and multiply the result by consistent units. You can do this with and equation and get the requested result, but its extra work.

Extra work, looks horrible and shouldn't have to be done.

Mike

MikeArmstrong
5-Regular Member
(To:illi13)

If you remove all units from Mathcad how it is meant to know what unit the answer should be in.

In your worksheet you say that the process is only necessary documentation purposes. Then why don't you pre-define all variables in the equation?

Mike

MikeArmstrong
5-Regular Member
(To:illi13)

There is a way around the problem if your adamant how you want to display your results.

Have a look in the attached worksheet.

Mike

Message was edited by: Mike Armstrong - Cheers Richard, worksheet attached

Have a look in the attached worksheet.

I think you forgot something

Hello!

I get the point.

I still hope that some day in Mathcad, there will be a opportunity such as "Hide keywords" for base units. It means that the unists are taken account in equations and user will have possibility to hide or to show them without doing an extra work.

Thanks!

Illimar

wayne
3-Visitor
(To:illi13)

I don't know that I disagree, but

I worry about the unintended consequences of things like hiding units. The explicite feature is nice, but I see it as more of a development tool, or working as you go. If you need it, I think you need the units also.

Regarding matricies, take a stiffness matrix, there are units of lbf/in, lbf*ft/in mixed up in the matrix, how is Mathcad suppose to know what goes where unless you tell it. And that is what you do when you divide out the units for the different elements.

RichardJ
19-Tanzanite
(To:wayne)

I don't know that I disagree, but

I do disagree

I worry about the unintended consequences of things like hiding units.

The uninteded consequence is that what is being displayed is just plain wrong. If I enter 5*lb what is it supposed to display with no units? 5? 2268? 2.268? 80? Without the associated unit the number is meaningless.

IRstuff
3-Visitor
(To:illi13)

OK, I KNOW I disagree.

If your calculation started with units, it should ALWAYS show the result with units, particularly since it shows the numerical result of the correct calculation anyway. What is the point of hiding the units? Is someone really going to get confused by the units being there? If so, should that person really be involved in anything related to engineering or construction?

Additionally, I've already lamented the monotonically increasing slowness of Mathcad, due to its every increasing burden of units checking, provenance checking, etc. Do we really want to have yet another thing that's bound to slow down the processing that Mathcad is supposed to be doing? As it is, I still retain M11 because it loads about 2x faster than M14, and runs faster for the calculations I do, which are similar to Philip's defense applications, but since I'm in the US, I do get the full brunt of the split personality that is the US DoD, wherein SI units are freely mixed with CUSU. Mathcad is indispensable in such an environment, and I've never had anyone ask to see only the numbers without the units. As Richard stated, numbers without units are meaningless and contextless.

I think you schould not be involved here...

 

If you calculate back to a factor you don't need a unit ... because a factor is unitfree ... because it is a factor.

examples:
- the bore index of a baring

- security factors (durability, safetey)

Top Tags