Repository navigation
Standard Library
open1s edited this page Sep 25, 2026
·
1 revision
std/ ships pure PWE modules — no privileged runtime hooks. Each exposes functions keyed by namespaced physical constants you can override with --param on the same artifact.
Import them like Python modules:
import "std/forces"
import "std/robotics" as rb
from "std/math" import sqrt
| Module | Contents |
|---|---|
std/math |
Numeric helpers, sqrt, clamp, interpolation, constants. |
std/particles |
Particle emission and lifecycle helpers. |
std/forces |
Springs, damping, drag, applied forces as accelerations. |
std/mechanics |
Rigid-body mechanics helpers. |
std/chemistry |
Full periodic table (Z = 1–118), Arrhenius, kinetics, pH. |
std/thermal |
Newton cooling, Stefan–Boltzmann, conduction, radiative cooling. |
std/acoustics |
Sound pressure level, Doppler, propagation. |
std/optics |
Beer–Lambert attenuation, Fresnel, refraction. |
std/em |
Coulomb, Lorentz force, cyclotron, Poynting vector. |
std/robotics |
Forward/inverse kinematics, PID, differential drive. |
std/units |
Unit literals and conversions for [m/s^2]-style annotations. |
std/control |
Control-system building blocks (setpoints, feedback). |
world {
gravity = (0, 0, 0)
entity body { state = (x = 1.0, vx = 0.0, temp = 353.15) }
}
systems {
update { on = body; dt = 0.1
vx = forces.spring_accel(2.0, x, 1.0) + forces.damping_accel(0.3, vx, 1.0) + 0.0
temp = thermal.radiative_cooling(temp, 293.15, 0.9, 1.0, 1.0, 700.0) + 0.0
}
}
Because a module is PWE source, you can read std/*.pwe directly — there is no hidden native layer. Standard-library behavior is covered by the test suite alongside the runtime and language tests.
See also: The PWE Language · Examples
PWE Wiki
- Home
- Getting Started
- The PWE Language
- Standard Library
- Examples
- Determinism
- Architecture
- The Frozen Contract
- FAQ
Repository
The world is the single source of truth. Program it. Prove it. Watch it move.