Contents Previous Next Subchapters Current Chapters-> acos asin atan cos cosh exp log log10 sin sinh tan tanh log2 pow2 atan2 angle asinh acosh acoth coth atanh hypot Parent Chapters-> Omatrix6 elementary transcendental log2 Search Tools-> contents reference index search

Base Two Logarithm Function
 Syntax f` = log2(`x`)` `[`f`,`e`] = log2(`x`)` See Also exp , log10 , log

Description
Computes the element-by-element base-two logarithm of x where x is a real, double-precision or complex matrix.

One Return Value
In this case f satisfied the equation ```           f      x = 2 ```If any of the elements of x are negative, f is a complex matrix. Otherwise f has the same type as x.

Two Return Values
In this case the real part of all the elements of x must be positive and the return values f and e satisfy the equation ```                   e      Re[x] = f * 2  ```where `Re[x]` denotes the real part of `x`, f is a fraction in the interval `[.5, 1.)` and e is equal to an integer. If f is a complex matrix, f and e are double-precision matrices. Otherwise f and e have the same type as x.

Example ```      log2(4.) ``` returns ```      2 ``` If you enter ```      [f, e] = log2( [1, 2, 3, 4] )      {f , e} ``` O-Matrix will reply ```      {      [ .5 , .5, .5 ]      [ 1 , 2 , 2 , 3 ]      } ```