polykin.math.fixpoint¤
fixpoint_damped ¤
fixpoint_damped(
g: Callable[[FloatVector], FloatVector],
x0: FloatVector,
*,
q: float = 0.2,
tolx: float = 1e-06,
sclx: FloatVector | None = None,
maxiter: int = 50,
callback: (
Callable[
[int, FloatVector, FloatVector],
tuple[bool, bool],
]
| None
) = None
) -> VectorRootResult
Find the solution of a N-dimensional fixed-point problem using direct substitution with damping.
Direct substitution with damping is a fixed-point iteration where the next iterate is obtained from a convex combination of the current iterate and its direct substitution update. For N-dimensional problems, each component of the fixed-point vector is treated separately according to:
where \(0 \leq q < 1\) is the damping parameter. When \(q=0\), the method is equivalent to standard direct substitution. For \(q>0\), the update is damped, which can improve robustness for mildly unstable problems.
| PARAMETER | DESCRIPTION |
|---|---|
g
|
Fixed-point mapping defining the problem
TYPE:
|
x0
|
Initial guess.
TYPE:
|
q
|
Damping parameter in [0, 1). Typically 0.0–0.5; higher values improve stability.
TYPE:
|
tolx
|
Absolute tolerance for
TYPE:
|
sclx
|
Positive scaling factors for the components of
TYPE:
|
maxiter
|
Maximum number of iterations.
TYPE:
|
callback
|
Optional callback with signature
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
VectorRootResult
|
Dataclass with root solution results. |
See Also
fixpoint_anderson: Acceleration method suited for problems with coupling between components.fixpoint_dem: Alternative method for problems with weak coupling between components.fixpoint_wegstein: Alternative method for problems with weak coupling between components.
Examples:
Find the solution of a 2D fixed-point function.
>>> from polykin.math import fixpoint_damped
>>> import numpy as np
>>> def g(x):
... x1, x2 = x
... g1 = 0.5*np.cos(x1) + 0.1*x2 + 0.5
... g2 = np.sin(x2) - 0.2*x1 + 1.2
... return np.array([g1, g2])
>>> sol = fixpoint_damped(g, x0=np.array([0.0, 0.0]), q=0.2)
>>> print(f"x = {sol.x}")
x = [0.97458614 1.93830761]
>>> print(f"g(x) = {g(sol.x)}")
g(x) = [0.97458604 1.93830719]
Source code in src/polykin/math/fixpoint/damped.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |