Python‎ > ‎decimal‎ > ‎

Decimal.ln()


Definition
Return the natural (base e) logarithm of the operand.

Syntax
Decimal(x).ln()->natural logarithm

Parameters
x=Decimal

Examples
The return are:
 >>> Decimal(.9932).ln()
Decimal('-0.006823225348125536771512577607')
>>> Decimal(1.432).ln()
Decimal('0.3590720685384538301994562211')
>>> Decimal(0).ln()
Decimal('-Infinity')


The method computed the int(value) of the decimal and then run loop through range() function.
from decimal import Decimal


for i in range(a,10):
    print(i)
    print(i/Decimal(1.1).log10())
        
>>>
0
0E+29
1
24.15885792809678504023429545
2
48.31771585619357008046859090
3
72.47657378429035512070288634
4
96.63543171238714016093718179
5
120.7942896404839252011714772
6
144.9531475685807102414057727
7
169.1120054966774952816400681
8
193.2708634247742803218743636
9
217.4297213528710653621086590
>>>


Comments