| name | physics-simulation-creator |
| version | 1.1.0 |
| description | Create optimal physics simulations using Non-Newtonian Calculus (NNC) parameter tuning. Use for ANY physics simulation to maximize accuracy and minimize computational complexity. The k parameter optimizes numerical behavior - works for smooth problems AND singularities. Automatically detects if singularities exist and handles them appropriately. |
| category | specialists |
| tags | physics, simulation, numerical-methods, optimization, NNC, scientific-computing, accuracy |
| author | meta-calculus-toolkit |
| orchestration | [object Object] |
| mcp_servers | [object Object] |
Physics Simulation Creator
Create optimal physics simulations with automatic parameter tuning using Non-Newtonian Calculus (NNC).
Overview
This skill helps AI agents create ANY numerical physics simulation with optimal accuracy and minimal computational complexity. The k parameter from NNC provides a tuning knob that:
- Maximizes accuracy for your specific problem type
- Minimizes computational steps needed for convergence
- Handles singularities automatically (if present)
Key Insight: Classical calculus (k=0) is not always optimal. Different physics problems benefit from different k values - even smooth problems without singularities.
When to Use This Skill
ALWAYS USE FOR (Significant gains):
- Problems with singularities (1/r, 1/r^2, crack tips, etc.)
- Molecular dynamics (atomic scale, L ~ 1e-10 m)
- Quantum simulations near singularities (hydrogen atom)
- Fracture mechanics (crack tip singularities)
- Gravitational simulations (black holes, 1/r potentials)
USE FOR COMPUTATIONAL EFFICIENCY (Same accuracy, fewer steps):
- Large simulations on consumer hardware - 7-100x step reduction
- Long-time molecular dynamics (run 10x longer trajectories)
- Real-time physics in games/VR (same accuracy, faster)
- Parameter sweeps (run 10x more configurations)
- Stiff ODEs (dramatically fewer steps to converge)
CONSIDER USING FOR (Moderate accuracy gains):
- Microscale simulations (L < 1e-6 m)
- Ultra-high precision requirements (>6 digits)
- Rapid scale-change problems
k=0 IS OPTIMAL FOR (No NNC needed):
- Smooth quantum mechanics (harmonic oscillator)
- Human-scale engineering (1mm - 1km)
- Large-scale cosmology (smooth metrics)
- Problems with adequate engineering tolerance
The Process
1. Analyze problem -> Does it have singularities? What length scale?
2. Select optimal k -> For accuracy AND complexity, not just singularity handling
3. Generate code -> With NNC transforms at optimal k
4. Validate -> Compare accuracy vs classical (k=0)
Singularity Detection (Part of Process, Not the Only Use)
The skill automatically checks: "Does this problem have a singularity I need to watch out for?"
- If YES: k is tuned to handle it (e.g., k=-1 for 1/r)
- If NO: k is still optimized for accuracy/complexity (often k != 0)
When k != 0 Provides Meaningful Gains
Understanding the k(L) Formula
The k(L) formula from multi-objective optimization shows optimal k varies by scale:
| Scale | Optimal k | Accuracy Gain | Step Reduction | Recommendation |
|---|---|---|---|---|
| Planck (1e-35 m) | 0.64 | 50%+ | 50-100x | ALWAYS use NNC |
| Atomic (1e-10 m) | 0.30 | 15-30% | 7-22x | Use NNC - significant |
| Micro (1e-6 m) | 0.24 | 10-20% | 5-10x | Use NNC for large sims |
| Human (1 m) | 0.16 | <5% | 1.5-3x | k=0 unless need speed |
| Solar (1e11 m) | 0.01 | <1% | ~1x | k=0 optimal |
| Galactic (1e21 m) | -0.13 | <5% | ~1x | k=0 optimal |
Practical Decision Rule
Use NNC (k != 0) when:
- Problem has explicit singularities (1/r, 1/r^2, etc.) - ALWAYS
- Length scale < 1e-6 m (microscale and smaller) - accuracy gains > 10%
- Need to reduce computational steps - 7-100x fewer steps at small scales
- Running large simulations on limited hardware - same accuracy, faster
- Ultra-high precision required (>6 digits) - even for smooth problems
Use classical (k = 0) when:
- Smooth problem at human scale (1mm - 1km) AND speed not critical
- Engineering tolerance is adequate (3-4 digits)
- Simplicity preferred AND not computationally constrained
Accuracy vs Complexity Trade-off
The CASCADE algorithm (61.9% win rate vs classical) proves that:
- Optimal k reduces step count by 7-100x (at microscale)
- Optimal k improves accuracy by 10-40,000x (for singularities) or 10-30% (for smooth microscale)
- These gains apply to BOTH singular and smooth problems (but magnitude differs)
Bundled Script: ai_simulation_helper.py
Location: skills/specialists/physics-simulation-creator/ai_simulation_helper.py
For ANY Physics Problem
# Get optimal k from length scale (works for ALL problems)
python ai_simulation_helper.py --length-scale 1e-10 --json
# Check if problem has singularity AND get optimal k
python ai_simulation_helper.py --problem "molecular dynamics" --json
# Generate optimized code
python ai_simulation_helper.py --length-scale 1e-10 --generate python --json
# Lookup k across all scales
python ai_simulation_helper.py --lookup all --json
Script Output Structure
{
"k": 0.2963,
"source": "length_scale",
"length_scale": 1e-10,
"has_singularity": false,
"singularity_type": "none",
"expected_accuracy_gain": "15-30% over classical",
"expected_speedup": "1.5-3x fewer steps"
}
Or with singularity:
{
"k": -1.0,
"source": "singularity_type",
"singularity_type": "1/r",
"has_singularity": true,
"expected_accuracy_gain": "10,000x+ over classical",
"expected_speedup": "7-22x fewer steps"
}
Core Formula
k from Length Scale (Universal)
k_optimal(L) = -0.0137 * log10(L) + 0.1593
This works for ALL problems - singular or smooth.
k from Singularity Type (When Present)
| Singularity | k | Use When |
|---|---|---|
| 1/r | -1.0 | Coulomb, gravitational |
| 1/r^2 | -2.0 | Radiation intensity |
| 1/sqrt(r) | -0.5 | Crack tip stress |
| none | Use k(L) formula | Smooth problems |
Decision Rule:
- If explicit singularity exists: use singularity-based k
- If smooth/unknown: use k(L) formula based on length scale
- NEVER assume k=0 without checking
Workflow Phases
Phase 1: Problem Analysis (Researcher Agent)
Questions to answer:
- What is the characteristic length scale?
- Does the problem have any singularities? (1/r, 1/r^2, etc.)
- What are the accuracy requirements?
- What are the performance requirements?
Output:
problem_analysis:
length_scale: 1e-10 # meters
has_singularity: false
singularity_type: null
accuracy_target: 1e-6
performance_target: real-time
Phase 2: k-Value Selection (CLI Script)
# Always run this - it works for ALL problems
python ai_simulation_helper.py --length-scale {L} --json
If singularity detected:
python ai_simulation_helper.py --singularity "1/r" --json
Phase 3: Code Generation (Coder Agent)
Generate simulation with optimal k, whether singular or smooth.
Phase 4: Validation (Tester Agent)
Compare against classical (k=0) to verify improvement:
- Accuracy comparison
- Step count comparison
- Convergence rate comparison
Sub-Agents (From 206-Agent Registry)
| Agent | Path | Role | When Used |
|---|---|---|---|
| coder-enhanced | foundry/core/ |
Generate complex numerical simulation code with TDD | Phase 3: Code generation |
| quantum-computing-researcher | research/emerging/quantum/ |
Quantum physics, algorithm design, numerical methods expertise | Phase 1: Quantum problems |
| model-evaluation-agent | platforms/ai-ml/evaluation/ |
Rigorous statistical comparison (k=optimal vs k=0), metrics | Phase 4: Accuracy validation |
| experiment-tracking-agent | platforms/ai-ml/experiments/ |
Track simulation experiments, log parameters, reproducibility | Phase 3-4: Experiment logging |
| evaluator | research/ |
Quality gate validation, GO/NO-GO decisions | Phase 4: Final validation |
| root-cause-analyzer | quality/analysis/ |
Debug failed simulations, identify numerical issues | Phase 4: Error diagnosis |
| sublinear-goal-planner | research/reasoning/ |
Complex problem decomposition, multi-step planning | Phase 1: Problem analysis |
Agent Selection Rationale
Why coder-enhanced over coder?
- Better for complex numerical code
- TDD-focused approach for validation
- Handles scientific computing patterns
Why model-evaluation-agent?
- Statistical comparison expertise (paired t-test, effect size)
- Quantifies improvement: k=optimal vs k=0
- Generates evaluation reports
Why experiment-tracking-agent?
- Logs k values, length scales, singularity types
- Tracks accuracy/performance metrics across runs
- Enables reproducibility
Why root-cause-analyzer?
- When simulations fail or produce wrong results
- Identifies numerical issues (NaN, overflow, divergence)
- Maps to ERROR-DETECTION.md patterns
Input/Output Contracts
Input Contract
input_contract:
required:
- problem_description: string
optional:
- length_scale: float # If known
- singularity_type: string # If known ("none" for smooth)
- accuracy_target: float
- performance_target: string
- target_language: string # "python" or "typescript"
Output Contract
output_contract:
required:
- optimal_k: float
- k_source: string # "length_scale" or "singularity_type"
- has_singularity: boolean
- simulation_code: string
optional:
- accuracy_comparison: object # vs k=0
- performance_comparison: object # vs k=0
- validation_report: object
Examples
Example 1: Smooth Quantum Problem (No Singularity)
Problem: Harmonic oscillator simulation
python ai_simulation_helper.py --length-scale 1e-10 --json
Output:
{
"k": 0.2963,
"has_singularity": false,
"expected_accuracy_gain": "15-30% over classical"
}
Result: Even though there's no singularity, k=0.30 gives better accuracy than k=0.
Example 2: Problem WITH Singularity
Problem: Molecular dynamics with Lennard-Jones
python ai_simulation_helper.py --problem "molecular dynamics" --json
Output:
{
"k": -1.0,
"has_singularity": true,
"singularity_type": "1/r",
"expected_accuracy_gain": "10,000x+ over classical"
}
Result: Singularity detected, k tuned to handle it.
Example 3: Large-Scale Cosmology
Problem: Galaxy formation simulation
python ai_simulation_helper.py --length-scale 1e21 --json
Output:
{
"k": -0.1284,
"has_singularity": false,
"expected_accuracy_gain": "5-10% over classical"
}
Result: At galactic scales, k goes slightly negative but is still not exactly 0.
Key Mindset Shift
OLD (Incomplete) Thinking:
"Use NNC only for singularities. Otherwise use classical (k=0)."
NEW (Complete) Thinking:
"NNC with optimal k provides significant gains for singularities and microscale problems. For smooth human-scale problems, k=0 remains optimal. Always CHECK rather than ASSUME."
Decision Summary:
| Condition | Action |
|---|---|
| Singularity present | Use k from singularity table (k=-1 for 1/r, etc.) |
| L < 1e-6 m, smooth | Use k from k(L) formula (gains > 10%) |
| Human scale, smooth | k=0 is optimal (gains < 5%) |
| Need ultra-precision | Consider k(L) even for smooth problems |
Guardrails
ALWAYS
- Run the CLI script to get optimal k (even for smooth problems)
- Check if singularities exist (but don't ONLY use skill for singularities)
- Compare results against k=0 baseline
- Document the k value and why it was chosen
NEVER
- Assume k=0 is optimal without checking
- Skip k optimization because "there's no singularity"
- Use this skill ONLY for singular problems
Success Metrics
| Metric | Target |
|---|---|
| k-value selection | Use CLI script output |
| Accuracy vs k=0 | Document improvement |
| Performance vs k=0 | Document step reduction |
| Singularity detection | Correctly identify if present |
References
- Meta-Calculus Portfolio: https://meta-calculus-portfolio-production.up.railway.app/
- k(L) Formula: https://meta-calculus-portfolio-production.up.railway.app/results/multiscale
- CASCADE Results: https://meta-calculus-portfolio-production.up.railway.app/cascade
- GUD Benchmarks: https://meta-calculus-portfolio-production.up.railway.app/proof/gud-benchmarks
Memory Namespace
namespaces:
- physics-simulation-creator/problems/{id}: Analyzed problems
- physics-simulation-creator/simulations/{id}: Generated simulations
- physics-simulation-creator/comparisons/{id}: k=optimal vs k=0 results
- improvement/audits/physics-simulation-creator: Skill audits
Recursive Improvement Integration (v2.0)
Role in the Loop
Physics-simulation-creator is part of the recursive self-improvement loop:
physics-simulation-creator (SPECIALIST SKILL)
|
+--> Creates optimized physics simulations with NNC
+--> Can be improved BY prompt-forge
+--> Audited BY skill-auditor
Phase 0: Expertise Loading
Before generating simulations, check for domain expertise:
expertise_check:
domain: physics-simulation
path: .claude/expertise/physics-simulation.yaml
if_exists:
- Load: Known singularity patterns
- Load: Proven k-value mappings
- Load: Common simulation pitfalls
- Apply: Use expertise to guide k-selection
if_missing:
- Flag: Discovery mode
- Plan: Generate expertise learnings after successful simulations
- Capture: New problem types, k-values, improvement metrics
Input/Output Contracts
input_contract:
required:
- problem_description: string # Physics problem to simulate
optional:
- length_scale: float # Characteristic scale in meters
- singularity_type: string # "1/r", "1/r^2", "1/sqrt(r)", "none"
- accuracy_target: float # Desired accuracy (e.g., 1e-6)
- performance_target: string # "real-time", "batch", "consumer-hardware"
- target_language: string # "python" or "typescript"
output_contract:
required:
- optimal_k: float # Selected k value
- k_source: string # "length_scale" or "singularity_type"
- has_singularity: boolean # Whether singularity detected
- simulation_code: string # Generated code
optional:
- accuracy_comparison: object # vs k=0 baseline
- step_reduction: object # vs k=0 baseline
- validation_report: object # Verification results
- expertise_delta: object # New learnings for expertise update
Quality Scoring System
scoring_dimensions:
k_selection_accuracy:
score: 0.0-1.0
weight: 0.30
checks:
- "k matches singularity type (if present)"
- "k from CLI script (not hardcoded)"
- "k validated against expected range [-6, 1]"
transform_correctness:
score: 0.0-1.0
weight: 0.25
checks:
- "Forward transform implemented"
- "Inverse transform implemented"
- "Roundtrip error < 1e-10"
- "k=1 special case handled"
physics_accuracy:
score: 0.0-1.0
weight: 0.25
checks:
- "Solution bounded at singularity"
- "Matches analytical solution (if available)"
- "Energy conservation (for dynamics)"
- "Improvement over k=0 documented"
documentation_quality:
score: 0.0-1.0
weight: 0.20
checks:
- "k value and source documented"
- "Comparison vs k=0 included"
- "Expected improvement stated"
- "Assumptions explicit"
overall_score: weighted_average
minimum_passing: 0.7
Eval Harness Integration
Physics-simulation-creator improvements are tested against:
benchmark: physics-simulation-benchmark-v1
tests:
- ps-001: Molecular dynamics with Lennard-Jones
- ps-002: Crack tip stress field
- ps-003: Vortex core velocity
- ps-004: Radiation intensity
- ps-005: Smooth quantum harmonic oscillator
- ps-006: N-body computational efficiency
minimum_scores:
k_selection_accuracy: 0.8
transform_correctness: 0.9
physics_accuracy: 0.7
regression: physics-simulation-regression-v1
tests:
- psr-001: k sign correct for singularities (must_pass)
- psr-002: Transform roundtrip preserves values (must_pass)
- psr-003: NNC improves over k=0 for singularities (must_pass)
- psr-004: CLI script produces valid k (must_pass)
failure_threshold: 0
Uncertainty Handling
When problem type is unclear:
confidence_check:
if confidence >= 0.8:
- Proceed with k-selection
- Document assumptions about singularity type
- Generate simulation code
if confidence 0.5-0.8:
- Present 2-3 k-value options
- Ask user: "Does this problem have a singularity?"
- Ask user: "What is the characteristic length scale?"
- Document uncertainty areas
if confidence < 0.5:
- DO NOT proceed with simulation
- List what is unclear about the physics
- Ask specific clarifying questions
- Request physics equations or reference materials
- NEVER guess at singularity type
Cross-Skill Coordination
Physics-simulation-creator works with:
| Skill | Coordination |
|---|---|
| prompt-forge | Can improve this skill's documentation |
| skill-auditor | Audits this skill for improvement opportunities |
| functionality-audit | Validates simulation correctness |
| model-evaluation-agent | Compares k=optimal vs k=0 accuracy |
| experiment-tracking-agent | Tracks simulation experiments |
Guardrails
NEVER:
- Generate k values outside the physics-valid range
- Skip validation against k=0 baseline
- Assume smooth when singularity might exist
- Create simulations without documenting k-source
- Modify frozen eval harness benchmarks
ALWAYS:
- Run CLI script for k-selection
- Include comparison vs k=0
- Document assumptions explicitly
- Support auditing with clear metrics
- Capture learnings for expertise update
!! SKILL COMPLETION VERIFICATION (MANDATORY) !!
After invoking this skill, verify:
- CLI Script Used: Did you run ai_simulation_helper.py?
- k Value Justified: Is the k value from CLI output (not hardcoded)?
- Comparison Documented: Did you compare vs k=0 baseline?
- Transforms Correct: Forward AND inverse transforms present?
- Physics Verified: Does solution behave correctly at singularity?
Remember: Skill() -> Task() -> TodoWrite() - ALWAYS
Core Principles
1. Optimization is Universal, Not Singular
The optimal numerical method depends on the problem scale and structure, not just the presence of singularities. Classical calculus (k=0) is one choice among many, not the default.
In practice:
- Always run ai_simulation_helper.py to determine optimal k, even for smooth problems
- Use k(L) formula for scale-dependent optimization: k = -0.0137 * log10(L) + 0.1593
- Recognize that k != 0 provides 10-30% accuracy gains at microscales (L < 1e-6 m)
- Understand that k handles singularities (k=-1 for 1/r) AND optimizes smooth problems
- Never assume k=0 is optimal without verification
- Document why k was chosen (scale-based or singularity-based)
2. Validate Against Baselines
Numerical improvements must be demonstrated empirically, not assumed. Every simulation should prove it outperforms classical methods.
In practice:
- Always compare k=optimal vs k=0 (classical) baseline
- Measure accuracy improvement (relative error reduction)
- Measure computational efficiency (step count reduction)
- Document convergence rates for both methods
- Use model-evaluation-agent for statistical comparison (paired t-test)
- Report both accuracy gains AND step reduction (not just one)
- Validate that solution remains physically meaningful (energy conservation, boundedness)
3. Transparency Through Reproducibility
Simulations must be independently verifiable. The k-selection process, transforms, and validation must be fully documented.
In practice:
- Document k value, source (length scale or singularity type), and expected improvement
- Include both forward and inverse NNC transforms in code
- Provide comparison plots (k=optimal vs k=0 error curves)
- Store results in experiment-tracking-agent with full parameters
- Make assumptions explicit (smoothness, boundary conditions, scale ranges)
- Include roundtrip error tests (transform -> inverse -> verify < 1e-10 error)
- Archive simulation code, k-selection rationale, and validation results
Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Assuming k=0 is optimal | Misses 10-30% accuracy gains at microscales and 10,000x+ gains for singularities by defaulting to classical calculus | Always run ai_simulation_helper.py. Use k(L) formula for scale-based optimization. Only use k=0 if empirically validated. |
| Using NNC only for singularities | Limits NNC to singularity handling, ignores computational efficiency gains for smooth problems | Recognize NNC optimizes BOTH accuracy (singularities) AND complexity (step reduction). Use for any simulation where speed matters. |
| Skipping k=0 comparison | Cannot prove improvement, lacks evidence for k-selection, wastes effort if classical methods work fine | Always benchmark k=optimal vs k=0. Document accuracy and step count differences. Use model-evaluation-agent for statistical validation. |
| Hardcoding k values | Violates scale-dependence, uses wrong k for problem, cannot adapt to different physics | Use ai_simulation_helper.py for every problem. Never hardcode k without CLI verification. Store k-selection rationale. |
| Missing inverse transforms | Forward-only transforms prevent coordinate recovery, breaks visualization and boundary conditions | Implement BOTH forward (u -> v) AND inverse (v -> u) transforms. Test roundtrip error < 1e-10. |
| No physics validation | Numerically stable but physically wrong (negative energies, unbounded solutions, violation of conservation laws) | Verify physical constraints: energy conservation, boundedness at singularities, correct asymptotic behavior. Use domain experts. |
Conclusion
The Physics Simulation Creator skill challenges the assumption that classical calculus (k=0) is universally optimal. By leveraging Non-Newtonian Calculus (NNC) with scale-dependent parameter tuning, this skill delivers significant accuracy improvements (10-30% for microscales, 10,000x+ for singularities) and computational efficiency gains (7-100x step reduction).
The core insight is that optimal k varies by problem scale and structure. The bundled ai_simulation_helper.py script automates k-selection using the k(L) formula for length-scale optimization and singularity-specific tables for problems with explicit discontinuities. This ensures that every simulation uses the numerically optimal method for its specific physics, rather than defaulting to classical approaches.
By enforcing baseline comparisons, transparent documentation, and physics validation, this skill ensures that NNC-based simulations are not only faster and more accurate but also reproducible and scientifically rigorous. Whether simulating molecular dynamics at atomic scales or handling gravitational singularities, this skill provides a systematic framework for optimal numerical physics simulation.