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)

ilogbx

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 x and positive numeric values b, the function ilogbx computes the integer base b logarithm of |x|; that is, the logarithm rounded down to the nearest integer.

  

If b&gt;1, then ilogbx returns r such that brx<br&plus;1.

  

If b<1, then ilogbx returns r such that br&plus;1<xbr.

• 

For complex values x, ilogbx computes maxilogbx&comma;ilogbx.

• 

The following relations hold for infinite and undefined values:

  

If b&gt;1, then ilogb±&equals; and ilogb0=.

  

If b<1, then ilogb±&equals; and ilogb0=.

  

For all b, we have ilogbundefined=undefined.

• 

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 ilog350.

• 

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

  

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

• 

The ilogx function computes ilog&ExponentialE;x, approximating the natural logarithm of x.

• 

The computation of ilog2x and ilog10x is more efficient than ilogbx for b2&comma;10.

Thread Safety

• 

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

• 

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

Examples

ilog10x

ilog10x

(1)

ilog10150

2

(2)

ilog101037

−37

(3)

ilog10214+310I

4

(4)

ilog250

5

(5)

ilog228

8

(6)

ilog310

2

(7)

ilog3

1

(8)

The powers of φ&equals;12&plus;125 are very close to the Lucas numbers. In particular, φ2000 is a tiny bit less than the 2000th Lucas number, and φ2001 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 ilog should be 2000 in both cases.

φ12+12sqrt5

φ12+52

(9)

Lucasn2combinat:−fibonaccin+1combinat:−fibonaccin

Lucasn2combinat:−fibonaccin+1combinat:−fibonaccin

(10)

l2000Lucas2000

l20009446708185759308415384067495999677431530963218480368032804826598281856324445977322684945038267086094364761366000137291348836189673785457326607903364013465483957273836804336595888397782139002535468799414419546535346394066447256463745311310661259359973909189379826722425332112242554370313063917929424669185186291673823764654829513873821477637371237697744102254002802127905427315493403711022179894479121632130910668828127

(11)

evalf900φ2000

9.44670818575930841538406749599967743153096321848036803280482659828185632444597732268494503826708609436476136600013729134883618967378545732660790336401346548395727383680433659588839778213900253546879941441954653534639406644725646374531131066125935997390918937982672242533211224255437031306391792942466918518629167382376465482951387382147763737123769774410225400280212790542731549340371102217989447912163213091066882812699999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989414301994556404261178907219383372907698634419491617032649619167×10417

(12)

ilogφLucas2000

2000

(13)

l2001Lucas2001

l200115285094926360416404458847753853545672215113709866886761428113642426699623148315429402781518231396824903495901847342654693518581616001718736483909963503576057612526424919647262732272622204263764540041695502230453879379513883382816164600806848158718731671394389559139884843246782770607873339169023848390330701515748112231115788664367129870458859443365121656070623201452984720321258087284805794773049623826845661626456876

(14)

evalf900φ2001

1.52850949263604164044588477538535456722151137098668867614281136424266996231483154294027815182313968249034959018473426546935185816160017187364839099635035760576125264249196472627322726222042637645400416955022304538793795138833828161646008068481587187316713943895591398848432467827706078733391690238483903307015157481122311157886643671298704588594433651216560706232014529847203212580872848057947730496238268456616264568760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000654232116200611158245512923334354892212558579525250227369596382×10418

(15)

ilogφLucas2001

2000

(16)

See Also

exceptions

float

initialfunctions

type