Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

SciPy · Function

optimize.minimize_scalar

Find a local minimum of a scalar function of one variable. Select a bracketing-based solver or bounded minimization and receive an OptimizeResult.

Since
0.11.0

How it works

The function evaluates a one-variable scalar objective and selects a local-minimization algorithm. Use Brent or golden when bracketing is appropriate; use bounded when restricting the search to finite bounds, then inspect the returned OptimizeResult.

Syntax

scipy.optimize.minimize_scalar(fun, bracket=None, bounds=None, args=(), method=None, tol=None, options=None)

Parameters

NameTypeDescription
funcallableCallable objective that accepts one scalar and returns a scalar.
bracketsequence, optionalOptional bracket for Brent or golden: either three bracketing points or two starting points for downhill bracketing.
boundssequence, optionalOptional finite two-item interval required by bounded minimization.
argstuple, optionalExtra positional arguments passed to fun.
methodstr or callable, optionalSolver name or callable solver; supported methods include Brent, bounded, and golden.
tolfloat, optionalTermination tolerance.
optionsdict, optionalDictionary of solver-specific options.

Returns

res: OptimizeResult — the optimization result, including the solution and status information such as success and message.

Key points

  • Use it to find a local minimum for an objective with one scalar input.
  • If method is omitted, SciPy selects Brent's algorithm.
  • Brent combines inverse parabolic interpolation with golden-section behavior when appropriate.
  • The golden method is a bracketing-based search using golden-section steps.
  • Choose bounded when the optimization must remain inside a finite interval.
  • The return value is an OptimizeResult rather than only the minimizing coordinate.

Common mistakes

  • The bounded method requires exactly two finite bounds; it cannot be used without them.
  • Brent and golden use bracket rather than bounds, and the supplied bracket must satisfy the method's bracketing requirements.
  • The objective must produce a scalar value for every input.

Example: Bounded scalar minimization

from scipy.optimize import minimize_scalar

result = minimize_scalar(lambda x: (x - 3) ** 2, method="bounded", bounds=(0, 10))
print(result.x, result.fun, result.success)

This finds the minimum of a quadratic within the finite interval from 0 to 10.

When to use it

Local unconstrained search

A smooth one-dimensional objective has a usable bracket but no fixed domain limits.

Finite-interval optimization

The variable must stay between known finite lower and upper limits.

Parameterized objective fitting

The objective requires additional fixed values during evaluation.

Interview questions

QWhat problem does minimize_scalar solve?

It performs local minimization of a scalar function of one variable and returns an OptimizeResult. The default method is Brent when no method is specified.

Follow-up: How would you impose an interval restriction? Use method='bounded' together with two finite bounds.

QHow does bracketing work?

Use bracket with Brent or golden. A three-item bracket must satisfy a < b < c and have the middle point lower than both endpoints; two items start a downhill bracket search.

Follow-up: What is the alternative for a known finite search interval? Use bounded minimization with bounds.

QWhat does the function return and how can it be configured?

The result contains the optimization outcome as an OptimizeResult, including the minimizing value and status information such as success and message. Solver-specific settings can be passed through options.

Follow-up: Where can solver-specific option names be checked? Consult show_options for the selected solver.

  • scipy.optimize.bracket
  • scipy.optimize.show_options
  • scipy.optimize.minimize_scalar(method='brent')
  • scipy.optimize.minimize_scalar(method='bounded')
  • scipy.optimize.minimize_scalar(method='golden')

Source: minimize_scalar. Checked 2026-10-15.