Inductance Converter
Convert between Henry, Millihenry, Microhenry, Nanohenry, and Picohenry units.
| Unit | Value in Henry (H) |
|---|---|
| Henry (H) | 1.00e+0 |
| Millihenry (mH) | 1.00e-3 |
| Microhenry (µH) | 1.00e-6 |
| Nanohenry (nH) | 1.00e-9 |
| Picohenry (pH) | 1.00e-12 |
Часто задаваемые вопросы
Реализация кода
# Inductance unit converter
INDUCTANCE_TO_HENRY = {
"H": 1,
"mH": 1e-3,
"uH": 1e-6, # µH
"nH": 1e-9,
"pH": 1e-12,
}
def convert_inductance(value: float, from_unit: str, to_unit: str) -> float:
"""Convert between inductance units via henry (H)."""
value_in_henry = value * INDUCTANCE_TO_HENRY[from_unit]
return value_in_henry / INDUCTANCE_TO_HENRY[to_unit]
# XL = 2π × f × L (inductive reactance in ohms)
import math
def inductive_reactance(inductance_h: float, frequency_hz: float) -> float:
return 2 * math.pi * frequency_hz * inductance_h
# Example
print(convert_inductance(1000, "nH", "uH")) # 1.0 µH
print(convert_inductance(1, "mH", "H")) # 0.001 H
# Reactance of 100µH inductor at 1MHz
xl = inductive_reactance(100e-6, 1e6)
print(f"XL at 1 MHz: {xl:.2f} Ω") # 628.32 ΩComments & Feedback
Comments are powered by Giscus. Sign in with GitHub to leave a comment.