Skip to content

Minimize ​

The global minimum of f over the real line (or a simple interval constraint), as {value, {x -> point}} -- an exact, provably global answer, not a local one.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageMinimize!
Minimize(f, x)the global minimum of f, a real expression in the single variable x, over f's own natural domain.
Minimize(f, {x})same as Minimize(f, x) -- Wolfram accepts the variable either bare or wrapped in a one-element list.
Minimize({f, cons}, x)the global minimum of f restricted to cons, a simple interval constraint (x >= a, a <= x <= b, an And of two one-sided bounds, ...).
Typed signatures
TypePackageApplies
(expression, list<symbol> | symbol) -> expressionanalyticalways

Domain: Calculus

Details
  • An EXACT core, never a numerical search (see NMinimize for that): a polynomial (any degree), a rational function with no real pole splitting its domain in two, Sqrt/Ln of an affine-or-quadratic argument, and Exp of an affine argument, each on the whole real line or a simple interval. Every critical point comes from compute-engine's own D (the derivative) on the ORIGINAL expression, Factored and then solved piece by piece -- a linear or quadratic factor by our own exact formula, anything else via compute-engine's own Solve -- and every boundary/limit behaviour from compute-engine's own Limit. A factor is trusted only when its roots come back exact (no numeric fallback, from either route); one inexact factor declines the whole call rather than risk missing the real global minimum -- an irreducible cubic-or-higher factor Solve itself can't do exactly is the usual reason.
  • Sin/Cos of an affine argument are supported only through MinValue/MaxValue (the exact amplitude, +-1) -- Minimize itself declines them even when a point exists, because Wolfram's own choice of WHICH of the infinitely many minimizers to report (verified against wolframscript) comes from an internal search this package has no way to reproduce or verify, and a wrong "the" point is worse than no point.
  • A rational function's real pole sitting strictly inside the interval being optimized over (given or implied) declines, as does a Sqrt whose domain splits into two disjoint rays under the interval in force -- either would need comparing across more than one connected piece, which this file does not attempt.
  • More than one variable declines outright; multivariate optimization isn't attempted.
  • A constant f declines: every real x is an equally valid minimizer, and Wolfram's own choice of WHICH one to print (verified against wolframscript -- Minimize[5, x] names an arbitrary-looking rational) isn't reproducible or verifiable here.
  • Matches Wolfram's output shape, {value, {x -> point}}, via Rule -- including for an unbounded minimum, {-Infinity, {x -> point}}, where point is whichever end (or domain edge) the limit is taken at.

Examples

Basic #

A quadratic's vertex is its global minimum

live ↗
InMinimize(x2,x)\mathrm{Minimize}(x^2, x)Out[0,[Rule(x,0)]]\bigl\lbrack0, \bigl\lbrack\mathrm{Rule}(x, 0)\bigr\rbrack\bigr\rbrack

An odd-degree polynomial is unbounded below

live ↗
InMinimize(x3,x)\mathrm{Minimize}(x^3, x)Out[−∞,[Rule(x,−∞)]]\bigl\lbrack-∞, \bigl\lbrack\mathrm{Rule}(x, -∞)\bigr\rbrack\bigr\rbrack

With x >= 1, the unconstrained vertex (0) is out of range -- the boundary wins

live ↗
InMinimize([x2,x≥1],x)\mathrm{Minimize}(\bigl\lbrack x^2, x≥1\bigr\rbrack, x)Out[1,[Rule(x,1)]]\bigl\lbrack1, \bigl\lbrack\mathrm{Rule}(x, 1)\bigr\rbrack\bigr\rbrack

The variable spelled as {x} instead of bare x

live ↗
InMinimize(x2,[x])\mathrm{Minimize}(x^2, \bigl\lbrack x\bigr\rbrack)Out[0,[Rule(x,0)]]\bigl\lbrack0, \bigl\lbrack\mathrm{Rule}(x, 0)\bigr\rbrack\bigr\rbrack

Returns the minimum 318\frac{31}{8} and its location x=34x=\frac34

live ↗
InMinimize(2x2−3x+5,x)\mathrm{Minimize}(2x^2-3x+5, x)Out[318,[Rule(x,34)]]\bigl\lbrack\frac{31}{8}, \bigl\lbrack\mathrm{Rule}(x, \frac{3}{4})\bigr\rbrack\bigr\rbrack
Scope #

A rational function whose exact critical point is irrational

live ↗
InMinimize(x−1x2+1,x)\mathrm{Minimize}(\frac{x-1}{x^2+1}, x)Out[−21+(1−21/2)2,[Rule(x,1−21/2)]]\bigl\lbrack-\frac{\sqrt{2}}{1+(1-2^{1/2})^2}, \bigl\lbrack\mathrm{Rule}(x, 1-2^{1/2})\bigr\rbrack\bigr\rbrack

Log is unbounded below, approached at its domain edge (x -> 0), not at x -> -Infinity

live ↗
InMinimize(ln⁡(x),x)\mathrm{Minimize}(\ln(x), x)Out[−∞,[Rule(x,0)]]\bigl\lbrack-∞, \bigl\lbrack\mathrm{Rule}(x, 0)\bigr\rbrack\bigr\rbrack

Exp's infimum (0) is never actually reached

live ↗
InMinimize(ex,x)\mathrm{Minimize}(e^{x}, x)Out[0,[Rule(x,−∞)]]\bigl\lbrack0, \bigl\lbrack\mathrm{Rule}(x, -∞)\bigr\rbrack\bigr\rbrack

The derivative 4x^3-8x factors into 4x(x^2-2): the quadratic piece's roots are exact, even though Solve alone can't produce them for the quartic directly

live ↗
InMinimize(x4−4x2,x)\mathrm{Minimize}(x^4-4x^2, x)Out[−4,[Rule(x,−21/2)]]\bigl\lbrack-4, \bigl\lbrack\mathrm{Rule}(x, -2^{1/2})\bigr\rbrack\bigr\rbrack

Two tied global minimizers (x = -1 and x = 1); the leftmost is reported, matching Wolfram

live ↗
InMinimize(x4−2x2+1,x)\mathrm{Minimize}(x^4-2x^2+1, x)Out[0,[Rule(x,−1)]]\bigl\lbrack0, \bigl\lbrack\mathrm{Rule}(x, -1)\bigr\rbrack\bigr\rbrack

(x^2-3)(x^2-5), factored the same way -- again the leftmost of two tied minimizers

live ↗
InMinimize((x2−3)(x2−5),x)\mathrm{Minimize}((x^2-3)(x^2-5), x)Out[−1,[Rule(x,−2)]]\bigl\lbrack-1, \bigl\lbrack\mathrm{Rule}(x, -2)\bigr\rbrack\bigr\rbrack
Possible issues #

Declines: the derivative x^3-x-1 is an irreducible cubic (Wolfram itself needs an implicit Root object here)

live ↗
InMinimize(x44−x22−x,x)\mathrm{Minimize}(\frac{x^4}{4}-\frac{x^2}{2}-x, x)OutMinimize(x44−x22−x,x)\mathrm{Minimize}(\frac{x^4}{4}-\frac{x^2}{2}-x, x)

Declines -- multivariate optimization is out of scope

live ↗
InMinimize(x2+y2,[x,y])\mathrm{Minimize}(x^2+y^2, \bigl\lbrack x, y\bigr\rbrack)OutMinimize(x2+y2,[x,y])\mathrm{Minimize}(x^2+y^2, \bigl\lbrack x, y\bigr\rbrack)

Declines: infinitely many x minimize Sin(x), and Wolfram's own choice isn't reproducible -- see MinValue

live ↗
InMinimize(sin⁡(x),x)\mathrm{Minimize}(\sin(x), x)OutMinimize(sin⁡(x),x)\mathrm{Minimize}(\sin(x), x)
About
Examples14
Checked againstWolfram Language 11 agree3 differ
CrosswalkWolfram Language

See also: Maximize, MinValue, MaxValue, NMinimize, Solve, Limit