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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

How to tell Mathcad that what we write is a unit?

bmulyanto
6-Contributor

How to tell Mathcad that what we write is a unit?

1. I meant to write nC/m^3 as a unit, nanoCoulomb per meter cubic.

However mathcad considers it as something else (variable maybe?)
All the calculations are correct.

What should I do?

2. I should put unit meter m on variable r2.

But if I do that, the calculation goes wrong.

any idea?

Screenshot (2).png

1 ACCEPTED SOLUTION

Accepted Solutions
LucMeekes
23-Emerald III
(To:bmulyanto)

Select the item ( the nC ) and set its label to 'Unit' using the appropriate  item on the ribbon:

Then do the same for the 'm' of metre.

Success!

Luc

P.S. While you're at it, change the style for the Unit display from italic to upright (roman) to comply with international standard...

View solution in original post

26 REPLIES 26
LucMeekes
23-Emerald III
(To:bmulyanto)

Select the item ( the nC ) and set its label to 'Unit' using the appropriate  item on the ribbon:

Then do the same for the 'm' of metre.

Success!

Luc

P.S. While you're at it, change the style for the Unit display from italic to upright (roman) to comply with international standard...

bmulyanto
6-Contributor
(To:LucMeekes)

aaah...it is there.
Thank you.

I tried to do right click but it is not there.

Sorry, I am usually better than this.

LucMeekes
23-Emerald III
(To:bmulyanto)

It's a funny thing that is happening in your sheet.

Your definition of rho, where nC and m are not recognized as units (that is, they're not labelled as such), defines rho as a constant times a construct of two variables (nC and m). I wonder why they're not flagged (red) as Unknowns.... do you have them defined outside of the picture?

Then you define Q using a symbolic operation, this shows nC and m in the answer as is to be expected, knowing that the symbolic processor does not know about units.

Requesting the value of Q gives its value, where all of a sudden nC and m are labelled as units.  !

bmulyanto
6-Contributor
(To:LucMeekes)

. I wonder why they're not flagged (red) as Unknowns.... do you have them defined outside of the picture?

No, I do not.

LucMeekes
23-Emerald III
(To:bmulyanto)

Ah,

I guess part of the mystery lies with the fact that you have a problem in your sheet.

The definition of rho contains a variable that is undefined. Is that an r? Do you mean rho to be a function of r? then you should define it as rho(r):=...

And use it as such in within the integral in the definition of Q.

Success!
Luc

bmulyanto
6-Contributor
(To:LucMeekes)

done defining rho as rho(r).
still have issue.

Okay, you have more problems than you think.

The red circle around the r in the equation for rhoV means that Mathcad doesn't know what to do with it.  So when you try to evaluate rhoV you get:

Then you evaluate the integral but using the symbolic processor.  If you ask for a numeric answer you get:

I've converted rhoV to a function, and added units to r1 and r2; might have gotten the units on rhoV wrong.  See if this helps.

:

yes, I know I got some warnings there (red box).
I had not minded them because I thought as long as I got the result as I expected, I considered it ok.

However, I agree that it is good to write it properly and I am trying to now.
Thanks.

LucMeekes
23-Emerald III
(To:bmulyanto)

Does this help?

bmulyanto
6-Contributor
(To:LucMeekes)

That is quite a trick to work around with the function we are working on.
I use mathcad to check my hand calculation and to document it for reference, so I prefer to keep the original function as it is.
Thanks anyway.

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

Hi budi mulyanto,

you could insert in your worksheet by mean of the istruction "include" the following worksheet that you find attached:

multiples and submultiples.jpg

bmulyanto
6-Contributor
(To:-MFra-)

Thanks!
I will take a look and tried it.

LucMeekes
23-Emerald III
(To:-MFra-)

Ideally there should not be any problem with Grad (Giga-radians) as a unit and Grad as an operator. The Grad unit is (or at least: should be) labelled as 'Unit', the Grad operator most probably as a 'function'. That makes them different items.

Luc

LucMeekes
23-Emerald III
(To:-MFra-)

I just came across the standard: The official (ISO 80000-2) symbol for the 'gradient' operator is 'grad' (no uppercase G, and writing it in thin face rather than bold face should be avoided), or an upside-down Delta (or triangle if you will).

Similarly the rotation operator symbol is 'rot' (boldface, avoid 'curl').

And finally the symbol for the divergence operator is, according to that standard, 'div' ( thin face, not bold face... what a great thing is standardization! )

Luc

bmulyanto
6-Contributor
(To:bmulyanto)

Thank you all for your help.

I got the correct result now.

what I learned so far:

1. exponent value must be dimensionless.

2. mind the function's dependencies. --> this leads me to another question. maybe I will make a new thread.


Screenshot (4).png

I guess its a better view not to say that we must make r dimensionless in the definition of rho but rather accept that the factor 1000 in the exponent must have dimension lenght^-1.

bmulyanto
6-Contributor
(To:bmulyanto)

Hi again..
I have similar problem but it is related to a matrix now.

The output matrix become unitless.
All calculations are correct.

Screenshot (6).png

Its the symbolic engine which does not know anything about units.

If you evaluate your functions numerically (with specific value for x and y) you will see the units labeled as they should be.

On the "Calculations Ribbon in "Worksheet Settings" -> "Calculations Options" you can switch on "Units/Constants in Symbolics" but as far as i can tell is has not much effect. Not sure what this option is for.

BTW, shouldn't it be

or do you really want x to be dimensionless?

Correction. The aforementioned option shows effect after recalculation.

The reason you see |m| is because the symbolics still don't understand units and treats m as an unknown variable which could as well be negative or non-real.

If thats a problem you may add "assume, m>0" to the symbolic eval.

bmulyanto
6-Contributor
(To:Werner_E)

Thanks.
I see, you are right. I did not know that before.
one thing, the unit vector becomes dimensionless.

it results a wrong unit for the final calculation.

Screenshot (8).png

bmulyanto
6-Contributor
(To:bmulyanto)

So far, I got this (see picture).
It is correct.

I think we should not put a unit in a variable like I did with the matrix..

The remaining issue is a unit vector that becomes dimensionless.

But somehow it produces a correct a result at the end.

Thank you again to all.

Screenshot (10).png

> The remaining issue is a unit vector that becomes dimensionless.

Thats not an issue - its as it should and must be!

A unit vector must be dimensionless per definition!

What should its length be? 1 meter, 1 inch, ...?

A unit vector has a length of 1 (no unit! Even though its called a "unit" vector )

BTW, you may also add ",y>0" in your assume statement to make the symbolic result more tidy.

It also does not seem to be necessary to make all of your functions dependent an x, too, as x is canceled out from the very beginning.

The reason you see this m overline (conjugate complex of m) is because Mathcad sticks correctly to the definition of the dot product which uses the conjugate complex components of the second vector.

Dot product - Wikipedia

If you don't like this you can either use matrix multiplication a^T*b instead of dot product a*b or tell the symbolics via "assume, ALL=real" that we are dealing with real quantities only.

smitchell-2
4-Participant
(To:bmulyanto)

I think you need to define the unit, as mathcad doesn't recognize it. For example, I wanted to use feet of water as a pressure, so I defined it in terms matchad recognized;

Capture.JPG

then I was able to use it:

Capture2.JPG

From what I see you did not define H2Oft as unit. So its just a variable you multiply you quantities with.

If you label H2Oft as unit it gets treated colored as all other units for better consistency

smitchell-2
4-Participant
(To:Werner_E)

You are exactly right! Thank-you.

Top Tags