calculate the cost and max stress of a section