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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Change units in the calculations

jkrulak
1-Newbie

Change units in the calculations

Hello,

i would like to ask if is any chance to change units in calculations. Details at the picture.

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions

Mathcad does not simplify when you assign a variable, so defining M3:=10kN*5m stores the units kN*m, no simplification to Joule is made.

The symbol processor doesn't know anything about units and treats them as unknown variables. So if you symbolically evaluate M3 you will see kN and m and thanks to their names (alphabetical order) in the correct order 😉

If you do a numerical inline evaluation after the assignment (M4:=10kN*5m=...) Mathcad simplifies the units to the default Joule and no matter what you type in in the placeholder after the unit (its just for display purpose) M4 will store that default unit J and a symbolic eval will show that unit.

So to get what you want two methods (apart from tackling the system files as Magnus had shown) come to my mind:

1) Don't use inline evaluations in the assignment regions but show the value of the variable in a separate region next to it. The result is nevertheless not exactly as you had shown:

units1.png

2) This seems to be the better and more practical one, but it too has its limits (e.g. you have no control over the order the units are displayed at) and can not replace a unit-aware symbolics. Simply use symbolic evaluations instead of numeric ones. At least for your example we get the desired result:

units2.png

View solution in original post

4 REPLIES 4

Why don't you post your worksheet?

Maybe you want to change the default unit for answers in "Energy"? Have a look at "Defining Custom Built-In Units" in the Mathcad 15.0 help.

unit2.png

unit1.png

I just made this example and have not figured out why I get 1000 in the denominators.

(And please read the warnings in the help before editing the system files. A small error will stop Mathcad from starting.)

Regards,

Magnus

Mathcad does not simplify when you assign a variable, so defining M3:=10kN*5m stores the units kN*m, no simplification to Joule is made.

The symbol processor doesn't know anything about units and treats them as unknown variables. So if you symbolically evaluate M3 you will see kN and m and thanks to their names (alphabetical order) in the correct order 😉

If you do a numerical inline evaluation after the assignment (M4:=10kN*5m=...) Mathcad simplifies the units to the default Joule and no matter what you type in in the placeholder after the unit (its just for display purpose) M4 will store that default unit J and a symbolic eval will show that unit.

So to get what you want two methods (apart from tackling the system files as Magnus had shown) come to my mind:

1) Don't use inline evaluations in the assignment regions but show the value of the variable in a separate region next to it. The result is nevertheless not exactly as you had shown:

units1.png

2) This seems to be the better and more practical one, but it too has its limits (e.g. you have no control over the order the units are displayed at) and can not replace a unit-aware symbolics. Simply use symbolic evaluations instead of numeric ones. At least for your example we get the desired result:

units2.png

Thank you for replay sir

Top Tags