{"id":18847802,"url":"https://github.com/jacobwilliams/roots-fortran","last_synced_at":"2026-01-25T11:32:55.137Z","repository":{"id":43540503,"uuid":"233286418","full_name":"jacobwilliams/roots-fortran","owner":"jacobwilliams","description":"A modern Fortran library for finding the roots of continuous scalar functions of a single real variable, using derivative-free methods.","archived":false,"fork":false,"pushed_at":"2025-01-26T16:17:06.000Z","size":2581,"stargazers_count":45,"open_issues_count":8,"forks_count":6,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-23T00:33:58.001Z","etag":null,"topics":["bisection","brent-dekker","fortran","fortran-package-manager","muller","muller-s-method","regula-falsi","root-finding","zeroin"],"latest_commit_sha":null,"homepage":"","language":"Fortran","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jacobwilliams.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-01-11T19:33:52.000Z","updated_at":"2025-05-16T06:36:21.000Z","dependencies_parsed_at":"2024-01-03T06:25:00.475Z","dependency_job_id":"d9acbadd-4bee-4966-aeca-26b75233ab2b","html_url":"https://github.com/jacobwilliams/roots-fortran","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/jacobwilliams/roots-fortran","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Froots-fortran","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Froots-fortran/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Froots-fortran/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Froots-fortran/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jacobwilliams","download_url":"https://codeload.github.com/jacobwilliams/roots-fortran/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jacobwilliams%2Froots-fortran/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28752668,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-25T10:25:12.305Z","status":"ssl_error","status_checked_at":"2026-01-25T10:25:11.933Z","response_time":113,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bisection","brent-dekker","fortran","fortran-package-manager","muller","muller-s-method","regula-falsi","root-finding","zeroin"],"created_at":"2024-11-08T03:09:43.051Z","updated_at":"2026-01-25T11:32:55.111Z","avatar_url":"https://github.com/jacobwilliams.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"![roots-fortran](media/logo.png)\n============\n\n**roots-fortran**: root solvers for modern Fortran\n\n[![Language](https://img.shields.io/badge/-Fortran-734f96?logo=fortran\u0026logoColor=white)](https://github.com/topics/fortran)\n[![GitHub release](https://img.shields.io/github/release/jacobwilliams/roots-fortran.svg)](https://github.com/jacobwilliams/roots-fortran/releases/latest)\n[![CI Status](https://github.com/jacobwilliams/roots-fortran/actions/workflows/CI.yml/badge.svg)](https://github.com/jacobwilliams/roots-fortran/actions)\n[![codecov](https://codecov.io/gh/jacobwilliams/roots-fortran/branch/master/graph/badge.svg)](https://codecov.io/gh/jacobwilliams/roots-fortran)\n[![last-commit](https://img.shields.io/github/last-commit/jacobwilliams/roots-fortran)](https://github.com/jacobwilliams/roots-fortran/commits/master)\n\n## Description\n\nA modern Fortran library for finding the roots of continuous scalar functions of a single real variable.\n\n## Compiling\n\nA `fpm.toml` file is provided for compiling roots-fortran with the [Fortran Package Manager](https://github.com/fortran-lang/fpm). For example, to build:\n\n```\nfpm build --profile release\n```\n\nBy default, the library is built with double precision (`real64`) real values. Explicitly specifying the real kind can be done using the following processor flags:\n\nPreprocessor flag | Kind  | Number of bytes\n----------------- | ----- | ---------------\n`REAL32`  | `real(kind=real32)`  | 4\n`REAL64`  | `real(kind=real64)`  | 8\n`REAL128` | `real(kind=real128)` | 16\n\nFor example, to build a single precision version of the library, use:\n\n```\nfpm build --profile release --flag \"-DREAL32\"\n```\n\nTo run the unit tests:\n\n```\nfpm test\n```\n\nTo use `roots-fortran` within your fpm project, add the following to your `fpm.toml` file:\n```toml\n[dependencies]\nroots-fortran = { git=\"https://github.com/jacobwilliams/roots-fortran.git\" }\n```\n\nor, to use a specific version:\n```toml\n[dependencies]\nroots-fortran = { git=\"https://github.com/jacobwilliams/roots-fortran.git\", tag = \"1.0.0\"  }\n```\n\nTo generate the documentation using [ford](https://github.com/Fortran-FOSS-Programmers/ford), run: ```ford roots-fortran.md```\n\n## Usage\n\n### Methods\n\nThe module contains the following methods:\n\nProcedure | Description | Reference\n--- | --- | ---\n[`bisection`](https://jacobwilliams.github.io/roots-fortran/proc/bisection.html)                       | Classic bisection method | Bolzano (1817)\n[`regula_falsi`](https://jacobwilliams.github.io/roots-fortran/proc/regula_falsi.html)                 | Classic regula falsi method | ?\n[`muller`](https://jacobwilliams.github.io/roots-fortran/proc/muller.html)                             | Improved Muller method (for real roots only) | [Muller (1956)](https://www.ams.org/journals/mcom/1956-10-056/S0025-5718-1956-0083822-0/S0025-5718-1956-0083822-0.pdf)\n[`brent`](https://jacobwilliams.github.io/roots-fortran/proc/brent.html)                               | Classic Brent's method (a.k.a. Zeroin) | [Brent (1971)](https://maths-people.anu.edu.au/~brent/pd/rpb005.pdf)\n[`brenth`](https://jacobwilliams.github.io/roots-fortran/proc/brenth.html)                             | [SciPy](https://github.com/scipy/scipy/) variant of `brent` | [Brent (1971)](https://maths-people.anu.edu.au/~brent/pd/rpb005.pdf)\n[`brentq`](https://jacobwilliams.github.io/roots-fortran/proc/brentq.html)                             | [SciPy](https://github.com/scipy/scipy/) variant of `brent` | [Brent (1971)](https://maths-people.anu.edu.au/~brent/pd/rpb005.pdf)\n[`illinois`](https://jacobwilliams.github.io/roots-fortran/proc/illinois.html)                         | Illinois method | [Dowell \u0026 Jarratt (1971)](https://personal.math.ubc.ca/~loew/mech2/Dowell+Jarratt.pdf)\n[`pegasus`](https://jacobwilliams.github.io/roots-fortran/proc/pegasus.html)                           | Pegasus method | [Dowell \u0026 Jarratt (1972)](https://link.springer.com/article/10.1007/BF01932959)\n[`anderson_bjorck`](https://jacobwilliams.github.io/roots-fortran/proc/anderson_bjorck.html)           | Anderson-Bjorck method | [King (1973)](https://link.springer.com/article/10.1007/BF01933405)\n[`abkk`](https://jacobwilliams.github.io/roots-fortran/proc/abkk.html) | A [variant](https://link.springer.com/content/pdf/bbm%3A978-3-642-05175-3%2F1.pdf) of `anderson_bjorck` | [King (1973)](https://link.springer.com/article/10.1007/BF01933405)\n[`ridders`](https://jacobwilliams.github.io/roots-fortran/proc/ridders.html)                           | Classic Ridders method | [Ridders (1979)](https://cs.fit.edu/~dmitra/SciComp/Resources/RidderMethod.pdf)\n[`toms748`](https://jacobwilliams.github.io/roots-fortran/proc/toms748.html)                           | Algorithm 748 |  [Alefeld, Potra, Shi (1995)](https://dl.acm.org/doi/abs/10.1145/210089.210111)\n[`chandrupatla`](https://jacobwilliams.github.io/roots-fortran/proc/chandrupatla.html)                 | Hybrid quadratic/bisection algorithm | [Chandrupatla (1997)](https://dl.acm.org/doi/10.1016/S0965-9978%2896%2900051-8)\n[`bdqrf`](https://jacobwilliams.github.io/roots-fortran/proc/bdqrf.html)                               | Bisected Direct Quadratic Regula Falsi | [Gottlieb \u0026 Thompson (2010)](http://www.m-hikari.com/ams/ams-2010/ams-13-16-2010/gottliebAMS13-16-2010.pdf)\n[`zhang`](https://jacobwilliams.github.io/roots-fortran/proc/zhang.html)                               | Zhang's method (with corrections from Stage) | [Zhang (2011)](https://www.cscjournals.org/download/issuearchive/IJEA/Volume2/IJEA_V2_I1.pdf)\n[`rbp`](https://jacobwilliams.github.io/roots-fortran/proc/rbp.html) |Regula Falsi-Bisection-Parabolic method | [Suhadolnik (2012)](https://www.sciencedirect.com/science/article/pii/S0893965912000778)\n[`itp`](https://jacobwilliams.github.io/roots-fortran/proc/itp.html)                                   | Interpolate Truncate and Project method | [Oliveira \u0026 Takahashi (2020)](https://dl.acm.org/doi/abs/10.1145/3423597)\n[`barycentric`](https://jacobwilliams.github.io/roots-fortran/proc/barycentric.html)                   | Barycentric interpolation method | [Mendez \u0026 Castillo (2021)](https://www.researchgate.net/publication/352162661_A_highly_efficient_numerical_method_to_solve_non-linear_functions_using_barycentric_interpolation)\n[`blendtf`](https://jacobwilliams.github.io/roots-fortran/proc/blendtf.html)                           | Blended method of trisection and false position | [Badr, Almotairi, Ghamry (2021)](https://www.mdpi.com/2227-7390/9/11/1306/htm)\n[`modab`](https://jacobwilliams.github.io/roots-fortran/proc/modab.html)                               | Modified Anderson-Bjork | [Ganchovski \u0026 Traykov (2023)](https://iopscience.iop.org/article/10.1088/1757-899X/1276/1/012010)\n\nIn general, all the methods are guaranteed to converge. Some will be more efficient (in terms of number of function evaluations) than others for various problems. The methods can be broadly classified into three groups:\n\n * Simple classical methods (`bisection`, `regula_falsi`, `illinois`, `ridders`).\n * Newfangled methods (`zhang`, `barycentric`, `blendtf`, `bdqrf`, `abkk`, `rbp`). These rarely or ever seem to be better than the best methods.\n * Best methods (`anderson_bjorck`, `muller`, `pegasus`, `toms748`, `brent`, `brentq`, `brenth`, `chandrupatla`, `itp`). Generally, one of these will be the most efficient method.\n\nNote that some of the implementations in this library contain additional checks for robustness, and so may behave better than naive implementations of the same algorithms. In addition, all methods have an option to fall back to bisection if the method fails to converge.\n\n### Functional Interface Example\n\n```fortran\nprogram main\n\n  use root_module, wp =\u003e root_module_rk\n\n  implicit none\n\n  real(wp) :: x, f\n  integer :: iflag\n\n  call root_scalar('bisection',func,-9.0_wp,31.0_wp,x,f,iflag)\n\n  write(*,*) 'f(',x,') = ', f\n  write(*,*) 'iflag    = ', iflag\n\ncontains\n\n  function func(x) result(f)\n\n  implicit none\n\n  real(wp),intent(in) :: x\n  real(wp) :: f\n\n  f = -200.0_wp * x * exp(-3.0_wp*x)\n\n  end function func\n\nend program main\n```\n\n### Object Oriented Interface Example\n\n```fortran\nprogram main\n\n  use root_module, wp =\u003e root_module_rk\n\n  implicit none\n\n  type,extends(bisection_solver) :: my_solver\n  end type my_solver\n\n  real(wp) :: x, f\n  integer :: iflag\n  type(my_solver) :: solver\n\n  call solver%initialize(func)\n  call solver%solve(-9.0_wp,31.0_wp,x,f,iflag)\n\n  write(*,*) 'f(',x,') = ', f\n  write(*,*) 'iflag    = ', iflag\n\ncontains\n\n  function func(me,x)\n\n    class(root_solver),intent(inout) :: me\n    real(wp),intent(in) :: x\n    real(wp) :: f\n\n    f = -200.0_wp * x * exp(-3.0_wp*x)\n\n  end function func\n\nend program main\n```\n\n### Result\n\n```\n f( -2.273736754432321E-013 ) =   4.547473508867743E-011\n iflag    =            0\n```\n\n## Notes\n\n* Originally this was an idea for the Fortran [stdlib](https://github.com/fortran-lang/stdlib). See: [#87: Optimization, Root finding, and Equation Solvers](https://github.com/fortran-lang/stdlib/issues/87). Eventually, it may be merged into the other one in one form or another.\n\n## Documentation\n\nThe latest API documentation for the `master` branch can be found [here](https://jacobwilliams.github.io/roots-fortran/). This was generated from the source code using [FORD](https://github.com/Fortran-FOSS-Programmers/ford).\n\n## License\n\nThe roots-fortran source code and related files and documentation are distributed under a permissive free software [license](https://github.com/jacobwilliams/roots-fortran/blob/master/LICENSE.md) (BSD-style).\n\n\n## Related Fortran libraries\n\n* [polyroots-fortran](https://github.com/jacobwilliams/polyroots-fortran) -- For finding all the roots of polynomials with real or complex coefficients.\n\n## Similar libraries in other programming languages\n\nLanguage | Library\n--- | ---\nC        | [GSL](https://www.gnu.org/software/gsl/doc/html/roots.html)\nC++      | [Boost Math Toolkit](https://www.boost.org/doc/libs/1_80_0/libs/math/doc/html/root_finding.html)\nJulia    | [Roots.jl](https://github.com/JuliaMath/Roots.jl)\nR        | [uniroot](https://stat.ethz.ch/R-manual/R-devel/library/stats/html/uniroot.html)\nRust     | [roots](https://docs.rs/roots/latest/roots/)\nMATLAB   | [fzero](https://www.mathworks.com/help/matlab/ref/fzero.html)\nPython   | [scipy.optimize.root_scalar](https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.root_scalar.html)\n\n## References\n  * D. E. Muller, \"[A Method for Solving Algebraic Equations Using an Automatic Computer](https://www.ams.org/journals/mcom/1956-10-056/S0025-5718-1956-0083822-0/S0025-5718-1956-0083822-0.pdf)\", Mathematical Tables and Other Aids to Computation, 10 (1956), 208-215.\n  * M. Dowell, P. Jarratt, \"[A modified regula falsi method for computing the root of an equation](https://personal.math.ubc.ca/~loew/mech2/Dowell+Jarratt.pdf)\", BIT 11 (1971), 168-174.\n  * R. P. Brent, \"[An algorithm with guaranteed convergence for finding a zero of a function](http://maths-people.anu.edu.au/~brent/pd/rpb005.pdf)\", The Computer Journal, Vol 14, No. 4., 1971.\n  * R. P. Brent, \"[Algorithms for minimization without derivatives](http://maths-people.anu.edu.au/~brent/pub/pub011.html)\", Prentice-Hall, Inc., 1973.\n  * Ridders, C., \"[A new algorithm for computing a single root of a real continuous function](https://cs.fit.edu/~dmitra/SciComp/Resources/RidderMethod.pdf)\", IEEE Trans. on Circuits and Systems, Vol 26, Issue 11, Nov 1979.\n  * G. E. Alefeld, F. A. Potra and Yixun Shi, \"[Algorithm 748: Enclosing Zeros of Continuous Functions](https://dl.acm.org/doi/abs/10.1145/210089.210111)\", ACM Transactions on Mathematical Software, Vol. 21. No. 3. September 1995. Pages 327-344.\n  * G.E. Mullges \u0026 F. Uhlig, \"Numerical Algorithms with Fortran\", Springer, 1996. Section 2.8.1, p 32-34.\n  * T.R. Chandrupatla, \"[A new hybrid quadratic/bisection algorithm for finding the zero of a nonlinear function without derivatives](https://dl.acm.org/doi/10.1016/S0965-9978%2896%2900051-8)\", Advances in Engineering Software, Vol 28, 1997, pp. 145-149.\n  * R. G. Gottlieb, B. F. Thompson, \"[Bisected Direct Quadratic Regula Falsi](https://www.researchgate.net/publication/228712261_Bisected_Direct_Quadratic_Regula_Falsi)\", Applied Mathematical Sciences, Vol. 4, 2010, no. 15, 709-718.\n  * A. Zhang, \"[An Improvement to the Brent's Method](https://www.cscjournals.org/download/issuearchive/IJEA/Volume2/IJEA_V2_I1.pdf)\", International Journal of Experimental Algorithms (IJEA), Volume (2) : Issue (1) : 2011.\n  * E Badr, S Almotairi, A El Ghamry, \"[A Comparative Study among New Hybrid Root Finding Algorithms and Traditional Methods](https://www.mdpi.com/2227-7390/9/11/1306)\", Mathematics 2021, 9, 1306.\n\n## See also\n\n * [Code coverage statistics](https://app.codecov.io/gh/jacobwilliams/roots-fortran) [codecov.io]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Froots-fortran","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobwilliams%2Froots-fortran","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobwilliams%2Froots-fortran/lists"}