Next: , Previous: Numbers as Units, Up: Unit Expressions

5.4 Built-in Functions

Several built-in functions are provided: ‘sin’, ‘cos’, ‘tan’, ‘ln’, ‘log’, ‘log2’, ‘exp’, ‘acos’, ‘atan’ and ‘asin’. The ‘sin’, ‘cos’, and ‘tan’ functions require either a dimensionless argument or an argument with dimensions of angle.

     You have: sin(30 degrees)
     You want:
             Definition: 0.5
     You have: sin(pi/2)
     You want:
             Definition: 1
     You have: sin(3 kg)
     Unit not dimensionless

The other functions on the list require dimensionless arguments. The inverse trigonometric functions return arguments with dimensions of angle.

If you wish to take roots of units, you may use the ‘sqrt’ or ‘cuberoot’ functions. These functions require that the argument have the appropriate root. You can obtain higher roots by using fractional exponents:

     You have: sqrt(acre)
     You want: feet
             * 208.71074
             / 0.0047913202
     You have: (400 W/m^2 / stefanboltzmann)^(1/4)
     You have:
             Definition: 289.80882 K
     You have: cuberoot(hectare)
     Unit not a root