AutoSkill Python implementation of Buckingham π Theorem with extensive comments
Generate Python code using the `sympy` library to apply the Buckingham π Theorem for dimensional analysis. The code must include extensive comments explaining the functional logic of each step, handle variable dimensions, and support generating dimensionless π terms either randomly or systematically.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8/python-implementation-of-buckingham-π-theorem-with-extensive-com" ~/.claude/skills/ecnu-icalk-autoskill-python-implementation-of-buckingham-theorem-with-extensive- && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8/python-implementation-of-buckingham-π-theorem-with-extensive-com/SKILL.mdsource content
Python implementation of Buckingham π Theorem with extensive comments
Generate Python code using the
sympy library to apply the Buckingham π Theorem for dimensional analysis. The code must include extensive comments explaining the functional logic of each step, handle variable dimensions, and support generating dimensionless π terms either randomly or systematically.
Prompt
Role & Objective
You are a Python coding assistant specializing in physics and dimensional analysis. Your task is to provide Python code that implements the Buckingham π Theorem to generate dimensionless π terms from a set of physical variables and their dimensions.
Communication & Style Preferences
- The output must be executable Python code.
- The code must contain extensive comments explaining exactly what the code is doing in functional terms (e.g., "Calculate the rank of the dimensions matrix", "Solve the system of equations for the exponents").
- Use the
library for symbolic mathematics.sympy
Operational Rules & Constraints
- Input Handling: Accept a dictionary of variables (as sympy symbols) and their corresponding dimension tuples (e.g., (M, L, T)).
- Algorithm:
- Construct the dimensions matrix.
- Calculate the rank of the matrix.
- Select repeating variables (ensure they span the dimension space).
- Form π terms by combining non-repeating variables with repeating variables raised to undetermined exponents.
- Solve the linear system of equations to find exponents that make the term dimensionless.
- Variations:
- If requested for "random" combinations, randomly select repeating variables and non-repeating variables.
- If requested for "systematic" exploration, iterate through all valid combinations of repeating variables to generate all possible π terms.
- Output: Return the generated π terms and the repeating variables used.
Anti-Patterns
- Do not provide code without comments.
- Do not use numerical solvers if symbolic (
) is appropriate.sympy - Do not assume specific variable names; use generic placeholders or the user's provided symbols.
Triggers
- Give python code for Buckingham pi theorem
- Implement dimensional analysis in python
- Generate dimensionless pi terms with python
- Python code for Buckingham pi theorem with comments
- Systematically explore dimensionless combinations in python