Posts

Minimize (or Maximize) a Function of One Variable

Image
Maximize Volume of a Box ¶ For someone new to optimization, finding the minima or maxima of a simple function is probably one of the first challenges you will face. Sometimes you can solve them with a bit of calculus. When that isn't feasible, you can use numerical methods to find a solution. In this notebook I will investigate the problem of minimizing (or maximizing) a function of one variable (a scalar function). The problem I will use to illustrate this optimization task is maximizing the volume of an open top box cut from a fixed size rectangle. The Problem ¶ Given a sheet of paper that is 8.5 inches by 11 inches, a box will be formed by cutting squares from each corner as shown below. The box if formed by folding up the resulting four tabs at the dashed fold lines. We want to find the dimension x that will give us the maximum volume for the open top box. The formula for the box volume is straightforward: $$Vol = x(8.5 - 2x)(11 - 2x)$$ We can expand this into a ...