Find the dimensions of a cylindrical can that will minimize the cost of the material

A cylindrical can is to be made to hold 1 L of oil. Find the dimensions
that will minimize the cost of the metal to manufacture the can.

This is a standard calculus problem.

The volume of the cylinder is:

V == π r^2 h

The area of the cylinder is:

A[r_] := 2 π r^2 + 2 π r h /. h -> V/(π r^2)

Find r when the slope of the area is zero:

Reduce[A'[r] == 0]

Result:

(r == -(-(1/(2 π)))^(1/3) V^(1/3) ||
r == V^(1/3)/(2 π)^(1/3) ||
r == ((-1)^(2/3) V^(1/3))/(2 π)^(1/3)) && r != 0

As you can see, when I defined A[r], I replaced h with an expression produced by solving the volume equation for h.

My question is, is there a way to express the problem in terms of Reduce and a set of equations, without the manual solving for h?

I.e. something along the lines of:

A[r_] := 2 π r^2 + 2 π r h

Reduce[{A'[r] == 0, V == π r^2 h}]

Of course, that doesn’t yield the correct answer because A'[r] doesn’t treat h as being in terms of r.

=================

2

 

Why not use Minimize[{2 Pi r^2 + 2 Pi r h, Pi r^2 h == 1/1000, r > 0, h > 0}, {r, h}]?
– J. M.♦
Aug 6 ’12 at 3:54

  

 

@J.M. Wasn’t familiar with Minimize… Thanks for the suggestion! However, is there a way to get the answer not in terms of Root?
– dharmatech
Aug 6 ’12 at 4:00

  

 

@J.M. I’m still curious as to how to solve it with Reduce. I added an answer which takes the approach I was looking for, but uses a rewrite kludge.
– dharmatech
Aug 6 ’12 at 4:01

1

 

“However, is there a way to get the answer not in terms of Root[]?” – yes, use ToRadicals[]; it will work here since it is the root of a cubic polynomial.
– J. M.♦
Aug 6 ’12 at 4:07

2

 

It seems there is a bug in ToRadicals. Try ToRadicals[ Root[1000 Pi #^3 – 15 (2 Pi)^(1/3) # + 1 &, 2]]
– Artes
Aug 6 ’12 at 8:49

=================

2 Answers
2

=================

As requested, here is a method that uses Reduce[]:

Reduce[Dt[2 Pi r^2 + 2 Pi r h, r] == 0 && Pi r^2 h == 1/1000 && Positive[r], {r, h}]

I’d still prefer using Minimize[], though.

  

 

Aha… I had been using D (partial derivative) necessitating the expression of h in terms of r. I see that Dt takes care of this. Thanks again J.M.!
– dharmatech
Aug 6 ’12 at 4:34

OK, I found one approach:

A[r_] := 2 \[Pi] r^2 + 2 \[Pi] r h
V[r_] := \[Pi] r^2 h
Reduce[{Dt[A[r], r] == 0, V[r] == 1, r > 0}]

Result:

r == 1/(2 \[Pi])^(1/3) && h == 2^(2/3)/\[Pi]^(1/3)