1 2 3 ... 26 Previous Next 112463 Views 378 Replies Latest reply: May 31, 2011 4:29 AM by A.Non
1 posts since
Oct 9, 2006
Currently Being Moderated

## Working with numbers or variables with Units

I am well familiar with MathCad numerical calculations and programming. However, I got accustumed to work my solutions without alphanumerical dimensions next to the number or variable. It is clean an easier for me to keep track of units and conversion in my mind than assigning units to numbers and varaibles at the beguining of calculations or programming with MathCad.

I tried otherwise recently but with problems. My question is to anybody: What is the best way not to get bugdown with error messages becuase units have not been defined properly at the beguining of any problem set-up or during calculations?

I am a structural enginer and work often with Kips, U.S. Tons, Yards, ft., inch.,etc. How do you mix these units in calculation and get the correct answer without keeping track of their different units? Help is appreciated. Thanks.
• 1,774 posts since
Nov 28, 2006
Currently Being Moderated
0. Oct 9, 2006 12:00 AM (in response to depineres-disabled)
Working with numbers or variables with Units
One of the things I have done is build a new template file. This file has a colapsed area at the very top with the constants and units I usually use (rpm = Hza/60, psf = psi/144) that aren't native to mathcad. This area does not appear in the worksheet, yet the definitions are in place without having to input them each time and worry about getting it right.

In your case kip = 1000 lbf, etc.

Fred Kohlhepp
fkohlhepp@sikorsky.com
• 985 posts since
Jun 4, 2007
Currently Being Moderated
1. Oct 9, 2006 12:00 AM (in response to depineres-disabled)
Working with numbers or variables with Units
A problem in thermodynamics can give a solved result that can be either British Thermal Units (BTU) or Centigrade Heat Units (CHU) equally. In other cases it is best to plan the solution in one system or the other and define the answer at the end. No use in carrying units in equations. Irrational fractions cannot be made whole if units are carried in the process.
• 10,537 posts since
Oct 22, 2006
Currently Being Moderated
2. Oct 9, 2006 12:00 AM (in response to depineres-disabled)
Working with numbers or variables with Units
You just define all the units you will need, excepting those you know are already defined by Mathcad, at the top of the sheet. I recommend a collapsed area that contains all the units you need. You can then copy that into sheets that need it, or if most sheets need it add it to the template.

Once you consistently apply units to your input values (including constants in equations) you don't have to (and, largely, cannot) keep track of units. Mathcad simply stores a representation of the quantity which you can then display in any units you want (using the units placeholder, Mathcad does have default units for all types of quantities). Thus in Mathcad there is absolutely no difference between the value 1ft and the value 12in. Both are exactly the same length. The internal representation will vary depending on the current units system and the Mathcad version, but that should be irrelevant to their use.

� � � � Tom Gutman
• 1,774 posts since
Nov 28, 2006
Currently Being Moderated
3. Oct 9, 2006 12:00 AM (in response to depineres-disabled)
Working with numbers or variables with Units
Please note (after a second look) that many of the units you specify (ft, in, yard (yd) are already in Mathcad and do not require definition. Mathcad will automatically convert to make the numbers correct.
Fred Kohlhepp
fkohlhepp@sikorsky.com
Attachments:
• 15,155 posts since
Nov 15, 2007
Currently Being Moderated
5. Oct 10, 2006 12:00 AM (in response to depineres-disabled)
Working with numbers or variables with Units
It is wise never use units ,
only dimension the intrants as per the design of the formula(s).
Think in terms of "what is what" and "what is not what" ... solvers...etc.

Only append the "UnitResult" .

Formulas evolve in the course, they may reach an unsuspected state of simplicity.

jmG
Attachments:
• 7,759 posts since
Jun 1, 2007
Currently Being Moderated
6. Oct 10, 2006 12:00 AM (in response to FredKohlhepp)
Working with numbers or variables with Units
Life would be truly miserable if Mathcad couldn't do its thing with units. We get mixed units all the time; trying to reconcile and convert them to do a trivial calculation would triple the work load.

TTFN,
Eden
• 2,092 posts since
Feb 20, 2007
Currently Being Moderated
7. Oct 10, 2006 12:00 AM (in response to TomGutman)
Working with numbers or variables with Units
If you are using text book formulae which expect values in certain units then getting the units correct takes care. The formulae almost always have 'special constants' in them.

One method is to divide each variable in the equation by the units the text book stated, and then multiply the overall equation by the units of the final answer. This can look quite intuitive if the (var/units) are nicely bracketted.

Another approach is to find the 'special constants' (usually real number in the equation) and using known values, or the first method, find the units of those special constants and just apply the units there.
Watch for Log, Exp, Sin, Cos etc. in the equations which require unitless or radian measures and may hide a 'special constant'.

Philip
• 2,092 posts since
Feb 20, 2007
Currently Being Moderated
8. Oct 10, 2006 12:00 AM (in response to FredKohlhepp)
Working with numbers or variables with Units

One of my hopes for future releases is a way of handling units with the solvers - even some sort of 'wrapper' that can remove & replace the units as it passes to/from the solver.

One of the [much] less talked about engineering methods is that of 'Per Unit', where all equations are converted to a relative scale so Full_Power = 1, etc. where all the constants of proportionality in equations become 1. F=m.a, V=I.R, etc.

It is a method used in the electrical power industry because all the transformers make the [volts & amps] numbers change but the power delivered is fixed, as is [nearly] the frequency, while results in SI have widely varying exponents, so per-unit measures work well, and they match the numerical stability criteria quite well!

Philip
• 393 posts since
Jun 2, 2007
Currently Being Moderated
9. Oct 10, 2006 12:00 AM (in response to ptc-1368288)
Working with numbers or variables with Units
• 1,774 posts since
Nov 28, 2006
Currently Being Moderated
10. Oct 10, 2006 12:00 AM (in response to ptc-1176891)
Working with numbers or variables with Units
Jean (jmG) is as staunch an opponent of units as I am of using them. I agree that they are one of the best features of Mathcad and have caught a lot of my mistakes.

That said, improperly defined units will cause more problems than they find; and there are a number of Mathcad constructs (the differential equation solvers for example) where they can be particularly troublesome.

Both sides have strong arguments.

Fred Kohlhepp
fkohlhepp@sikorsky.com
• 7,759 posts since
Jun 1, 2007
Currently Being Moderated
11. Oct 11, 2006 12:00 AM (in response to ptc-1368288)
Working with numbers or variables with Units
On 10/11/2006 2:36:50 AM, jmG wrote:
>To convince yourself that
>units are useless and that you
>should use work done by others
>before you , try that one:
>
>P*V := Z*n*R*T
>
>with 14 pressure bases, 10
>volume bases, 3 mole bases, 2
>temperature bases
>
>jmG

That's where Mathcad can cut to the chase. You don't need Uconeer or another units converter with Mathcad. The ideal gas equation will work with any combination of units from the different choices transparently.

You seem to want to go out of your way to complicate your life with a separate units conversion when Mathcad does the unit conversion transparently and without having to transfer numbers from one program to another.

TTFN,
Eden
• 2,092 posts since
Feb 20, 2007
Currently Being Moderated
12. Oct 11, 2006 12:00 AM (in response to Ninetrees)
Working with numbers or variables with Units
One of the subtle distinction is 'Units' or 'Unity'. The former allows multiple 'Units of measure' (and hides unity) while the latter allows only the one god [or is that the 'god of 'one']. So many things in maths work out better when values are near zero(0), or one(1)!

Working in general engineering I tend to value the former to (try to) avoid Mars Lander style problems [often an assume-textbook-solve process], while JmG is a great advocate of the latter [a think-normalise-solve process]

I'm currently working on a problem where the team is using principal components analysis and didn't realise they will get different results if the distances are measured in km or um (microns) as the variance will change by 10^18 (so the leading component changes), even though the problem hasn't changed. This is a case where the units are best(?) standardised relative to the measurement noise (i.e. SNR).

I find that MathCAD's units helps catch the bugs when the need to think hasn't been realised. [see the ignoble awards for "Unskilled and Unaware of It: How Difficulties in Recognizing One�s Own Incompetence Lead to Inflated Self-Assessments,� http://www.apa.org/journals/features/psp7761121.pdf]

Each viewpoint has its advantages and disadvantages. Human falibility will continue to require as many techniques as we can muster!

Philip
• 15,155 posts since
Nov 15, 2007
Currently Being Moderated
13. Oct 11, 2006 12:00 AM (in response to Ninetrees)
Working with numbers or variables with Units
[Philip] ... So many things in maths work out better when values are near zero(0), or one(1)!
=> In fact, the digital computers work only in the range of 0 ... 2 in 21 digits floating point unless forced otherwise . The Pentium returns 18 "decimals" as a safe margin to the inerrant � 3 digits probable error .
That kind of "accuracy" is purely arithmetic between the *, /, +, - It does not specify the accuracy of the numerical approximation of functions as these approximations generally range much lower, for instance ln(x) ... etc. It means that ln(1.987654321) is no more 21 digits from the Pentium.

[Rich] ... I /prefer/ to use units because I think that they contribute to traceability, though I can also see assigning the units in text near the equations.
=> assign units in text ? Units are names only, you assign values to variables.
=> Units carried all the way down work sheet(s) to ease the traceability ... my opinion is just the opposite .
.
.
. Mixed units like 0.785*D(m)^2*h(ft) = something !
I call that a "glorified idiosyncrasy". No problem for the arithmetic of it but you still have to define the result in ft� or m� (or else sub of them ) .
What you don't convert beforehand you must "afterhand".

Scaling [Philip] ... that is part of the task , not to be neglected sometimes .
It reminds the Regress scaling problem in Mathcad 8 ... up to 11 .

jmG

• 1,774 posts since
Nov 28, 2006
Currently Being Moderated
14. Oct 11, 2006 12:00 AM (in response to superres)
Working with numbers or variables with Units
Hear! Hear!

Fred Kohlhepp
fkohlhepp@sikorsky.com
1 2 3 ... 26 Previous Next

#### More Like This

• Retrieving data ...