SKILL.md
唯讀
名稱
pint-compute
描述
使用 Pint 進行單位感知計算 - 單位轉換、因次分析、單位算術
使用 Pint 進行單位計算
用於單位感知計算的認知輔助工具。使用 Pint 在不同單位之間進行轉換、執行單位算術、檢查因次相容性,以及簡化複合單位。
何時使用
- 在不同單位之間進行轉換(公尺轉英呎、公斤轉磅)
- 單位感知算術(速度 x 時間 = 距離)
- 因次分析(力 = 質量 x 加速度?)
- 將複合單位簡化為基本單位或命名單位
- 解析並分析帶有單位的物理量
快速參考
| 我想要... | 指令 | 範例 |
|---|---|---|
| 轉換單位 | convert |
convert "5 meters" --to feet |
| 單位計算 | calc |
calc "10 m/s * 5 s" |
| 檢查因次 | check |
check newton --against "kg * m / s^2" |
| 解析物理量 | parse |
parse "100 km/h" |
| 簡化單位 | simplify |
simplify "1 kg*m/s^2" |
指令
parse
將物理量字串解析為數量級、單位和因次。
uv run python -m runtime.harness scripts/pint_compute.py \
parse "100 km/h"
uv run python -m runtime.harness scripts/pint_compute.py \
parse "9.8 m/s^2"
convert
將物理量轉換為不同的單位。
uv run python -m runtime.harness scripts/pint_compute.py \
convert "5 meters" --to feet
uv run python -m runtime.harness scripts/pint_compute.py \
convert "100 km/h" --to mph
uv run python -m runtime.harness scripts/pint_compute.py \
convert "1 atmosphere" --to pascal
calc
執行單位感知算術。運算子之間必須以空格分隔。
uv run python -m runtime.harness scripts/pint_compute.py \
calc "5 m * 3 s"
uv run python -m runtime.harness scripts/pint_compute.py \
calc "10 m / 2 s"
uv run python -m runtime.harness scripts/pint_compute.py \
calc "5 meters + 300 cm"
check
檢查兩個單位是否具有相容的因次。
uv run python -m runtime.harness scripts/pint_compute.py \
check newton --against "kg * m / s^2"
uv run python -m runtime.harness scripts/pint_compute.py \
check joule --against "kg * m^2 / s^2"
simplify
將複合單位簡化為基本形式或精簡形式。
uv run python -m runtime.harness scripts/pint_compute.py \
simplify "1 kg*m/s^2"
uv run python -m runtime.harness scripts/pint_compute.py \
simplify "1000 m"
常見單位領域
| 領域 | 範例 |
|---|---|
| 長度 | meter, foot, inch, mile, km, yard |
| 時間 | second, minute, hour, day, year |
| 質量 | kg, gram, pound, ounce, ton |
| 速度 | m/s, km/h, mph, knot |
| 能量 | joule, calorie, eV, kWh, BTU |
| 力 | newton, pound_force, dyne |
| 溫度 | kelvin, celsius, fahrenheit |
| 壓力 | pascal, bar, atmosphere, psi |
| 功率 | watt, horsepower |
輸出格式
所有指令均會返回包含相關欄位的 JSON:
{
"result": "16.4042 foot",
"magnitude": 16.4042,
"units": "foot",
"dimensionality": "[length]",
"latex": "16.4042\\,\\mathrm{ft}"
}
錯誤處理
因次錯誤會被擷取並回報:
# 這會引發錯誤 - 不相容的因次
uv run python -m runtime.harness scripts/pint_compute.py \
convert "5 meters" --to kg
# Error: Cannot convert '[length]' to '[mass]'
相關 Skill
- /math-mode - 完整數學協調(SymPy + Z3)
- /sympy-compute - 符號計算






