# SplitNewton
[![Downloads](https://pepy.tech/badge/splitnewton)](https://pepy.tech/project/splitnewton)
![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen.svg)
Bounded, SPLIT [Newton](https://en.wikipedia.org/wiki/Newton%27s_method) with [pseudo-transient continuation
](https://ctk.math.ncsu.edu/TALKS/Purdue.pdf) and [backtracking](https://en.wikipedia.org/wiki/Backtracking_line_search)
Good for ill-conditioned problems where there are two different sets of systems
Particular applications include
* [Fast-Slow Reaction-Diffusion systems](https://en.wikipedia.org/wiki/Reaction%E2%80%93diffusion_system)
* [CFD](https://en.wikipedia.org/wiki/Computational_fluid_dynamics) - Pressure-Velocity coupling
## What does 'split' mean?
The system is divided into two and for ease of communication, let's refer to first set of variables as "outer" and the second as "inner".
* Holding the outer variables fixed, Newton iteration is performed till convergence using the sub-Jacobian
* One Newton step is performed for the outer variables with inner held fixed (using its sub-Jacobian)
* This process is repeated till convergence criterion is met for the full system (same as in Newton)
## How to install and execute?
Just run
```
pip install splitnewton
```
There is an [examples](https://github.com/gpavanb1/SplitNewton/examples) folder that contains a test function and driver program
## How good is this?
Consider the test problem
$\lambda_{a} = 10^{6}$,
$\lambda_{b} = 10^{2}$
and the second system
$\lambda_{c} = 10^{-1}$
$\lambda_{d} = 10^{-4}$
and using `logspace` for variation in $\lambda_{i}$
$$ F(u) = \lambda_{a} u^{4}_{1} + ... + \lambda_{b} u^{4}_{\lfloor N/2 \rfloor} + \lambda_{c} u^{4}_{\lceil N/2 \rceil} + ... + \lambda_{d} u^{4}_{N}$$
$$
J(u) = 3 * \begin{bmatrix}
\lambda_a & \dots & 0 & 0 & \dots & 0 \newline
\vdots & \ddots & \vdots & \vdots & \ddots & \vdots \newline
0 & \dots & \lambda_b & 0 & \dots & 0 \newline
0 & \dots & 0 & \lambda_c & \dots & 0 \newline
\vdots & \ddots & \vdots & \vdots & \ddots & \vdots \newline
0 & \dots & 0 & 0 & \dots & \lambda_d
\end{bmatrix} u^{2}
$$
For N=5000 (with no backtracking and pseudo-transient continuation),
| Method | Time | Iterations |
|-----------|------------|---------------|
| Split Newton | 20 seconds | 45 |
| Newton | not converged > 1 min | NA |
## How to test?
You can run tests with the `pytest` framework
The coverage reports can be generated with `pytest-cov` using `pytest --cov=splitnewton`
## Whom to contact?
Please direct your queries to [gpavanb1](http://github.com/gpavanb1)
for any questions.
Raw data
{
"_id": null,
"home_page": "https://github.com/gpavanb1/SplitNewton",
"name": "SplitNewton",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "newton python continuation armijo optimization pseudotransient splitting",
"author": "gpavanb1",
"author_email": "gpavanb@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6c/dd/8e1caf48aa9ade0437eda0b7e53351b78b5d49e556f6c76b350c03f30d18/SplitNewton-0.2.1.tar.gz",
"platform": null,
"description": "# 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\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 two and for ease of communication, let's refer to first set of variables as \"outer\" and the second as \"inner\".\n\n* Holding the outer variables fixed, Newton iteration is performed till convergence using the sub-Jacobian\n\n* One Newton step is performed for the outer variables with inner held fixed (using its sub-Jacobian)\n\n* This process is repeated till convergence criterion is met for the full system (same as in Newton)\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}$\n\nand the second system\n$\\lambda_{c} = 10^{-1}$\n$\\lambda_{d} = 10^{-4}$\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/2 \\rfloor} + \\lambda_{c} u^{4}_{\\lceil N/2 \\rceil} + ... + \\lambda_{d} u^{4}_{N}$$\n\n$$\nJ(u) = 3 * \\begin{bmatrix}\n\\lambda_a & \\dots & 0 & 0 & \\dots & 0 \\newline\n\\vdots & \\ddots & \\vdots & \\vdots & \\ddots & \\vdots \\newline\n0 & \\dots & \\lambda_b & 0 & \\dots & 0 \\newline\n0 & \\dots & 0 & \\lambda_c & \\dots & 0 \\newline\n\\vdots & \\ddots & \\vdots & \\vdots & \\ddots & \\vdots \\newline\n0 & \\dots & 0 & 0 & \\dots & \\lambda_d\n\\end{bmatrix} u^{2}\n$$\n\nFor N=5000 (with no backtracking and pseudo-transient continuation), \n\n| Method | Time | Iterations |\n|-----------|------------|---------------|\n| Split Newton | 20 seconds | 45 |\n| Newton | not converged > 1 min | NA |\n\n## How to test?\nYou can run tests with the `pytest` framework\n\nThe coverage reports can be generated with `pytest-cov` using `pytest --cov=splitnewton`\n\n## Whom to contact?\n\nPlease direct your queries to [gpavanb1](http://github.com/gpavanb1)\nfor any questions.",
"bugtrack_url": null,
"license": "MIT",
"summary": "Split Newton Solver",
"version": "0.2.1",
"project_urls": {
"Bug Reports": "https://github.com/gpavanb1/SplitNewton/issues",
"Homepage": "https://github.com/gpavanb1/SplitNewton",
"Source": "https://github.com/gpavanb1/SplitNewton/"
},
"split_keywords": [
"newton",
"python",
"continuation",
"armijo",
"optimization",
"pseudotransient",
"splitting"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6cdd8e1caf48aa9ade0437eda0b7e53351b78b5d49e556f6c76b350c03f30d18",
"md5": "dbd1352d70feb345471da9381fc29d8d",
"sha256": "6ebb83fa1d3f5cf4f5084bf32d322d7774f46ed029e19fb1d0e32232aa4235a8"
},
"downloads": -1,
"filename": "SplitNewton-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "dbd1352d70feb345471da9381fc29d8d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 7505,
"upload_time": "2024-08-11T14:41:44",
"upload_time_iso_8601": "2024-08-11T14:41:44.422014Z",
"url": "https://files.pythonhosted.org/packages/6c/dd/8e1caf48aa9ade0437eda0b7e53351b78b5d49e556f6c76b350c03f30d18/SplitNewton-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-11 14:41:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gpavanb1",
"github_project": "SplitNewton",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "splitnewton"
}