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.
/plugin marketplace add DNYoussef/context-cascade/plugin install dnyoussef-context-cascade@DNYoussef/context-cascadeThis skill inherits all available tools. When active, it can use any tool Claude has access to.
ERROR-DETECTION.mdEXAMPLES.mdQUICK-REFERENCE.mdSOP-MATHEMATICS.mdai_simulation_helper.pyphysics-simulation-creator-process.dotCreate optimal physics simulations with automatic parameter tuning using Non-Newtonian Calculus (NNC).
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:
Key Insight: Classical calculus (k=0) is not always optimal. Different physics problems benefit from different k values - even smooth problems without singularities.
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)
The skill automatically checks: "Does this problem have a singularity I need to watch out for?"
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 |
Use NNC (k != 0) when:
Use classical (k = 0) when:
The CASCADE algorithm (61.9% win rate vs classical) proves that:
Location: skills/specialists/physics-simulation-creator/ai_simulation_helper.py
# 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
{
"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"
}
k_optimal(L) = -0.0137 * log10(L) + 0.1593
This works for ALL problems - singular or smooth.
| 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:
Questions to answer:
Output:
problem_analysis:
length_scale: 1e-10 # meters
has_singularity: false
singularity_type: null
accuracy_target: 1e-6
performance_target: real-time
# 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
Generate simulation with optimal k, whether singular or smooth.
Compare against classical (k=0) to verify improvement:
| 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 |
Why coder-enhanced over coder?
Why model-evaluation-agent?
Why experiment-tracking-agent?
Why root-cause-analyzer?
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:
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
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.
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.
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.
"Use NNC only for singularities. Otherwise use classical (k=0)."
"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."
| 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 |
| 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 |
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
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
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_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
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
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
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
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 |
NEVER:
ALWAYS:
After invoking this skill, verify:
Remember: Skill() -> Task() -> TodoWrite() - ALWAYS