### 5.4 Built-in Functions ¶

Several built-in functions are provided: ‘`sin`’, ‘`cos`’, ‘`tan`’, ‘`secant`’, ‘`csc`’, ‘`cot`’, ‘`asin`’, ‘`acos`’, ‘`atan`’, ‘`asecant`’, ‘`acsc`’, ‘`acot`’, ‘`sinh`’, ‘`cosh`’, ‘`tanh`’, ‘`sech`’, ‘`csch`’, ‘`coth`’, ‘`asinh`’, ‘`acosh`’, ‘`atanh`’, ‘`asech`’, ‘`acsch`’, ‘`acoth`’, ‘`exp`’, ‘`ln`’, ‘`log`’, ‘`abs`’, ‘`round`’, ‘`floor`’, ‘`ceil`’, ‘`factorial`’, ‘`Gamma`’, ‘`lnGamma`’, ‘`erf`’, and ‘`erfc`’; the function ‘`lnGamma`’ is the natural logarithm of the ‘`Gamma`’ function.

The ‘`sin`’, ‘`cos`’, ‘`tan`’, ‘`secant`’, ‘`csc`’ and ‘`cot`’ 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.

The ‘`ln`’ and ‘`log`’ functions give natural log and log base 10 respectively. To obtain logs for any integer base, enter the desired base immediately after ‘`log`’. For example, to get log base 2 you would write ‘`log2`’ and to get log base 47 you could write ‘`log47`’.

    You have: log2(32)
    You want:
            Definition: 5
    You have: log3(32)
    You want:
            Definition: 3.1546488
    You have: log4(32)
    You want:
            Definition: 2.5
    You have: log32(32)
    You want:
            Definition: 1
    You have: log(32)
    You want:
            Definition: 1.50515
    You have: log10(32)
    You want:
            Definition: 1.50515

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