본문으로 건너뛰기
🛠️ToolsShed

오일러 수 계산기

테일러 급수 근사, 연속 복리, 정규 분포로 오일러 수 e를 탐색합니다.

오일러 수 (e)

e = 2.718281828459045

이 도구 소개

오일러 수(e ≈ 2.71828)는 미적분학, 통계학, 금융, 물리학에 나타나는 가장 중요한 수학 상수입니다. 자연로그의 밑을 나타내며 연속 성장과 감소를 설명합니다. 이 계산기는 테일러 급수 근사, 연속 복리, 정규분포를 통해 e의 거동을 탐구하는 데 도움이 됩니다. 테일러 급수는 수학자들이 이 무한 상수를 원하는 정확도까지 계산하는 방법을 보여줍니다.

테일러 급수의 항 개수를 조정하여 근사가 e의 참 값으로 수렴하는 과정을 관찰하세요. 연속 복리 시뮬레이터는 이자가 무한히 복리될 때 오일러 수가 어떻게 나타나는지 보여주며, 이는 금융 수학의 핵심 개념입니다. 정규분포 뷰어는 유명한 종 모양 곡선을 표시하며, 이는 수학 공식에서 e에 의존하고 통계학과 데이터 과학에 필수입니다.

이 도구는 미적분학과 통계학을 배우는 학생, 수학 라이브러리로 작업하는 개발자, 그리고 기본 상수가 현실 현상을 어떻게 형성하는지 궁금해하는 사람들에게 이상적입니다. 각 시각화는 실시간으로 업데이트되므로 다양한 매개변수를 실험하고 지수 성장, 확률 분포, 그리고 일상의 금융 및 과학 계산을 뒷받침하는 깊은 수학에 대한 직관을 구축할 수 있습니다.

자주 묻는 질문

코드 구현

import math
from decimal import Decimal, getcontext

# 1. Taylor series approximation of e
def euler_taylor(n_terms: int) -> float:
    """Approximate e using n terms of Taylor series: sum(1/k!) for k=0..n"""
    total = 0.0
    factorial = 1
    for k in range(n_terms):
        if k > 0:
            factorial *= k
        total += 1 / factorial
    return total

# 2. High-precision e using Python's decimal module
def euler_high_precision(decimal_places: int) -> Decimal:
    getcontext().prec = decimal_places + 10  # extra guard digits
    e = Decimal(0)
    factorial = Decimal(1)
    for k in range(200):  # 200 terms is enough for 100+ decimal places
        if k > 0:
            factorial *= k
        term = Decimal(1) / factorial
        e += term
        if term < Decimal(10) ** -(decimal_places + 5):
            break
    return +e  # re-apply precision

# 3. Common formulas involving e
def compound_continuous(principal: float, rate: float, years: float) -> float:
    """A = P × e^(r×t) — continuous compounding formula"""
    return principal * math.exp(rate * years)

def normal_pdf(x: float, mu: float = 0, sigma: float = 1) -> float:
    """Normal distribution PDF: f(x) = (1/σ√2π) × e^(-(x-µ)²/2σ²)"""
    return (1 / (sigma * math.sqrt(2 * math.pi))) * math.exp(-((x - mu)**2) / (2 * sigma**2))

# Examples
print(f"e (Python math):     {math.e}")
print(f"e (5 terms):         {euler_taylor(5):.8f}")
print(f"e (20 terms):        {euler_taylor(20):.15f}")

# Euler's identity: e^(iπ) + 1 = 0
e_to_ipi = math.exp(complex(0, math.pi))
print(f"\ne^(iπ) = {e_to_ipi.real:.10f} + {e_to_ipi.imag:.0f}i")
print(f"e^(iπ) + 1 = {e_to_ipi.real + 1:.2e}  (≈ 0, Euler's identity)")

# Continuous compounding
amount = compound_continuous(1000, 0.05, 10)
print(f"\n$1000 at 5% for 10 years (continuous): ${amount:.2f}")

# Normal distribution at x=0
print(f"Normal PDF at x=0: {normal_pdf(0):.6f}")

Comments & Feedback

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