Skip to main content

Four novel multi-phase hybrid bracketing algorithms for numerical root finding: Opt.BF (mpbf), Opt.BFMS (mpbfms), Opt.TF (mptf), Opt.TFMS (mptfms). Combines classical methods with modified secant for superior convergence (e.g., mptfms averages 2.3 iterations). Reference DOI: 10.21608/joems.2026.440115.1078

Project description

HybridRoots

PyPI version License: MIT Python 3.8+

Multi-Phase Hybrid Bracketing Algorithms for Numerical Root Finding

A Python package implementing four novel root-finding algorithms that combine bisection/trisection, false position, and modified secant methods for efficient, reliable nonlinear equation solving.

Features

  • Four Algorithms: Opt.BF, Opt.BFMS, Opt.TF, Opt.TFMS
  • Pure Python: No external dependencies required
  • SciPy Compatible: Same interface as scipy.optimize.brentq
  • Deterministic: Guaranteed convergence for bracketed roots

Algorithm Summary

Algorithm Method Avg Iterations NFE/iter
mpbfms Bisection + False Position + Modified Secant ~2.8 3-4
mptfms Trisection + False Position + Modified Secant ~2.4 4-5
mpbf Bisection + False Position ~6.7 2
mptf Trisection + False Position ~5.3 3

Installation

pip install hybridroots

For development with testing:

pip install hybridroots[test]

🔧 Usage

from hybridroots import mpbf, mpbfms, mptf, mptfms

# Define your function
def f(x):
    return x**3 - x - 2

# Find root in interval [1, 2]
root, info = mpbfms(f, 1, 2)
print(f"Root: {root}")  # Root: 1.5213797068045676
print(f"Iterations: {info['iterations']}")
print(f"Function calls: {info['function_calls']}")

# All algorithms have the same interface
root1, _ = mpbf(f, 1, 2)    # Opt.BF
root2, _ = mpbfms(f, 1, 2)  # Opt.BFMS
root3, _ = mptf(f, 1, 2)    # Opt.TF
root4, _ = mptfms(f, 1, 2)  # Opt.TFMS

Parameters

Parameter Type Default Description
f callable required Function to find root of
a float required Left endpoint of bracket
b float required Right endpoint of bracket
tol float 1e-14 Absolute tolerance
max_iter int 10000 Maximum iterations

Returns

Value Type Description
root float Approximate root
info dict {'iterations', 'function_calls', 'converged'}

📖 Algorithm Overview

Opt.BFMS (mpbfms)

Multi-phase Bisection-False Position-Modified Secant method:

  1. Bisection step to reduce interval
  2. False position step for refinement
  3. Modified secant with adaptive δ

Opt.TFMS (mptfms)

Multi-phase Trisection-False Position-Modified Secant method:

  1. Trisection for interval reduction
  2. False position refinement
  3. Modified secant with adaptive δ

Opt.BF (mpbf)

Multi-phase Bisection-False Position method. Each iteration:

  1. Bisection step to reduce interval
  2. False position step for refinement

Opt.TF (mptf)

Multi-phase Trisection-False Position method:

  1. Trisection (divides interval into thirds)
  2. False position refinement

📚 Citation

If you use this package in your research, please cite:

@article{ellithy2026hybrid,
  title={Four New Multi-Phase Hybrid Bracketing Algorithms for Numerical Root Finding},
  author={Ellithy, Abdelrahman},
  journal={Journal of the Egyptian Mathematical Society},
  volume={34},
  year={2026},
  publisher={National Information and Documentation Centre (NIDOC), Academy of Scientific Research and Technology, ASRT}
}

Running Benchmarks

pip install hybridroots[benchmark]
python -m hybridroots.benchmarks

📄 License

MIT License - see LICENSE for details.

Links

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hybridroots-1.0.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hybridroots-1.0.1-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

Details for the file hybridroots-1.0.1.tar.gz.

File metadata

  • Download URL: hybridroots-1.0.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for hybridroots-1.0.1.tar.gz
Algorithm Hash digest
SHA256 09d5bbba0a8c3b1bc3004e3f4c55db8bf32a52053ecfc41a544ba86425fb9b93
MD5 b0ce182b5983ace913630a8eeb94d734
BLAKE2b-256 eac901b33dbdd45bfa816ce5f60556a81bafd98b2b91424327a1c9169053de48

See more details on using hashes here.

File details

Details for the file hybridroots-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: hybridroots-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for hybridroots-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c47de90605dd1c7adcaa1576e2c64e88044d2fd7cfb15061e25dbbf5b376dcaa
MD5 dec0770612586d0a8a78bcad7308fe6c
BLAKE2b-256 ef87a85c03f58f54c18f676adca392155cf07cf4a2f397a4daff94151807def2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page