We will discuss: application in optimization problems
Importance of finding maximum and minimum values
Definition: A function f has an absolute maximum at x=c if f(c)≥f(x) for all x in the domain of the function and f has an absolute minimum
if f(c) ≤ f(x) for all x in the domain of the function. As an example, let us consider the following:
We will discuss: application in optimization problems
Importance of finding maximum and minimum values
Definition: A function f has an absolute maximum at x=c if f(c)≥f(x) for all x in the domain of the function and f has an absolute minimum
if f(c) ≤ f(x) for all x in the domain of the function. As an example, let us consider the following:
In the example below, we consider the Gaussian function f(x) = defined on the closed interval [-2,2] and we observed based on its graphthat f has an absolute maximum at x=0 and the maximum value is given by f(0)=1. Because, for any xϵ[-2,2], we observe that f(x)≤f(0)=1
-
2
x
e
In[]:=
f[x_]:=Exp[-x^2]
In[]:=
Plot[f[x],{x,-2,2}]
Out[]=
Next, let g(x)=-f(x). Then, it is not difficult to verify that on the domain [-2,2], f has an absolute minimum and this minimum is reached at x=0 and is equal to -1
In[]:=
Plot[-f[x],{x,-2,2}]
Out[]=
Example: What are the dimensions of a rectangular box of greatest volume that can be constructed from 400 square inches of cardboard if the base is a square.
Assume additionally that the box has no top.
Letting l,w and h be the dimensions of the rectangular box, we infer from the assumption that the box is constructed from 400 square inches of cardboard and has no
top that 2lh+2wh+lw=400. We aim to maximize the volume of the box which is the product of their dimensions V=lwh
Assume additionally that the box has no top.
Letting l,w and h be the dimensions of the rectangular box, we infer from the assumption that the box is constructed from 400 square inches of cardboard and has no
top that 2lh+2wh+lw=400. We aim to maximize the volume of the box which is the product of their dimensions V=lwh
In[]:=
V[l_,w_,h_]:=l*w*h
The equation 2 l h + 2 w h + l w = 400 means that the 3 variables l, w, h are not free variables and we can then write one variable in terms of the other two..
Additionally, taking into consideration the fact that the base is a square, we must then set l to be equal to w. This gives us a set of two equations and 3 variables.
Additionally, taking into consideration the fact that the base is a square, we must then set l to be equal to w. This gives us a set of two equations and 3 variables.
In[]:=
Solve[{2lh+2wh+lw==400,l==w},{l,w,h}]
Out[]=
h
400-
2
w
4w
In[]:=
Vw,w,
400-
2
w
4w
Out[]=
1
4
2
w
Solving the system of equations 2 l h + 2 w h + l w == 400, l == w for the variables l,w and h, allows us to write the volume of the box as a function of a single
variable and we can then use optimization techniques to solve this problem.
variable and we can then use optimization techniques to solve this problem.
Let f be a function we say that x=c is a critical point for the function f if f(c) exists and if either one of the following holds true: f’(c)=0 or f’(c) does not exist.
In[]:=
f[w_]:=w(400-)
1
4
2
w
What are the critical points of f?
In[]:=
D[f[w],w]
Out[]=
-+(400-)
2
w
2
1
4
2
w
In[]:=
Solve[f'[w]==0,w]
Out[]=
w-,w
20
3
20
3
Based on our definition, the volume of this rectangular box has one critical point given by
20
3
Next, let us state the First Derivative Test
Suppose x = c is a critical point of the function f(x). Then, the following conditions apply:
1. If the derivative f’(x) > 0 to the left of x = c and f’(x) < 0 to the right of x = c, then x = c is a relative maximum.
2. If the derivative f’(x) < 0 to the left of x = c and f’(x) > 0 to the right of x = c, then x = c is a relative minimum.
3. If the derivative f’(x) maintains the same sign on both sides of x = c, then x = c is neither a relative maximum nor a relative minimum.
1. If the derivative f’(x) > 0 to the left of x = c and f’(x) < 0 to the right of x = c, then x = c is a relative maximum.
2. If the derivative f’(x) < 0 to the left of x = c and f’(x) > 0 to the right of x = c, then x = c is a relative minimum.
3. If the derivative f’(x) maintains the same sign on both sides of x = c, then x = c is neither a relative maximum nor a relative minimum.
In[]:=
Plot-+(400-),w,-1,+1
2
w
2
1
4
2
w
20
3
20
3
Out[]=
Based on the derivative test, f has a maximum at the w=. The dimensions with respect to which the volume is maximized are w=l= and h=
20
3
20
3
10
3
In[]:=
h[w_]:=
400-
2
w
4w
In[]:=
h
20
3
Out[]=
10
3
Example: A metal company has an order to make cylindrical cans with the volume of 250 cubic centimeters. What should be the dimensions of the cans in order to use the least amount of metal in the production
In[]:=
v[r_,h_]:=Pir^2h
In[]:=
FullSimplify[Solve[v[r,h]==250,r]]
Out[]=
r-,r
5
10
π
h
5
10
π
h
In[]:=
r=
5
10
π
h
Out[]=
5
10
π
h
Next, the surface area of a typical can take the following form:
In[]:=
2Pir^2+2Pirh
Out[]=
500
h
h
10π
In[]:=
s[h_]:=+10
500
h
h
10π
To minimize the surface area function which we denote by s, we will need to compute its derivative first.
In[]:=
s'[h]
Out[]=
-+
500
2
h
5
10π
h
Next, we need to find the critical points of the surface area which are given at the places at which the derivatives is either undefined or is equal to zero. Observing that the domain of s is precisely the set of all non-negative real numbers, the only possible critical points occur at places at which its derivative is equal to zero.
In[]:=
FunctionDomain+10
500
h
h
10π
,hOut[]=
h>0
To find the critical point of s, we solve the equation s(h)=0 for h.
In[]:=
Solve-+==0,h
500
2
h
5
10π
h
Out[]=
h
10
1/3
π
In[]:=
Plot-+,h,-1,+1
500
2
h
5
10π
h
10
1/3
π
10
1/3
π
Out[]=
Example: Find two numbers whose difference is 100 and whose product is a minimum
Solution: Let x and y be two numbers satisfying the conditions above. Without loss of generality, let us assume that
y is greater than or equal to x. That is y-x=100 and we hope to find the pair (x,y) so that the product xy is as small as possible.
Solution: Let x and y be two numbers satisfying the conditions above. Without loss of generality, let us assume that
y is greater than or equal to x. That is y-x=100 and we hope to find the pair (x,y) so that the product xy is as small as possible.
To find the critical points for the function x -> x(100+x), we need to set its derivative to be equal to zero
since the derivative is a polynomial and is always defined.
since the derivative is a polynomial and is always defined.
In summary, the two numbers whose difference is 100 and whose product is a minimum is given by the pair (-50,50) and the smallest product is -2500
