How To... > Work with Formulas > Work with the Formula Editor > Use Units in Formulas
When you use a formula to compute the values of an attribute, Fathom does the “unit algebra” for you automatically. Here are some examples.
Compute speed from distance and time: Suppose you have an attribute distance whose units are meters, and another attribute time whose units are seconds. You can create an attribute named speed and compute it as distance divided by time, and Fathom will compute the units for you as m/s.
By default, Fathom will use the units that appear in the original attributes in the result. But you can change this by typing a new, compatible unit in the units row. For example, you could change m/s to mph.
|
![_img444](_img444.png)
|
|
Formulas with Units in Them: Sometimes you need to put units directly in a formula. There’s no problem with that. The example at right chooses a random volume in cubic centimeters and then displays it in fluid ounces because the units row has been set to fluid ounces.
|
![_img445](_img445.png)
|
One thing to be careful about is naming attributes with unit names. For example, if you name an attribute seconds, Fathom is going to prefer the attribute over the unit in formulas. This can be confusing! So, the best idea is to keep units to the units row and out of the attribute name.
See also
Attributes with Units
Manage Units in a Case Table
Create and Use Sliders Whose Values Have Units
Manage Units in the Collection’s Inspector
|