File size: 2,516 Bytes
2d5968c
 
 
 
 
 
 
 
 
 
 
 
b0dda0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bdfcde8
 
 
 
 
b0dda0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
bdfcde8
 
 
 
 
 
 
 
b0dda0c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
---
library_name: staticplay-curiodynamics
license: mit
tags:
- physics
- symbolic-regression
- curiosity
- dynamics
- discovery
- scientific-ml
---

# Staticplay CurioDynamics

Curiosity-driven symbolic physics discovery from raw trajectories (position, velocity, time). The agent observes only state and learns a sparse symbolic model that recovers hidden dynamics such as gravity, drag, and wind.

## What It Does
- Generates a hidden physics world (projectile motion with drag + wind).
- Observes only `position`, `velocity`, and `time`.
- Learns a symbolic acceleration model via sparse regression.
- Recovers interpretable formulas like:
  - `ax = wind − k * vx * |vx|`
  - `ay = −g − k * vy * |vy|`

## Quick Start
Requires Python 3.10+.

```powershell
python .\physics_world.py
```

## CLI Usage
```powershell
python .\physics_world.py --episodes 50 --steps 200 --g 9.81 --drag 0.12 --wind 0.4 --drag_power 2.0 --dt 0.1 --seed 123
```

## How It Works
1. Simulates a hidden world with gravity + drag + wind.
2. Collects state transitions only (no equations given).
3. Fits a sparse symbolic model over a small feature library.
4. Interprets the recovered constants as wind and gravity.

## Latest Test Results
Hidden world: quadratic drag + wind

```
g_true = 9.81
drag_true = 0.12
wind_true = 0.4

model_ax: ax = 0.4 − 0.12 * vx|vx|
model_ay: ay = −9.81 − 0.12 * vy|vy|
wind_est = 0.4
g_est = 9.81
```

## Example Output
```text
{'g_true': 9.81, 'drag_true': 0.12, 'wind_true': 0.4, 'drag_power_true': 2.0,
 'model_ax': {'vx_abs_vx': -0.12, '1': -2.209},
 'model_ay': {'vy_abs_vy': -0.12, '1': -13.034},
 'wind_est': 0.4, 'g_est': 9.81, 'samples': 634}
```

## Install
No external dependencies beyond standard library.

If you want a virtual environment:
```powershell
python -m venv .venv
.\.venv\Scripts\activate
python .\physics_world.py
```

## Files
- `physics_world.py`: hidden physics world + curiosity agent + symbolic regression

## How To Run Different Scenarios
Edit `run_stress_test(...)` in `physics_world.py`:
- `wind`
- `drag`
- `drag_power`
- `episodes`
- `steps`

Example:
```python
result = run_stress_test(
    episodes=50,
    steps=200,
    g=9.81,
    drag=0.12,
    wind=0.4,
    drag_power=2.0,
    dt=0.1
)
print(result)
```

## Notes
This is intentionally minimal and deterministic to highlight discovery mechanics. The feature library is constrained to keep the model interpretable.

## Acknowledgements
- teliov/symcat-to-synthea

## Links
- https://staticplay.co.uk