function [Area, d1, d2, dd1, dd2] = conesurf (r1,r2,h) % For the frustum of a cone this routine computes the surface area/pi % and first two partial derivatives wrt the radii. slant = sqrt(h^2+(r2-r1)^2) ; Area = (r1+r2) * slant ; d1 = slant + (r1^2-r2^2)/slant ; d2 = slant + (r2^2-r1^2)/slant ; dd1 = (3*r1-r2)/slant - (r1+r2)*(r2-r1)^2/slant^3 ; dd2 = (3*r2-r1)/slant - (r1+r2)*(r2-r1)^2/slant^3 ; return