Skip to content

Functions

Dave DeLong edited this page Sep 19, 2015 · 3 revisions

In addition to the functions defined by the standard operators, the following functions are available:

Functions that take no parameters ("constant functions"):

  • phi() - returns the value of ϕ (the Golden Ratio). Also recognized as ϕ()
  • pi() - returns the value of π. Also recognized as π()
  • pi_2() - returns the value of π/2
  • pi_4() - returns the value of π/4
  • tau() - returns the value of τ. Also recognized as τ()
  • sqrt2() - returns the value of the square root of 2
  • e() - returns the value of e
  • log2e() - returns the value of the log base 2 of e
  • log10e() - returns the value of the log base 10 of e
  • ln2() - returns the value of the log base e of 2
  • ln10() - returns the value of the log base e of 10

Functions that take 1 parameter:

  • sqrt() - returns the square root of the passed parameter
  • log() - returns the base 10 log of the passed parameter
  • ln() - returns the base e log of the passed parameter
  • log2() - returns the base 2 log of the passed parameter
  • exp() - returns e raised to the power of the passed parameter
  • ceil() - returns the passed parameter rounded up
  • floor() - returns the passed parameter rounded down
  • The trigonometric functions:
    • sin(), cos(), tan()
    • Their inverses (asin, acos, atan, atan2)
    • Their reciprocals (csc, sec, cotan)
    • The reciprocals of the inverses (acsc, asec, acotan)
    • The hyperbolic variations of all the above functions (sinh, cosh, tanh, asinh, acosh, atanh, csch, sech, cotanh, acsch, asech, acotanh)
    • The versine functions (versin, vercosin, coversin, covercosin, haversin, havercosin, hacoversin, hacovercosin, exsec, excsc, crd)
  • dtor() - converts the passed parameter from degrees to radians
  • rtod() - converts the passed parameter from radians to degrees

Functions that take > 1 parameter

  • sum() - returns a sum of the passed parameters. Also recognized as ∑()
  • product() - returns a product of the passed parameters. Also recognized as Π()
  • count() - returns the number of passed parameters
  • min() - returns the minimum of the passed parameters
  • max() - returns the maximum of the passed parameters
  • median() - returns the median of the passed parameters
  • stddev() - returns the standard deviation of the passed parameters
  • average() - returns the average of the passed parameters
  • random() - returns a random integer. Can take 0, 1, or 2 parameters. The first parameter (if given) is the lower bound of the random integer. The second parameter (if given) is the upper bound of the random integer.
  • nthroot() - returns the nth root of a number. For example, nthroot(27,3) returns the cube root of 27, or 3.
  • l_if() - takes 3 parameters. If the first parameter evaluates to a non-zero value, this evaluates to the value of the first parameter. Otherwise it evaluates to the value of the second parameter.

By default, functions are case insensitive, which means "sin(0)" would be equivalent to "SIN(0)"