Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

favicon Ballistic Solver Library

LGPL library for small arms ballistic calculations based on point-mass (3 DoF) plus spin drift.

license pypi pypi-pre downloads downloads/month coverage py-versions Made in Ukraine

powered by bclibc powered by pyodide

Pre-commit

Contents

Installation

uv

uv add py-ballisticcalc

# Using precompiled backend (improves performance)
uv add py-ballisticcalc[exts]

# Using matplotlib and pandas uses additional dependencies
uv add py-ballisticcalc[charts]

# Get everything, including the SciPy engine
uv add py-ballisticcalc[exts,charts,scipy]

pip

pip install py-ballisticcalc

# Using precompiled backend (improves performance)
pip install py-ballisticcalc[exts]

# Using matplotlib and pandas uses additional dependencies
pip install py-ballisticcalc[charts]

# Get everything, including the SciPy engine
pip install py-ballisticcalc[exts,charts,scipy]

Quick Start - click here to open Quick Start guide

Interactive Web REPL

Prefer to try it before installing anything? Open the Interactive Web REPL — runs entirely in your browser via Pyodide.

Examples

Ballistic Concepts

Units

Work in your preferred terms with easy conversions for the following dimensions and units:

  • Angular: radian, degree, MOA, mil, mrad, thousandth, inch/100yd, cm/100m, o'clock
  • Distance: inch, foot, yard, mile, nautical mile, mm, cm, m, km, line
  • Energy: foot-pound, joule
  • Pressure: mmHg, inHg, bar, hPa, PSI
  • Temperature: Fahrenheit, Celsius, Kelvin, Rankine
  • Time: second, minute, millisecond, microsecond, nanosecond, picosecond
  • Velocity: m/s, km/h, ft/s, mph, knots
  • Weight: grain, ounce, gram, pound, kilogram, newton

Calculation Engines

Choose between different calculation engines, or build your own. Included engines:

Mean time

Mean time per call by engine

Speedup vs python.rk4

Speedup vs python.rk4

Engine Name Speed (Find Zero / Trajectory) Dependencies Description Tests
python+rk4 Baseline (1x) None; default Runge-Kutta 4th-order integration tests
python+euler ⬇️ 0.6x / 0.6x (slower) None Euler 1st-order integration tests
python+verlet ⬇️ 0.8x / 0.8x (slower) None Verlet 2nd-order symplectic integration tests
cython+rk4 ⬆️ 205x / 129x (faster) [exts] Compiled Runge-Kutta 4th-order tests
cython+euler ⬆️ 54x / 44x (faster) [exts] Compiled Euler integration tests
cython+verlet ⬆️ 130x / 99x (faster) [exts] Compiled Verlet 2nd-order symplectic tests
cython+rkck1 ⬆️ 2567x / 326x (faster) [exts] Compiled Cash-Karp adaptive RK45 tests
cython+dopri1 ⬆️ 2567x / 326x (faster) [exts] Dormand--Prince 5(4), SciPy RK45-style controller tests
cython+tsitouras1 ⬆️ 2567x / 326x (faster) [exts] Tsitouras 5(4), SciPy RK45-style controller tests
scipy+rk23 ⬆️ 3.4x / 3.2x (faster) [scipy] SciPy solve_ivp RK23 — Bogacki–Shampine 3(2), lowest order: cheap steps, loose accuracy —
scipy+rk45 ⬆️ 5.4x / 9.8x (faster) [scipy] SciPy solve_ivp RK45 — Dormand–Prince 5(4), SciPy default: general-purpose tests
scipy+dop853 ⬆️ 1.8x / 4.8x (faster) [scipy] SciPy solve_ivp DOP853 — Dormand–Prince 8(5,3), high order: for tight tolerances —
scipy+radau ⬆️ 1.5x / 1.5x (faster) [scipy] SciPy solve_ivp Radau — implicit Radau IIA 5th-order, for stiff problems —
scipy+bdf ↔️ 0.8x / 1.5x (mixed) [scipy] SciPy solve_ivp BDF — implicit variable-order (1–5) multistep, for stiff problems —
scipy+lsoda ⬆️ 2.9x / 4.3x (faster) [scipy] SciPy solve_ivp LSODA — Adams/BDF (ODEPACK), switches automatically between non-stiff and stiff —

About project

The library provides trajectory calculation for ballistic projectiles launched by airguns, bows, firearms, artillery, etc.

The core point-mass (3DoF) ballistic model underlying this project was used on the earliest digital computers. Robert McCoy (author of Modern Exterior Ballistics) implemented one in BASIC. JBM published code in C. Nikolay Gekht ported that to C#, extended it with formulas from Bryan Litz's Applied Ballistics, and ported it to Go, while Alexandre Trofimov implemented a calculator in JavaScript.

This Python3 implementation has been expanded to support multiple ballistic coefficients and custom drag functions, such as those derived from Doppler radar data.

Contributors

This project exists thanks to all the people who contribute.

Special thanks to:

  • David Bookstaber - Ballistics Expert
    For help understanding and improving the functionality
  • Serhiy Yevtushenko - Applied Mathematician
    For helping in consultations, testing, and improving edge case compatibility
  • Nikolay Gekht
    For the source code in C# and GO-lang from which this project firstly was forked

Sister projects

  • bclibc - High performance C++/C99 Ballistic solver engine
  • micropython-bclibc - Pure C99 Ballistic Solver Engine for MicroPython (bclibc subset)
  • tiny-bclibc-wasm - bclibc's tiny_bclibc as WebAssembly for CPython, PyPy and Pythonista, usable as a py-ballisticcalc engine
  • ebalistyka - Ballistic Calculator built with Flutter and high performance C++ engine
  • js-ballistics - ISC library for small arms ballistic calculations (JavaScript ES6+)

License

Copyright (C) 2023 Yaroshenko Dmytro (o-murphy)

This library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License v3.0 as published by the Free Software Foundation.

See LICENSE for the full text. See CHANGELOG for release history.

  1. Adaptive RK45; actual speed depends on the configured tolerances. Cash-Karp, Dormand-Prince, and Tsitouras measure in the same performance class as each other on typical trajectories -- see benchmarks for the measurement, not a ranking. ↩ ↩2 ↩3

Release files for py-ballisticcalc 3.0.0rc3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-ballisticcalc 3.0.0rc3
File Size Uploaded
py_ballisticcalc-3.0.0rc3.tar.gz 7.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for py-ballisticcalc 3.0.0rc3
File Interpreter ABI Platform
py_ballisticcalc-3.0.0rc3-py3-none-any.whl Python 3 none any Details

Total release size: 7.6 MB

Release files / py_ballisticcalc-3.0.0rc3.tar.gz

Download URL py_ballisticcalc-3.0.0rc3.tar.gz
Size 7.5 MB
Tags Source
SHA-256 checksum
How to use checksums
bd962e219a5523508114dcc4f413360ead535784db4a6c7f8a9ee2efca6b77b5
BLAKE2b-256 checksum
How to use checksums
050f35f4047c2a4d0bd246cf68783a890800a19d7240893767b88083846abeee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release files / py_ballisticcalc-3.0.0rc3-py3-none-any.whl

Download URL py_ballisticcalc-3.0.0rc3-py3-none-any.whl
Size 154.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3f2bfe7f49d7a6cd4be3d9be0e4e908f7ef5f6b336c904e73668555c9c8cda70
BLAKE2b-256 checksum
How to use checksums
61ca2e2e9f115f815844b1733b0af657cbbf74c4c1a8044641cc9af14b355abb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

3.0.0rc3 This release

2 release files

2.3.1

2 release files

2.3.0

2 release files

2.2.10

2 release files

2.2.9

2 release files

2.2.8

2 release files

2.2.7

2 release files

2.2.6

2 release files

2.2.5

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.1

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.7

2 release files

2.0.6

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.2

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.12

2 release files

1.0.11

1 release file

1.0.10

1 release file

1.0.9

4 release files

1.0.4

3 release files

1.0.0

3 release files

0.2.3

3 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page