-
Notifications
You must be signed in to change notification settings - Fork 3
Exclude unwanted units
mkraska edited this page Dec 20, 2022
·
2 revisions
Sometimes sans
simplifies to the same base unit as tans
but the unit may still be inappropriate. Examples are
- Hz for angular velocities or angular frequencies. 1/s or rad/s is correct, Hz is not.
- J for mechanical moments. They must be given in force unit times length unit, e.g. N*m.
- Hz for time constants which aren't frequencies.
- m Pa for spring constants, which are force by length.
So how can we refuse these cases without spoiling the freedom to use the pre-defined units and unit tests?
Tools:
- extract unit with stack functions. Check if the unit isn't oversimplified.
- check against a blacklist either using
member(value, list)
or string comparison[Hz, kHz, MHz]
[mJ, J, kJ, MJ, GJ]
- For moments: check that the answer consists of value, force unit and length unit.
-
args(10*N*m)
simplifies to[10, N, m]
-
- However, it is not as trivial as it seems:
-
args(10*N/m)
simplifies to[10*N, m]
-
Possible feedback:
- Winkelgeschwindigkeiten und Kreisfrequenzen werden nicht in Hz gemessen. Benutzen Sie rad/s oder 1/s.
- Momente werden nicht in J gemessen. Nutzen Sie Produkte aus Kraft- und Längeneinheiten (in dieser Reihenfolge)
In order to try code snippets in jsfiddle,
- copy the code from the wiki page to the clipboard
- follow the link for the JSXGraph version you want to try
- Replace the code in the HTML section (contents of
<p hidden id="init">
) with the content of the clipboard