RK Integrator
RK¤
torchfsm.integrator.RKIntegrator
¤
Bases: Enum
Enum class for Runge-Kutta integrators. This class provides a set of predefined Runge-Kutta integrators for solving ordinary differential equations (ODEs). Each integrator is represented as a member of the enum, and can be used to create an instance of the corresponding integrator class. The integrators include: - Euler: First-order Euler method. - Midpoint: Second-order Midpoint method. - Heun12: Second-order Heun method. - Ralston12: Second-order Ralston method. - BogackiShampine23: Third-order - RK4: Fourth-order Runge-Kutta method. - RK4_38Rule: Fourth-order Runge-Kutta method with ⅜ rule. - Dorpi45: Fifth-order Dormand-Prince method. - Fehlberg45: Fifth-order Fehlberg method. - CashKarp45: Fifth-order Cash-Karp method.
Source code in torchfsm/integrator/_rk.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 |
|
torchfsm.integrator._rk._RKBase
¤
Base class for Runge-Kutta integrators. This class implements the Runge-Kutta method for solving ordinary differential equations (ODEs). The Runge-Kutta method is a numerical technique used to solve ODEs by approximating the solution at discrete time steps. The class provides a flexible interface for defining different Runge-Kutta methods by specifying the coefficients and weights. The class also supports adaptive step size control, allowing for dynamic adjustment of the time step based on the estimated error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ca
|
Sequence[float]
|
Coefficients for the Runge-Kutta method. |
required |
b
|
Sequence[float]
|
Weights for the Runge-Kutta method. |
required |
b_star
|
Optional[Sequence]
|
Optional coefficients for error estimation. |
None
|
adaptive
|
bool
|
If True, enables adaptive step size control. |
False
|
atol
|
float
|
Absolute tolerance for adaptive step size control. |
1e-06
|
rtol
|
float
|
Relative tolerance for adaptive step size control. |
1e-05
|
Source code in torchfsm/integrator/_rk.py
7 8 9 10 11 12 13 14 15 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 |
|
__init__
¤
__init__(
ca: Sequence[float],
b: Sequence[float],
b_star: Optional[Sequence] = None,
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
|
torchfsm.integrator._rk.Euler
¤
Bases: _RKBase
First-order Euler method.
Source code in torchfsm/integrator/_rk.py
82 83 84 85 86 87 |
|
__init__
¤
__init__()
Source code in torchfsm/integrator/_rk.py
86 87 |
|
torchfsm.integrator._rk.Midpoint
¤
Bases: _RKBase
Midpoint method.
Source code in torchfsm/integrator/_rk.py
90 91 92 93 94 95 |
|
__init__
¤
__init__()
Source code in torchfsm/integrator/_rk.py
94 95 |
|
torchfsm.integrator._rk.Heun12
¤
Bases: _RKBase
Heun's second-order method.
Source code in torchfsm/integrator/_rk.py
98 99 100 101 102 103 104 105 |
|
__init__
¤
__init__(
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
102 103 104 105 |
|
torchfsm.integrator._rk.Ralston12
¤
Bases: _RKBase
Ralston's second-order method.
Source code in torchfsm/integrator/_rk.py
108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__init__
¤
__init__(
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
112 113 114 115 116 117 118 119 120 |
|
torchfsm.integrator._rk.BogackiShampine23
¤
Bases: _RKBase
Third-order Bogack and Shampine method.
Source code in torchfsm/integrator/_rk.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
__init__
¤
__init__(
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
torchfsm.integrator._rk.RK4
¤
Bases: _RKBase
Fourth-order Runge-Kutta method.
Source code in torchfsm/integrator/_rk.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
__init__
¤
__init__()
Source code in torchfsm/integrator/_rk.py
146 147 148 149 150 151 152 153 154 155 |
|
torchfsm.integrator._rk.RK4_38Rule
¤
Bases: _RKBase
Fourth-order Runge-Kutta method with ⅜ rule.
Source code in torchfsm/integrator/_rk.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
|
__init__
¤
__init__()
Source code in torchfsm/integrator/_rk.py
162 163 164 165 166 167 168 169 170 171 |
|
torchfsm.integrator._rk.Dorpi45
¤
Bases: _RKBase
Fifth-order Dormand-Prince method.
Source code in torchfsm/integrator/_rk.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
__init__
¤
__init__(
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
torchfsm.integrator._rk.Fehlberg45
¤
Bases: _RKBase
Fehlberg 4(5) method for adaptive step size control. This method is a Runge-Kutta method that provides a fourth-order and fifth-order approximation of the solution to an ODE.
Source code in torchfsm/integrator/_rk.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
__init__
¤
__init__(
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 |
|
torchfsm.integrator._rk.CashKarp45
¤
Bases: _RKBase
Cash-Karp 4(5) method for adaptive step size control. This method is a Runge-Kutta method that provides a fourth-order and fifth-order approximation of the solution to an ODE.
Source code in torchfsm/integrator/_rk.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
__init__
¤
__init__(
adaptive: bool = False,
atol: float = 1e-06,
rtol: float = 1e-05,
)
Source code in torchfsm/integrator/_rk.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|