コンテンツへスキップ
🛠️ToolsShed

Euler's Number Calculator

Taylor級数近似、継続的な複利、正規分布を使用してEulerの数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.