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

Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

problem defining a function that has variables with units of measure

ddenholm
6-Contributor

problem defining a function that has variables with units of measure

I tried to define the function so that all the units of measure would cancel out and one would produce a dimensionless mass fraction but MathCAD thinks I am doing it incorrectly.

 

Please explain what I am doing wrong or provide a workaround.

 

Thanks!

Problem defining function with units of measure.PNG

 

 

 

15 REPLIES 15

Yours looks like it should work.  But you can try this:

mass fraction.PNG

MJG
18-Opal
18-Opal
(To:ddenholm)

°C is actually a function that converts your input to a temperature.  Mathcad has to treat °F and °C differently than the other temperature units because they are not zero-based (not sure this is the right terminology).

 

Because °C is a function and not a unit, you cannot just divide by °C.  You need a function that gives you the inverse temperature.  You can write your own function like this:

Capture.PNG

 

Or you can see another option here: https://community.ptc.com/t5/PTC-Mathcad-Questions/Inverse-Temperature-Units-in-Prime/m-p/347471#M135794

MJG
18-Opal
18-Opal
(To:MJG)

Here are the two options implemented to your function:

Capture.PNG

(Mathcad 3.1 attached)

-MFra-
21-Topaz II
(To:ddenholm)

Hi,

My answer is very similar to that of FK:

Sol_liQ.jpg

Werner_E
25-Diamond I
(To:-MFra-)


@-MFra- wrote:

Hi,

My answer is very similar to that of FK:

 


Give it a try and evaluate (60 °C) /( 1 °C) - you won't get 60!

MFG has explained why.

-MFra-
21-Topaz II
(To:Werner_E)

Was gibt's, Schläfer?

Werner_E
25-Diamond I
(To:-MFra-)


@-MFra- wrote:

Was gibt's, Schläfer?


?????

Looks like you a trying to be a funny guy, but maybe you could still explain what you mean by that.

 

Or didn't you see, that by simply dividing by 1°C you "solve" the problem with the error message, but most likely don't get the desired result?

 

-MFra-
21-Topaz II
(To:Werner_E)

I see there are very long times of inactivity ... so they all seem, "Sleepy".

Please Werner, I'm sorry, my German was somewhat rusty, and I've done a bit of confusion. I learned German from self-taught, with grammar and vocabulary, late seventies and early eighties I was in the former BRD. In 1981 I was in Mannheim,  there I found  a woman,  by the "Juonoesqe" beauty, that I could no longer work ... So after a while I returned to my country.
Regarding the problem, I get the same result with mathcad 15.

But if I write the function in slightly different form, I get a different result:

Sol_liQ1.jpg

What is the right solution? The last?

Werner_E
25-Diamond I
(To:-MFra-)


@-MFra- wrote:

If I write the function in slightly different form, I get a different result:

 


But still a wrong one. As MJG already explained here e few days ago, you can't get rid of the unit °C by a simple division  - you need to perform a shift, too. MJG already had shown two ways how to do it and the result using the values the OP provideds is around 0.21.

Temperature units really can be a beast.

Maybe this picture can make it clearer:

Temp.png

-MFra-
21-Topaz II
(To:Werner_E)

Even so:

 Sol_liQ2.jpg

it isn' ok?

 

Werner_E
25-Diamond I
(To:-MFra-)


 

it isn' ok?

 


As I see it, it isn't. Look at the picture I posted above.

The reason we divide a physical quantity by its unit is to get rid of the unit but leave the number intact. This only works for zero-based units. As MJG pointed out, temperature units like °C or °F aren't. Temperatures  are stored in base unit Kelvin and to convert between K and °C or °F you can't simply scale, like with most other units (e.g. meter to/from feet) but you also have to shift the scale.

-MFra-
21-Topaz II
(To:Werner_E)

Excuse the term .... but this Mathcad characteristic is really a ... **bleep**!

Werner_E
25-Diamond I
(To:-MFra-)

Its not Mathcad, its the way temp units are defined in physics.

A unit °C is not a simple factor as are most other units.

 

-MFra-
21-Topaz II
(To:Werner_E)

I read the MJG solution. It seems to be the only way to solve the problem.
Regarding your answer, in fact, in calculating, we always have to return the temperatures in Kelvin. It was hoped this conversion was a mathcad feature, ie, regardless of the user-used temperature units, the processor would provide it automatically. But is not so.
it is obvious that it is wrong to transform the ratio between two temperatures in Kelvin in the ratio of the corresponding degrees Celsius, or Farenheit. The ratio, in fact, regardless of the units of measurement, must remain the same and to do this I have to consider the temperature variations. See the following example

Sol_liQ3.jpg

 In my opinion, the best advice we can give to ddenholm is to face the whole problem considering the temperatures in Kelvin.

Werner_E
25-Diamond I
(To:-MFra-)

 In my opinion, the best advice we can give to ddenholm is to face the whole problem considering the temperatures in Kelvin.

I tend to disagree. While it may be generally a good idea to use Kelvin when dealing with temperatures - why should he go through the hassle of conversion?

In my opinion the best advice is to use the built-in inverse function  /°C  instead of the division by °C. Thats the second of MJGs suggestions.

But its not understandable why this notation for the inverse function is not documented in Prime anymore and why this inverse can only be typed in via that awkward tricky way with the double quotes which have to be deleted later (as described in more detail in the link MJG provided.

Announcements

Top Tags