Skip to content

Commit 18862db

Browse files
Filter lb and ub from scipy kwargs in NonlinearSolveSciPy
Filter out :lb and :ub from kwargs passed to scipy since these bounds are extracted directly from the problem using hasproperty and passed to scipy separately via the bounds parameter. This is a minimal, non-invasive fix that only touches NonlinearSolveSciPy. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 780f682 commit 18862db

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/NonlinearSolveSciPy/src/NonlinearSolveSciPy.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ function SciMLBase.__solve(
135135
end
136136

137137
# Filter out Julia-specific kwargs that scipy doesn't understand
138-
scipy_kwargs = Tuple(k => v for (k, v) in pairs(kwargs) if k (:alias, :verbose))
138+
# lb and ub are extracted from prob directly, not passed as kwargs
139+
scipy_kwargs = Tuple(k => v for (k, v) in pairs(kwargs) if k (:alias, :verbose, :lb, :ub))
139140

140141
# Call scipy with conditional bounds argument
141142
if bounds === nothing
@@ -189,7 +190,8 @@ function SciMLBase.__solve(prob::SciMLBase.NonlinearProblem, alg::SciPyRoot;
189190
tol = abstol === nothing ? nothing : abstol
190191

191192
# Filter out Julia-specific kwargs that scipy doesn't understand
192-
scipy_kwargs = Tuple(k => v for (k, v) in pairs(kwargs) if k (:alias, :verbose))
193+
# lb and ub are extracted from prob directly, not passed as kwargs
194+
scipy_kwargs = Tuple(k => v for (k, v) in pairs(kwargs) if k (:alias, :verbose, :lb, :ub))
193195

194196
res = scipy_optimize[].root(py_f, collect(u0);
195197
method = alg.method,
@@ -228,7 +230,8 @@ function CommonSolve.solve(prob::SciMLBase.IntervalNonlinearProblem, alg::SciPyR
228230
a, b = prob.tspan
229231

230232
# Filter out Julia-specific kwargs that scipy doesn't understand
231-
scipy_kwargs = Tuple(k => v for (k, v) in pairs(kwargs) if k (:alias, :verbose))
233+
# lb and ub are extracted from prob directly, not passed as kwargs
234+
scipy_kwargs = Tuple(k => v for (k, v) in pairs(kwargs) if k (:alias, :verbose, :lb, :ub))
232235

233236
res = scipy_optimize[].root_scalar(py_f;
234237
method = alg.method,

0 commit comments

Comments
 (0)