Repository navigation
Commit 229c9ab
The integrator's descent is bounded, so a substitution cycle declines instead of killing the process (#1233)
Integrate could recurse without bound. A stack overflow is not an exception a
caller can handle: the process aborts, and everything it had not finished is
lost. Found by work/intbench against Rubi's independent test suites, where the
run died with SIGABRT partway through and the harness refused to publish a
report from it. The trace was thousands of frames alternating
ComputeIndefiniteIntegral with SolveBySubstitution.
It is a regression. The same corpus with the same flags on the same machine:
v2.4.0 ran past the point of failure and on into the next file; the 2.5.0
release commit aborted 130 lines into it.
Why the memo added in #1157 does not already stop this, which is the part worth
writing down. SolveBySubstitution names its new variable with
Variable.CreateUnique, so every level integrates with respect to a *fresh*
variable. The key (expr, x, integrateByParts) therefore differs at every level
even when the level is the same problem renamed, and the cache never sees the
same question twice. A set of already-visited shapes would fail for exactly the
same reason: the shapes are alpha-equivalent rather than equal. A depth bound
does not care what the levels are called, which is why it is the fix.
One detail that is easy to get wrong. A null produced by running out of descent
must not be written into the memo as though it were a fact about the integrand,
because the same key reached from less deep may well be answerable. A non-null
answer is kept whatever happened elsewhere, since an antiderivative that was
found is correct however deep the search that found it went.
Declining is a legitimate answer here and a wrong one is not: an unevaluated
integral(...) says "I could not settle this", which is true, where an aborted
process says nothing at all.
#1232
Claude-Session: https://claude.ai/code/session_012sonx8iAspMiwRwokT1Ura
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent 4e7d0ac commit 229c9ab
1 file changed
Lines changed: 84 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 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 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
169 | 227 | | |
170 | 228 | | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
171 | 249 | | |
172 | 250 | | |
173 | 251 | | |
| |||
195 | 273 | | |
196 | 274 | | |
197 | 275 | | |
198 | | - | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
199 | 282 | | |
200 | 283 | | |
201 | 284 | | |
| |||
0 commit comments