We present an analytical method for the concurrent calculation of optimal parallel compliant elements and frequency of reference trajectories for serial manipulators performing cyclic tasks. In this approach, we simultaneously shape and exploit the robot's natural dynamics by finding a set of compliant elements and task frequency that result in minimization of an energy-based cost function. The cost function is the integral of a weighted squared norm of the generalized forces. We prove that the generalized force needed for tracking the reference trajectory is a linear function of compliance coefficients and a quadratic function of task frequency. Therefore, the cost function is quadratic with respect to stiffness coefficients and quartic with respect to the task frequency. These properties lead to a well-posed optimization problem with a closed-form solution. Using three case studies, we elucidate the properties of our method.