ilog - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ilog2

compute integer base 2 logarithm

ilog10

compute integer base 10 logarithm

ilog[b]

compute integer base b logarithm

ilog

compute integer natural logarithm

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Calling Sequence

ilog2(x)

 

ilog10(x)

 

ilog[b](x)

ilog(x)

 

Parameters

x

-

expression

b

-

positive real number

Description

• 

These functions compute integer approximations to logarithms. They are based on the IEEE function logb.

• 

For real values  and positive numeric values , the function  computes the integer base  logarithm of ; that is, the logarithm rounded down to the nearest integer.

  

If , then  returns  such that .

  

If , then  returns  such that .

• 

For complex values ,  computes .

• 

The following relations hold for infinite and undefined values:

  

If , then  and .

  

If , then  and .

  

For all , we have .

• 

You can enter the command ilog[b] using either the 1-D or 2-D calling sequence. For example, ilog[3](50) is equivalent to .

• 

The  and  functions compute the same values as  and , respectively. They both have more efficient implementations than the default algorithm for  for . (Indeed,  and  are generally computed using the  and  commands.)

  

There are sometimes situations where you need a rough approximation of the size of the number, where  to any base will do. Then using  is probably the best choice. (It is even faster than  for some cases.)

• 

The  function computes , approximating the natural logarithm of .

• 

The computation of  and  is more efficient than  for .

Thread Safety

• 

The ilog2 and ilog10 commands are thread-safe as of Maple 15.

• 

For more information on thread safety, see index/threadsafe.

Examples

(1)

(2)

(3)

(4)

(5)

(6)

(7)

(8)

The powers of  are very close to the Lucas numbers. In particular,  is a tiny bit less than the 2000th Lucas number, and  is a tiny bit more than the 2001st Lucas number. Consequently, the base- logarithm of both the 2000th and 2001st Lucas number are strictly between 2000 and 2001 - so the answers from  should be 2000 in both cases.

(9)

(10)

(11)

(12)

(13)

(14)

(15)

(16)

See Also

exceptions

float

initialfunctions

type

 


Download Help Document