PHPackages                             abdelrhman-ellithy/hybridroots - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. abdelrhman-ellithy/hybridroots

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

abdelrhman-ellithy/hybridroots
==============================

Four novel multi-phase hybrid bracketing algorithms (Opt.BF, Opt.BFMS, Opt.TF, Opt.TFMS) for numerical root finding with superior convergence. Combines bisection/trisection, false position, and modified secant. Reference DOI: 10.21608/joems.2026.440115.1078

00PythonCI passing

Since May 14Pushed 3w ago1 watchersCompare

[ Source](https://github.com/Abdelrhman-Ellithy/hybridroots)[ Packagist](https://packagist.org/packages/abdelrhman-ellithy/hybridroots)[ RSS](/packages/abdelrhman-ellithy-hybridroots/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

   HybridRoots: Multi-Phase Hybrid Bracketing Algorithms
-----------------------------------------------------

[](#hybridroots-multi-phase-hybrid-bracketing-algorithms)

     [ ![Python](https://camo.githubusercontent.com/c04ab12949bc596080e20557bdae95f337ec165f712b5f5da249ab83f5ab7a52/68747470733a2f2f696d672e736869656c64732e696f2f707970692f762f687962726964726f6f74733f7374796c653d666f722d7468652d626164676526636f6c6f723d626c7565266c6162656c3d507974686f6e266c6f676f3d707974686f6e) ](https://pypi.org/project/hybridroots/) [ ![Rust](https://camo.githubusercontent.com/73b14802deb6b57a522f26a5afe74a797ee824c899452f86d15f3fb32a009405/68747470733a2f2f696d672e736869656c64732e696f2f6372617465732f762f687962726964726f6f74733f7374796c653d666f722d7468652d626164676526636f6c6f723d6f72616e6765266c6162656c3d52757374266c6f676f3d72757374) ](https://crates.io/crates/hybridroots) [ ![Java](https://camo.githubusercontent.com/c96f1fa71778b94702b896a5741e3b510e1626d0cf956d8a4ac0cccb4a20a508/68747470733a2f2f696d672e736869656c64732e696f2f6d6176656e2d63656e7472616c2f762f696f2e6769746875622e616264656c72686d616e2d656c6c697468792f687962726964726f6f74733f7374796c653d666f722d7468652d626164676526636f6c6f723d726564266c6162656c3d4a617661266c6f676f3d6a617661) ](https://central.sonatype.com/artifact/io.github.abdelrhman-ellithy/hybridroots) [ ![C#](https://camo.githubusercontent.com/15cb19532f0122540457706f49c5749372bf828063d18ddb45bf202c2f494947/68747470733a2f2f696d672e736869656c64732e696f2f6e756765742f762f487962726964526f6f74733f7374796c653d666f722d7468652d626164676526636f6c6f723d626c756576696f6c6574266c6162656c3d43253233266c6f676f3d646f746e6574) ](https://www.nuget.org/packages/HybridRoots/) [ ![Node](https://camo.githubusercontent.com/ca2e86e52c66a3a3f046d3660f6fdb775df3284604cea3acaf2cefbe57dc4b67/68747470733a2f2f696d672e736869656c64732e696f2f6e706d2f762f687962726964726f6f74733f7374796c653d666f722d7468652d626164676526636f6c6f723d636233383337266c6162656c3d4a532532465453266c6f676f3d6e706d) ](https://www.npmjs.com/package/hybridroots) [ ![PHP](https://camo.githubusercontent.com/74b7af87ac1d5c6a390c2a6c0e8bbd80bdaf2282c3900559aa2ddfe74a932fe0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616264656c72686d616e2d656c6c697468792f687962726964726f6f74733f7374796c653d666f722d7468652d626164676526636f6c6f723d383839324246266c6162656c3d504850266c6f676f3d706870) ](https://packagist.org/packages/abdelrhman-ellithy/hybridroots) [ ![C](https://camo.githubusercontent.com/14225a6db4cf79440b654066ad6305c329f6371d9b7f340bf1e5325ab8981e30/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f432d536f757263652d4138423943433f7374796c653d666f722d7468652d6261646765266c6f676f3d63) ](https://github.com/Abdelrhman-Ellithy/hybridroots/tree/main/hybridroots-c) [ ![C++](https://camo.githubusercontent.com/4ba909f45214bc23b5228bbb152963cdb2a50c63c5d1eb003a993b0669a47988/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f432b2b2d4865616465722532304f6e6c792d3030353939433f7374796c653d666f722d7468652d6261646765266c6f676f3d63253242253242) ](https://github.com/Abdelrhman-Ellithy/hybridroots/tree/main/hybridroots-cpp)

Four New Multi-Phase Hybrid Bracketing Algorithms for Numerical Root Finding
============================================================================

[](#four-new-multi-phase-hybrid-bracketing-algorithms-for-numerical-root-finding)

**Author:** Abdelrahman Ellithy

**Abstract:**This repository contains the official implementation, experiments, and results for the paper "Four New Multi-Phase Hybrid Bracketing Algorithms for Numerical Root Finding", published in the **Journal of the Egyptian Mathematical Society (JOEM)** via **National Information and Documentation Centre (NIDOC), Academy of Scientific Research and Technology, ASRT**.

- **Paper Link:** [https://joems.journals.ekb.eg/article\_498939.html](https://joems.journals.ekb.eg/article_498939.html)
- **DOI:** [10.21608/joems.2026.440115.1078](https://doi.org/10.21608/joems.2026.440115.1078)

The paper introduces four novel hybrid algorithms that combine classical bracketing methods (Bisection, Trisection, False Position) with accelerated steps (Modified Secant) to achieve superior convergence rates while maintaining guaranteed bracketing.

### Available Packages

[](#available-packages)

These algorithms are fully implemented and published as native packages for 8 languages:

1. **Python** (PyPI): [hybridroots](https://pypi.org/project/hybridroots/)
2. **Rust** (crates.io): [hybridroots](https://crates.io/crates/hybridroots)
3. **Java** (Maven Central): [io.github.abdelrhman-ellithy:hybridroots](https://central.sonatype.com/artifact/io.github.abdelrhman-ellithy/hybridroots)
4. **C# / .NET** (NuGet): [HybridRoots](https://www.nuget.org/packages/HybridRoots/)
5. **JavaScript / TypeScript** (npm): [hybridroots](https://www.npmjs.com/package/hybridroots)
6. **PHP** (Packagist): [abdelrhman-ellithy/hybridroots](https://packagist.org/packages/abdelrhman-ellithy/hybridroots)
7. **C**: [Source files available here](https://github.com/Abdelrhman-Ellithy/hybridroots/tree/main/hybridroots-c)
8. **C++**: [Header-only available here](https://github.com/Abdelrhman-Ellithy/hybridroots/tree/main/hybridroots-cpp)

---

The Algorithms
--------------

[](#the-algorithms)

All algorithms are deterministic and guarantee convergence for continuous functions with a valid bracket `f(a) * f(b) < 0`.

Every algorithm returns a standardized **`HybridRootsResult`** object containing:

FieldDescription`root`Estimated root location`iterations`Number of iterations performed`function_calls`Number of function evaluations`converged`Whether `### 1. Opt.BFMS (`mpbfms`)

[](#1-optbfms-mpbfms)

**Multi-Phase Bisection–False Position–Modified Secant** — Extends Opt.BF with a modified secant acceleration step. (Section 3)

### 2. Opt.TFMS (`mptfms`)

[](#2-opttfms-mptfms)

**Multi-Phase Trisection–False Position–Modified Secant** — Combines trisection, false position, and modified secant for maximum efficiency. The fastest of the four. (Section 5)

### 3. Opt.BF (`mpbf`)

[](#3-optbf-mpbf)

**Multi-Phase Bisection–False Position** — Combines the reliability of bisection with the speed of the false position method. (Section 2)

### 4. Opt.TF (`mptf`)

[](#4-opttf-mptf)

**Multi-Phase Trisection–False Position** — Uses trisection for faster interval reduction, followed by false position refinement. (Section 4)

**Common signature:** `(f, a, b, tol=1e-14, max_iter=10000)` → `HybridRootsResult`

---

Repository Structure
--------------------

[](#repository-structure)

```
├── hybridroots-python/    # Python (pip) – reference implementation
├── hybridroots-c/         # C (CMake)
├── hybridroots-cpp/       # C++ (CMake, header-only)
├── hybridroots-java/      # Java (Maven Central)
├── hybridroots-dotnet/    # C# / .NET (NuGet)
├── hybridroots-rust/      # Rust (crates.io)
├── hybridroots-js/        # JavaScript (npm)
├── hybridroots-php/       # PHP (Packagist / Composer)
└── Paper Experiment and Results/

```

---

Quick Start by Language
-----------------------

[](#quick-start-by-language)

### Python

[](#python)

```
pip install hybridroots
```

```
from hybridroots import mptfms

root, info = mptfms(lambda x: x**3 - x - 2, 1, 2)
print(f"Root: {root:.15f}")
print(f"Iterations: {info['iterations']}, NFE: {info['function_calls']}, Converged: {info['converged']}")
```

### Java

[](#java)

```

    com.hybridroots
    hybridroots
    1.0.0

```

```
import com.hybridroots.HybridRoots;
import com.hybridroots.HybridRootsResult;

HybridRootsResult result = HybridRoots.mptfms(x -> x * x * x - x - 2, 1.0, 2.0);
System.out.println("Root: " + result.root);           // root value
System.out.println("Converged: " + result.converged);  // true
```

### C# (.NET)

[](#c-net)

```

```

```
using HybridRoots;

var result = Core.Mptfms(x => x * x * x - x - 2, 1.0, 2.0);
Console.WriteLine($"Root: {result.Root}, Converged: {result.Converged}");
```

### Rust

[](#rust)

```
# Add to your Cargo.toml
[dependencies]
hybridroots = "1.0.0"
```

```
use hybridroots::mptfms;

let result = mptfms(&|x: f64| x.powi(3) - x - 2.0, 1.0, 2.0, 1e-14, 10000);
println!("Root: {}, Converged: {}", result.root, result.converged);
```

### JavaScript (Node.js)

[](#javascript-nodejs)

```
npm install hybridroots
```

```
import { mptfms } from 'hybridroots';

const result = mptfms(x => x**3 - x - 2, 1, 2);
console.log(`Root: ${result.root}, Converged: ${result.converged}`);
```

### C++

[](#c)

```
#include "hybridroots.hpp"

auto result = hybridroots::mptfms([](double x) { return x*x*x - x - 2; }, 1.0, 2.0);
printf("Root: %.15f, Converged: %d\n", result.root, result.converged);
```

### C

[](#c-1)

```
#include "hybridroots.h"

double f(double x) { return x*x*x - x - 2; }

HybridRootsResult result = mptfms(f, 1.0, 2.0, 1e-14, 10000);
printf("Root: %.15f, Converged: %d\n", result.root, result.converged);
```

### PHP

[](#php)

```
{ "require": { "abdelrhman-ellithy/hybridroots": "^1.0" } }
```

```
use HybridRoots\Core;

$result = Core::mptfms(fn($x) => $x**3 - $x - 2, 1.0, 2.0);
echo "Root: {$result->root}, Converged: " . ($result->converged ? 'true' : 'false');
```

---

Running Benchmarks
------------------

[](#running-benchmarks)

Each port includes a benchmark suite of 48 test functions. Here's how to run them:

### Python

[](#python-1)

```
cd hybridroots-python
pip install -e .
python -m hybridroots.benchmarks
```

### Java

[](#java-1)

```
cd hybridroots-java
mvn clean package -q
mvn exec:java "-Dexec.mainClass=com.hybridroots.Benchmarks"
```

### C# (.NET)

[](#c-net-1)

```
cd hybridroots-dotnet
dotnet run -c Release
```

### Rust

[](#rust-1)

```
cd hybridroots-rust
cargo run --release --bin benchmarks
```

### JavaScript

[](#javascript)

```
cd hybridroots-js
node benchmarks.js
```

### C++

[](#c-2)

```
cd hybridroots-cpp
cmake -B build -S .
cmake --build build --config Release
./build/benchmarks       # Linux/macOS
.\build\benchmarks.exe   # Windows
```

### C

[](#c-3)

```
cd hybridroots-c
cmake -B build -S .
cmake --build build --config Release
./build/benchmarks       # Linux/macOS
.\build\benchmarks.exe   # Windows
```

### PHP

[](#php-1)

```
cd hybridroots-php
php benchmarks.php
```

---

### C / C++

[](#c--c)

C and C++ libraries are typically distributed as source. Users include the header and source files directly, or use CMake's `FetchContent`:

```
# In the user's CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
  hybridroots
  GIT_REPOSITORY https://github.com/Abdelrhman-Ellithy/hybridroots.git
  GIT_TAG        v1.0.0
)
FetchContent_MakeAvailable(hybridroots)
target_link_libraries(myapp PRIVATE hybridroots)
```

For system-wide install:

```
cd hybridroots-c   # or hybridroots-cpp
cmake -B build -S . -DCMAKE_INSTALL_PREFIX=/usr/local
cmake --build build
cmake --install build
```

---

Citation
--------

[](#citation)

If you use this work, 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}
}
```

License
-------

[](#license)

MIT License — See [LICENSE](./LICENSE) for details.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance62

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/43c0bb899d02e52216ad0e297634ce8f0de3bfc8340f9c8af06602926186fdfa?d=identicon)[Abdelrhman-Ellithy](/maintainers/Abdelrhman-Ellithy)

---

Top Contributors

[![Abdelrhman-Ellithy](https://avatars.githubusercontent.com/u/121054294?v=4)](https://github.com/Abdelrhman-Ellithy "Abdelrhman-Ellithy (131 commits)")

---

Tags

ccomputer-graphics-algorithmscppcsharphybrid-algorithmhybrid-algorithmsjavamaven-pomnpm-packagenuget-packagenumerical-analysisnumerical-methodsoptimization-algorithmsoptmizationphysics-enginepypi-packagepythonroot-findingrustrust-library

### Embed Badge

![Health badge](/badges/abdelrhman-ellithy-hybridroots/health.svg)

```
[![Health](https://phpackages.com/badges/abdelrhman-ellithy-hybridroots/health.svg)](https://phpackages.com/packages/abdelrhman-ellithy-hybridroots)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
