Optimization
Open Intervals and Domain
Separate an attained extreme from a supremum or infimum, including corners, poles, and the whole real line.
optimize(x^2,x,0,1,open) has no attained maximum or minimum: the infimum is 0 and the supremum is 1. On the open interval (-1, 1), x^2 does attain the minimum 0 at x=0, while 1 remains an unattained supremum. optimize(abs(x),x,-2,2) keeps the corner x=0, where the derivative is undefined, as the absolute minimum.
optimize(1/x,x,-1,1) is undefined at 0 and unbounded in both directions, so there is no absolute maximum or minimum. The endpoint values f(-1)=-1 and f(1)=1 are one-sided local extrema only. On the whole real line, x^2 has minimum 0 at x=0 and supremum infinity. sin(x) on [0, 2*pi] has maximum 1 at pi/2 and minimum -1 at 3*pi/2.
Equation
optimize(x^2,x,0,1,open)
Critical points, endpoints, and attained extrema
A single-variable optimization problem asks for the largest or smallest value of a function on an interval. The solver differentiates with the existing derivative routine, solves f'(x)=0, and also keeps points where the derivative does not exist but the function does, such as the corner of abs(x). Every candidate inside the feasible domain is evaluated together with the included endpoints. On a closed bounded interval where the function is continuous, the extreme-value theorem says the absolute maximum and minimum are among those candidates.
An open end is not automatically a maximum or a minimum. If the function only approaches a finite bound, that bound is a supremum or an infimum and the result says it is not attained. Infinity is never treated as a point that is attained. A constant function is both an absolute maximum and an absolute minimum at every feasible point. The geometric commands rectangle_max_area, rectangle_min_perimeter, open_box_max_volume, and min_surface_area build one objective, a constraint, and a feasible domain, then call the same solver. They do not read an arbitrary word problem.
Reading the input
optimize(x^2,x,0,1,open)— This is a command. The name selects the routine, and the items inside the parentheses are its arguments.
Other versions of this example
These stay on this page so each version keeps the same explanation. Choose Try example to run a version in its Studio workflow, or copy it into the editable field below.
Open unit interval
On (0, 1), x^2 has infimum 0 and supremum 1, and neither is attained.
optimize(x^2,x,0,1,open)
Corner minimum
abs(x) is minimized at the nondifferentiable point x=0.
optimize(abs(x),x,-2,2)
Pole in the interval
1/x is unbounded above and below on [-1, 1]. The endpoints are not absolute extrema.
optimize(1/x,x,-1,1)
Parabola on the real line
The minimum is 0 at x=0. There is no maximum; the supremum is infinity.
optimize(x^2,x,-oo,oo)
Sine on a period
The maximum is 1 at pi/2 and the minimum is -1 at 3*pi/2.
optimize(sin(x),x,0,2*pi)
Interior minimum
On (-1, 1) the minimum 0 is attained at x=0. The supremum 1 is not attained.
optimize(x^2,x,-1,1,open)
Try a change
- Edit one number in the field, then use Solve Equation. The studio opens on the homepage with the edited text and runs it.
- Use Open in DGS Studio when you want the expression loaded but not run yet.
Solve Equation shows the objective, the first derivative, the critical points, the endpoint values, and whether each extreme is attained. An open bound that is not reached is a supremum or an infimum.