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
ilog2(x)
ilog10(x)
ilog[b](x)
ilogb⁡x
ilog(x)
x
-
expression
b
positive real number
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 ilogb⁡x computes the integer base b logarithm of |x|; that is, the logarithm rounded down to the nearest integer.
If b>1, then ilogb⁡x returns r such that br≤x<br+1.
If b<1, then ilogb⁡x returns r such that br+1<x≤br.
For complex values x, ilogb⁡x computes max⁡ilogb⁡ℜ⁡x,ilogb⁡ℑ⁡x.
The following relations hold for infinite and undefined values:
If b>1, then ilogb⁡±∞=∞ and ilogb⁡0=−∞.
If b<1, then ilogb⁡±∞=−∞ and ilogb⁡0=∞.
For all b, we have ilogb⁡undefined=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 ilog3⁡50.
The ilog2⁡x and ilog10⁡x functions compute the same values as ilog2⁡x and ilog10⁡x, respectively. They both have more efficient implementations than the default algorithm for ilogb⁡x for b≠2,b≠10. (Indeed, ilog2⁡x and ilog10⁡x 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 ilog⁡x function computes ilogⅇ⁡x, approximating the natural logarithm of x.
The computation of ilog2⁡x and ilog10⁡x is more efficient than ilogb⁡x for b≠2,10.
The ilog2 and ilog10 commands are thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
ilog10⁡x
ilog10⁡150
2
ilog10⁡10−37
−37
ilog10⁡214+310⁢I
4
ilog2⁡50
5
ilog2⁡28
8
ilog3⁡10
ilog⁡3
1
The powers of φ=12+12⁢5 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+12⁢sqrt⁡5
φ≔12+52
Lucas≔n↦2⋅combinat:−fibonacci⁡n+1−combinat:−fibonacci⁡n
l2000≔Lucas⁡2000
l2000≔9446708185759308415384067495999677431530963218480368032804826598281856324445977322684945038267086094364761366000137291348836189673785457326607903364013465483957273836804336595888397782139002535468799414419546535346394066447256463745311310661259359973909189379826722425332112242554370313063917929424669185186291673823764654829513873821477637371237697744102254002802127905427315493403711022179894479121632130910668828127
evalf900⁡φ2000
9.44670818575930841538406749599967743153096321848036803280482659828185632444597732268494503826708609436476136600013729134883618967378545732660790336401346548395727383680433659588839778213900253546879941441954653534639406644725646374531131066125935997390918937982672242533211224255437031306391792942466918518629167382376465482951387382147763737123769774410225400280212790542731549340371102217989447912163213091066882812699999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999989414301994556404261178907219383372907698634419491617032649619167×10417
ilogφ⁡Lucas⁡2000
2000
l2001≔Lucas⁡2001
l2001≔15285094926360416404458847753853545672215113709866886761428113642426699623148315429402781518231396824903495901847342654693518581616001718736483909963503576057612526424919647262732272622204263764540041695502230453879379513883382816164600806848158718731671394389559139884843246782770607873339169023848390330701515748112231115788664367129870458859443365121656070623201452984720321258087284805794773049623826845661626456876
evalf900⁡φ2001
1.52850949263604164044588477538535456722151137098668867614281136424266996231483154294027815182313968249034959018473426546935185816160017187364839099635035760576125264249196472627322726222042637645400416955022304538793795138833828161646008068481587187316713943895591398848432467827706078733391690238483903307015157481122311157886643671298704588594433651216560706232014529847203212580872848057947730496238268456616264568760000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000654232116200611158245512923334354892212558579525250227369596382×10418
ilogφ⁡Lucas⁡2001
See Also
exceptions
float
initialfunctions
type
Download Help Document