🛠️ToolsShed

Logaritma Hesaplayıcı

Herhangi bir tabanda logaritma hesaplayın — doğal logaritma (ln), log taban 10 veya özel taban.

Sıkça Sorulan Sorular

Kod Uygulaması

import math

# Common logarithms
print(math.log10(1000))      # 3.0  — log base 10
print(math.log2(1024))       # 10.0 — log base 2
print(math.log(math.e))      # 1.0  — natural log (ln)

# Arbitrary base using change-of-base formula
def log_base(x: float, base: float) -> float:
    """log_base(x) = ln(x) / ln(base)"""
    return math.log(x) / math.log(base)

print(log_base(8, 2))        # 3.0
print(log_base(1000, 10))    # 3.0
print(log_base(81, 3))       # 4.0

# Logarithm rules examples
a, b = 100, 10
print(math.log10(a * b) == math.log10(a) + math.log10(b))  # True (product rule)
print(math.log10(a / b) == math.log10(a) - math.log10(b))  # True (quotient rule)
print(math.log10(a ** 3) == 3 * math.log10(a))             # True (power rule)

# Inverse: e^ln(x) = x
x = 42
print(abs(math.e ** math.log(x) - x) < 1e-10)  # True

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.