logBase

log to the base of
>>> logBase 2 8
2.9999999999999996
Takes the logarithm of the second argument in the base of the first.
>>> logBase _2 _8
3.0
Natural logarithm differentiable function.

Examples of usage

>>> import Prelude (Float)

>>> import InfBackprop (call, derivative)

>>> call logBase (2, 8) :: Float
3.0
>>> import Debug.SimpleExpr.Expr (variable)

>>> x = variable "x"

>>> n = variable "n"

>>> derivative logBase (n, x)
((1·(-(log(x))·(1/(log(n)·log(n)))))·(1/n),(1·(1/log(n)))·(1/x))
Apply logarithm to each element of the array where the base is in the same cell in the second array.
logBaseA arr1 arr2 == zipWith logBase arr1 arr2
  • Partial Throws an error when arrays do not have matching sizes
Calculate the integer logarithm for an arbitrary base. The base must be greater than 1, the second argument, the number whose logarithm is sought, shall be positive, otherwise the result is meaningless. The following property holds
base ^ integerLogBase# base m <= m < base ^(integerLogBase# base m + 1)
for base > 1 and m > 0. Note: Internally uses integerLog2# for base 2
Calculate the integer logarithm for an arbitrary base. The base must be greater than 1, the second argument, the number whose logarithm is sought, must be positive, otherwise an error is thrown. If base == 2, the specialised version is called, which is more efficient than the general algorithm. Satisfies:
base ^ integerLogBase base m <= m < base ^ (integerLogBase base m + 1)
for base > 1 and m > 0.
Same as integerLogBase, but without checks, saves a little time when called often for known good input.
Cacluate the integer logarithm for an arbitrary base. The base must be greater than 1, the second argument, the number whose logarithm is sought, must be positive, otherwise an error is thrown. If base == 2, the specialised version is called, which is more efficient than the general algorithm. Satisfies:
base ^ integerLogBase base m <= m < base ^ (integerLogBase base m + 1)
for base > 1 and m > 0.
Logarithm for an arbitrary base
Logarithm for an arbitrary base
Logarithm for an arbitrary base
Logarithm for an arbitrary base
Logarithm (floor) for an arbitrary base For numbers <= 0, return 0
Logarithm (floor) for an arbitrary base For numbers <= 0, return 0
Logarithm (floor) for an arbitrary base For numbers <= 0, return 0
Logarithm (floor) for an arbitrary base For numbers <= 0, return 0