The gait transition in legged animals has attracted many researchers, and its relation to metabolic cost and mechanical work has been discussed in recent decades. We assumed that the energetic cost during locomotion is given by the sum of positive mechanical work and the heat energy loss that is proportional to the square of joint torque and examined the optimal locomotor pattern based on the energetic cost in a simple dynamical model of a hexapod by computer simulations. The obtained results well agree with characteristics in the locomotor patterns in legged animals; for example, the leg protraction time, step length, and the metabolic cost of transport are almost constant for many velocities, the leg cycling period decreases with velocity, and the energetic cost of locomotion induced by carrying loads linearly increases with mass loaded. This correspondence of the results of calculation to experimental results suggest that the heat energy loss for torque generation is proportional to...