{"id":25531896,"url":"https://github.com/robert-van-engelen/tanh-sinh","last_synced_at":"2025-04-11T11:34:58.938Z","repository":{"id":118111287,"uuid":"487084375","full_name":"Robert-van-Engelen/Tanh-Sinh","owner":"Robert-van-Engelen","description":"Optimized Tanh-Sinh, Sinh-Sinh and Exp-Sinh quadratures with documented improvements","archived":false,"fork":false,"pushed_at":"2024-03-24T14:55:20.000Z","size":16,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-25T07:51:16.718Z","etag":null,"topics":["numerical-integration","quadrature","tanh-sinh"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Robert-van-Engelen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-04-29T19:12:09.000Z","updated_at":"2025-02-12T13:34:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"0dc593d4-0bed-459e-b82d-d25342003e2b","html_url":"https://github.com/Robert-van-Engelen/Tanh-Sinh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert-van-Engelen%2FTanh-Sinh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert-van-Engelen%2FTanh-Sinh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert-van-Engelen%2FTanh-Sinh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Robert-van-Engelen%2FTanh-Sinh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Robert-van-Engelen","download_url":"https://codeload.github.com/Robert-van-Engelen/Tanh-Sinh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248384517,"owners_count":21094731,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["numerical-integration","quadrature","tanh-sinh"],"created_at":"2025-02-20T01:42:10.826Z","updated_at":"2025-04-11T11:34:58.903Z","avatar_url":"https://github.com/Robert-van-Engelen.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Fast double exponential quadrature Tanh-Sinh, Sinh-Sinh and Exp-Sinh formulas\n\nThis work significantly improves the *Tanh-Sinh*, *Sinh-Sinh* and *Exp-Sinh* quadrature speed and accuracy.  Included is the source code in C and BASIC (e.g. for calculators) to demonstrate wider applicability.\n\nThe two implementations `qthsh` *\"cutiesh\"* (Tanh-Sinh) and `quad` (Tanh-Sinh, Sinh-Sinh, Exp-Sinh) were extensively tested with 1084 integrals.\n\n*Tanh-Sinh quadrature* is a method for numerical integration introduced by Hidetoshi Takahashi and Masatake Mori.  The method uses the tanh and sinh hyperbolic functions in a change of variable to transform the (−1,+1) open interval of the integral to an open interval on the entire real line (−∞,+∞).  Singularities at one or both endpoints of the (−1,+1) interval are mapped to the (−∞,+∞) endpoints of the transformed interval, forcing the endpoint singularities to vanish.  This makes the method quite insensitive to endpoint behavior, resulting in a significant enhancement of the accuracy of the numerical integration procedure compared to quadrature formulas that are based on the *trapezoidal* or *midpoint* rules with equidistant grids.  In most cases, the transformed integrand displays a rapid roll-off (decay) at a *double exponential* rate, enabling the numerical integrator to quickly achieve convergence.  This method is therefore also known as the *Double Exponential* (DE) formula.  A modification of the *Tanh-Sinh* formula was introduced by Krzysztof Michalski and Juan Mosig.  This modification simplifies the formulas for the abscissas and weights.  This modification requires fewer arithmetic operations to speed up numerical integration.\n\nFor more details on these methods and the optimizations applied, please see my [article](https://www.genivia.com/files/qthsh.pdf) *\"Improving the Double Exponential Quadrature Tanh-Sinh, Sinh-Sinh and Exp-Sinh Formulas\"*.\n\n## Examples\n\nLevel max `n=6` is recommended for IEEE 754 double floating point precision and a relative error tolerance `eps=1e-9` for maximum precision of the result with 9 digits or more:\n\n    double f(double x) { return acos(x); }\n    printf(\"%.15g\\n\", quad(f, 0, 1, 6, 1e-9, NULL));\n\nDisplays `1`, the exact integral with 15 digits precise.\n\n    double f(double x) { return exp(-x/5); }\n    printf(\"%.15g\\n\", quad(f, 0, INFINITY, 6, 1e-9, NULL));\n\nDisplays `5`, the exact integral with 15 digits precise.\n\n    double f(double x) { return pow(cosh(x),-2); }\n    printf(\"%.15g\\n\", quad(f, -INFINITY, INFINITY, 6, 1e-9, NULL));\n\nDisplays `2`, the exact integral with 15 digits precise.\n\n## License\n\n[BSD-3 license](LICENSE.txt).\n\nThe Tanh-Sinh C and BASIC source code included in this repository may also be used and distributed under the MIT license as stated in my [article](https://www.genivia.com/files/qthsh.pdf) *\"Improving the Double Exponential Quadrature Tanh-Sinh, Sinh-Sinh and Exp-Sinh Formulas\"*.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-van-engelen%2Ftanh-sinh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobert-van-engelen%2Ftanh-sinh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-van-engelen%2Ftanh-sinh/lists"}