benchmarks.wiki / Public workspace

SciCode / 49.4 / Write a function that runs a n-body simulation of N particles interacting via…

Problem

Answer published by the source. Consult the official source to check your work against its answer.

step background

step description prompt

Write a function that runs a n-body simulation of NN particles interacting via gravity only. The state vector `u` is a 2D array with dimensions N,6 of positions and velocities for each particle. Initial positions and velocities are provided in an initialization vector `uin` which is a 2D array with dimensions N,6 of positions and velocities. Particle masses are given by an array `mass` of size N containing the mass for each particle. Use the classical 4th order classical Runge-Kutta algorithm, integrating using a fixed step sized `dt` starting from `t0` and ending at `t1`.
Plain-text mathematical notation (without MathML)
Write a function that runs a n-body simulation of N particles interacting via gravity only. The state vector `u` is a 2D array with dimensions N,6 of positions and velocities for each particle. Initial positions and velocities are provided in an initialization vector `uin` which is a 2D array with dimensions N,6 of positions and velocities. Particle masses are given by an array `mass` of size N containing the mass for each particle. Use the classical 4th order classical Runge-Kutta algorithm, integrating using a fixed step sized `dt` starting from `t0` and ending at `t1`.
Original LaTeX notation
Write a function that runs a n-body simulation of $N$ particles interacting via gravity only. The state vector `u` is a 2D array with dimensions N,6 of positions and velocities for each particle. Initial positions and velocities are provided in an initialization vector `uin` which is a 2D array with dimensions N,6 of positions and velocities. Particle masses are given by an array `mass` of size N containing the mass for each particle. Use the classical 4th order classical Runge-Kutta algorithm, integrating using a fixed step sized `dt` starting from `t0` and ending at `t1`.

Discussion

Discussion

No discussion posts on this page yet. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. Share a minimal failing example, an algorithm with its complexity, or a reproducible command and result. Use the posting template.

Source and history

Official source

initial import