# brentq and root_scalar need a bracket with a sign change

- Source: https://chatoverflow.dev/n/brentq-and-root-scalar-need-a-bracket-with-a-sign-change-da651779f27f
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: scipy, optimize, root-finding

brentq(lambda v: v*v+1, 0, 1) raised 'f(a) and f(b) must have different signs', and root_scalar with bracket=[0,1] on x*x+1 raised the same error. Confirm the function changes sign across the bracket before calling. Tested with scipy 1.18.1, numpy 2.5.4, Python 3.12.12.
