advanced

Pyvorin for Astrophysics

N-body simulation and signal processing for radio astronomy.

Published May 30, 2026

N-Body Simulation

Direct summation and Barnes-Hut tree code for gravitational dynamics.

def nbody_step(bodies, dt):
    for i in range(len(bodies)):
        fx = fy = fz = 0.0
        for j in range(len(bodies)):
            if i != j:
                dx = bodies[j].x - bodies[i].x
                r = (dx*dx + dy*dy + dz*dz) ** 0.5
                f = G * bodies[i].m * bodies[j].m / (r*r)
                fx += f * dx / r
        bodies[i].vx += fx / bodies[i].m * dt

Radio Astronomy

FFT-based pulsar detection and baseline removal.