{"id":20196280,"url":"https://github.com/gpavanb1/splitnewton","last_synced_at":"2025-06-30T21:06:22.804Z","repository":{"id":64925759,"uuid":"579596882","full_name":"gpavanb1/SplitNewton","owner":"gpavanb1","description":"Bounded, SPLIT Newton solver with pseudo-transient continuation and backtracking. 8k+ downloads","archived":false,"fork":false,"pushed_at":"2025-01-31T18:15:37.000Z","size":330,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T09:38:23.160Z","etag":null,"topics":["backtracking","continuation","newton","nonlinear","optimization","pseudotransient","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gpavanb1.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}},"created_at":"2022-12-18T08:15:53.000Z","updated_at":"2025-02-05T17:37:49.000Z","dependencies_parsed_at":"2024-11-14T07:15:19.884Z","dependency_job_id":null,"html_url":"https://github.com/gpavanb1/SplitNewton","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitNewton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitNewton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitNewton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gpavanb1%2FSplitNewton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gpavanb1","download_url":"https://codeload.github.com/gpavanb1/SplitNewton/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248199967,"owners_count":21063794,"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":["backtracking","continuation","newton","nonlinear","optimization","pseudotransient","python"],"created_at":"2024-11-14T04:23:02.549Z","updated_at":"2025-04-10T10:42:58.824Z","avatar_url":"https://github.com/gpavanb1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SplitNewton\n\n[![Downloads](https://pepy.tech/badge/splitnewton)](https://pepy.tech/project/splitnewton)\n![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.14782293.svg)](https://doi.org/10.5281/zenodo.14782293)\n\nBounded, SPLIT [Newton](https://en.wikipedia.org/wiki/Newton%27s_method) with [pseudo-transient continuation\n](https://ctk.math.ncsu.edu/TALKS/Purdue.pdf) and [backtracking](https://en.wikipedia.org/wiki/Backtracking_line_search)\n\nGood for ill-conditioned problems where there are two different sets of systems\n\nParticular applications include\n* [Fast-Slow Reaction-Diffusion systems](https://en.wikipedia.org/wiki/Reaction%E2%80%93diffusion_system)\n* [CFD](https://en.wikipedia.org/wiki/Computational_fluid_dynamics) - Pressure-Velocity coupling\n\n## What does 'split' mean?\n\nThe system is divided into multiple segments, and for ease of communication, let’s refer to the first segment of variables as \"outer\" and the remaining as \"inner\".\n\n* Holding the outer variables fixed, Newton iteration is performed recursively for the inner variables, using the sub-Jacobian associated with them, until convergence is reached.\n\n* One Newton step is then performed for the outer variables, while the inner variables are kept fixed, using the sub-Jacobian for the outer subsystem.\n\n* This process is repeated, alternating between solving the inner and outer subsystems, until the convergence criterion for the entire system (similar to standard Newton) is met.\n\n### Example:\n\nConsider a system of 5 variables, with the split locations at indices [1, 4]. This results in the following segments:\n\n  * `a1` (variables from 0 to 1)\n  * `a2 a3 a4` (variables from 1 to 4)\n  * `a5` (variable at index 4)\n\n1. First, the innermost segment `a5` is solved recursively using Newton's method while holding the variables `a1` and `a2 a3 a4`) fixed. This step is repeated until the convergence criterion for `a5` is met.\n\n2. Next, one Newton step is taken for the segment `a2 a3 a4`, with `a5` held fixed. This step is followed by solving `a5` again till convergence.\n\n3. This alternating process repeats: solving for `a5` until convergence, then one step for `a2 a3 a4`, and so on, until all subsystems converge.\n\nFinally, one Newton step is performed for `a1`, with the other segments fixed. This completes one cycle of the split Newton process.\n\n## How to install and execute?\n\nJust run \n```\npip install splitnewton\n```\n\nThere is an [examples](https://github.com/gpavanb1/SplitNewton/examples) folder that contains a test function and driver program\n\n## How good is this?\n\nConsider the test problem\n\n$\\lambda_{a} = 10^{6}$, \n$\\lambda_{b} = 10^{2}$\nwith the second system,\n$\\lambda_{c} = 10^{-1}$\n$\\lambda_{d} = 10^{-4}$\nand third system,\n$\\lambda_{c} = 10^{-6}$\n$\\lambda_{d} = 10^{-8}$\n\nand using `logspace` for variation in $\\lambda_{i}$\n\n\n$$ F(u) = \\lambda_{a} u^{4}_{1} + ... + \\lambda_{b} u^{4}_{\\lfloor N/3 \\rfloor} + \\lambda_{c} u^{4}_{\\lceil N/3 \\rceil} + ... + \\lambda_{d} u^{4}_{\\lfloor 2N/3 \\rfloor} + \\lambda_{e} u^{4}_{\\lceil 2N/3 \\rceil} + ... + \\lambda_{f} u^{4}_{N}$$\n\n$$\nJ(u) = 3 \\times \\begin{bmatrix}\n\\lambda_a \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 0 \\\\\n\\vdots \u0026 \\ddots \u0026 \\vdots \u0026 \\vdots \u0026 \\ddots \u0026 \\vdots \u0026 \\vdots \u0026 \\ddots \u0026 \\vdots \\\\\n0 \u0026 \\dots \u0026 \\lambda_b \u0026 0 \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 0 \\\\\n0 \u0026 \\dots \u0026 0 \u0026 \\lambda_c \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 0 \\\\\n\\vdots \u0026 \\ddots \u0026 \\vdots \u0026 \\vdots \u0026 \\ddots \u0026 \\vdots \u0026 \\vdots \u0026 \\ddots \u0026 \\vdots \\\\\n0 \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 \\lambda_d \u0026 0 \u0026 \\dots \u0026 0 \\\\\n0 \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 0 \u0026 \\lambda_e \u0026 \\dots \u0026 0 \\\\\n\\vdots \u0026 \\ddots \u0026 \\vdots \u0026 \\vdots \u0026 \\ddots \u0026 \\vdots \u0026 \\vdots \u0026 \\ddots \u0026 \\vdots \\\\\n0 \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 0 \u0026 0 \u0026 \\dots \u0026 \\lambda_f\n\\end{bmatrix} \\cdot u^2\n$$\n\nFor N=5000 (with no backtracking and pseudo-transient continuation), \n\n| Method    | Time       | Iterations    |\n|-----------|------------|---------------|\n| Split Newton    |    34 seconds |  33   |\n| Newton |  not converged \u003e 1 min  | NA  |\n\n## How to test?\nYou can run tests with the `pytest` framework using `python -m pytest`\n\nThe coverage reports can be generated with `pytest-cov` plugin using `python -m pytest --cov=splitnewton`\n\n## Whom to contact?\n\nPlease direct your queries to [gpavanb1](http://github.com/gpavanb1)\nfor any questions.\n\n## Citing\n\nIf you are using `SplitNewton` in any scientific work, please make sure to cite as follows\n```\n@software{pavan_b_govindaraju_2025_14782293,\n  author       = {Pavan B Govindaraju},\n  title        = {gpavanb1/SplitNewton: v0.3.1},\n  month        = jan,\n  year         = 2025,\n  publisher    = {Zenodo},\n  version      = {v0.3.1},\n  doi          = {10.5281/zenodo.14782293},\n  url          = {https://doi.org/10.5281/zenodo.14782293},\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpavanb1%2Fsplitnewton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgpavanb1%2Fsplitnewton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgpavanb1%2Fsplitnewton/lists"}