ワンクリックで
gpd-dimensional-analysis
Systematic dimensional analysis audit on all equations in a derivation or phase
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Systematic dimensional analysis audit on all equations in a derivation or phase
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Add research phase to end of current milestone in roadmap
Capture idea or task as todo from current research conversation context
Prepare a paper for arXiv submission with validation and packaging
Audit research milestone completion against original research goals
Create a hypothesis branch for parallel investigation of an alternative approach
List pending research todos and select one to work on
| name | gpd-dimensional-analysis |
| description | Systematic dimensional analysis audit on all equations in a derivation or phase |
| argument-hint | [phase number or file path] |
| context_mode | project-aware |
| allowed-tools | ["read_file","shell","grep","glob","write_file","ask_user"] |
<codex_runtime_notes> Codex shell compatibility:
gpd on PATH.GPD_ACTIVE_RUNTIME=codex uv run gpd ....
</codex_runtime_notes><codex_questioning>
Dimensional analysis is the cheapest and most powerful diagnostic in physics. It catches ~30% of errors at near-zero cost. This command applies it systematically rather than ad hoc.
Why a dedicated command: Dimensional analysis is often done informally -- "looks right" -- but rigorous tracking through multi-step derivations catches errors that informal checks miss. A factor of hbar dropped on line 12 of a derivation propagates silently until the final answer is off by orders of magnitude.
Target: $ARGUMENTSInterpretation:
Load unit system:
cat .gpd/research-map/FORMALISM.md 2>/dev/null | grep -A 10 "Unit System"
cat .gpd/research-map/FORMALISM.md 2>/dev/null | grep -A 20 "Notation and Conventions"
<execution_context>
Perform a systematic dimensional analysis audit on every equation in a derivation, computation, or phase. Track dimensions through all algebraic steps, verify consistency, and flag any dimensional anomalies.Called from $gpd-dimensional-analysis command. Produces DIMENSIONAL-ANALYSIS.md report.
Dimensional analysis is the cheapest and most powerful diagnostic in physics. It catches ~30% of errors at near-zero cost. This workflow applies it systematically rather than ad hoc.
Load project state and conventions to determine the unit system:
INIT=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local init phase-op --include state,config)
if [ $? -ne 0 ]; then
echo "ERROR: gpd initialization failed: $INIT"
# STOP — display the error to the user and do not proceed.
fi
state_exists: true): Extract convention_lock, especially units and natural_units settings. Extract active approximations for context on what dimensions are independent.state_exists is false (standalone usage): Proceed — the unit system will be established explicitly in Step 1 via ask_user.The convention_lock unit system setting (natural units, SI, CGS, etc.) directly determines which dimensions are independent and what the dimensional assignments table looks like.
Convention verification (if project exists):
CONV_CHECK=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local --raw convention check 2>/dev/null)
if [ $? -ne 0 ]; then
echo "WARNING: Convention verification failed — unit system may be inconsistent"
echo "$CONV_CHECK"
fi
Dimensional analysis results depend critically on the unit system. In natural units (hbar=c=1), energy and mass have the same dimension; in SI they don't. A convention mismatch here invalidates the entire analysis.
Before checking any equations, establish the unit system in use.
Ask the user once using a single compact prompt block if not found in project files:
Build dimensional lookup table:
## Dimensional Assignments
| Quantity | Symbol | Dimensions (natural) | Dimensions (SI) |
| ------------------ | ------ | -------------------- | ----------------- |
| Energy | E | [E] | [M L^2 T^{-2}] |
| Momentum | p | [E] | [M L T^{-1}] |
| Position | x | [E^{-1}] | [L] |
| Time | t | [E^{-1}] | [T] |
| Mass | m | [E] | [M] |
| Wavefunction (3D) | psi | [E^{3/2}] | [L^{-3/2}] |
| Action | S | [1] | [M L^2 T^{-1}] |
| Lagrangian density | L | [E^4] | [M L^{-1} T^{-2}] |
| {project-specific} | ... | ... | ... |
Scan target for all equations:
# LaTeX equations
grep -n "\\\\begin{equation\|\\\\begin{align\|\\\\begin{eqnarray\|\\$\\$\|\\\\\\[" "$TARGET_FILE" 2>/dev/null
# Python expressions with physics content
grep -n "=.*\(np\.\|scipy\.\|sympy\.\|integrate\|solve\|eigenval\)" "$TARGET_FILE" 2>/dev/null
# Mathematica expressions
grep -n "=.*\(Integrate\|Solve\|DSolve\|Eigenvalues\)" "$TARGET_FILE" 2>/dev/null
Number each equation for tracking.
For every equation, perform the following checks:
For each term in each equation:
For every transcendental function (exp, log, sin, cos, erf, Bessel, etc.):
For every power law (x^n where n is not integer):
For every integral:
For every derivative:
Dirac delta function delta(x) has dimensions [x]^{-1}:
Verify everywhere delta functions appear.
For tensor equations:
For multi-step derivations, track dimensions through the chain:
Step 1: [LHS] = [A] + [B] Check: [A] == [B]
Step 2: [LHS'] = [f(LHS)] Check: dimensions propagate correctly through f
Step 3: [Result] = [LHS'] * [C] Check: [Result] has expected final dimensions
Flag the first step where dimensions become inconsistent -- this is likely where the error was introduced.
If working in natural units, restore factors of hbar, c, k_B explicitly for at least the final result:
The action S must be dimensionless in natural units (or have dimensions [M L^2 T^{-1}] = [hbar] in SI):
The partition function Z = Tr(e^{-beta H}) must be dimensionless:
Probabilities and probability densities:
Write DIMENSIONAL-ANALYSIS.md:
---
target: { phase or file }
date: { YYYY-MM-DD }
unit_system: { natural/SI/CGS }
equations_checked: { N }
anomalies_found: { M }
status: consistent | anomalies_found
---
# Dimensional Analysis Report
## Unit System
{Unit system and dimensional assignments used}
## Equations Checked
| # | Equation | Location | Status | Notes |
| --- | ------------------ | ----------- | ------ | -------------- |
| 1 | {name/description} | {file:line} | OK | |
| 2 | {name/description} | {file:line} | ERROR | {what's wrong} |
## Anomalies Found
### Anomaly {N}: {Brief description}
- **Location:** {file:line}
- **Equation:** {the equation}
- **Expected dimensions:** {what it should be}
- **Found dimensions:** {what it actually is}
- **Likely cause:** {missing factor of hbar, wrong measure, etc.}
- **Severity:** CRITICAL (wrong physics) | WARNING (suspicious) | NOTE (convention-dependent)
## Dimensional Tracking
{For multi-step derivations, show the dimension chain step by step}
## Summary
- Equations checked: {N}
- Consistent: {M}
- Anomalies: {K}
- {Assessment}
Ensure output directory exists:
mkdir -p .gpd/analysis
Save to appropriate location:
${phase_dir}/DIMENSIONAL-ANALYSIS.md.gpd/analysis/dimensional-{slug}.mdIf anomalies found:
## Dimensional Analysis: {N} anomalies found
{List anomalies with severity}
Suggested next steps:
- `$gpd-debug` -- investigate anomalies
- Fix directly -- if cause is obvious (missing factor, wrong measure)
If all consistent:
## Dimensional Analysis: All {N} equations consistent
No dimensional anomalies detected.
Commit the report:
PRE_CHECK=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local pre-commit-check --files "${OUTPUT_PATH}" 2>&1) || true
echo "$PRE_CHECK"
/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local commit \
"docs: dimensional analysis audit — ${phase_slug:-standalone}" \
--files "${OUTPUT_PATH}"
Where ${OUTPUT_PATH} is the path where DIMENSIONAL-ANALYSIS.md was written.
<success_criteria>
</execution_context>
Pre-flight check:
CONTEXT=$(/Users/charlie/.gpd/venv/bin/python -m gpd.runtime_cli --runtime codex --config-dir ./.codex --install-scope local --raw validate command-context dimensional-analysis "$ARGUMENTS")
if [ $? -ne 0 ]; then
echo "$CONTEXT"
exit 1
fi
Follow the dimensional-analysis workflow: @./.codex/get-physics-done/workflows/dimensional-analysis.md
For comprehensive verification (dimensional analysis + limiting cases + symmetries + convergence), use $gpd-verify-work.
<success_criteria>