The gait transition in legged animals has attracted many researchers, and i
ts relation to metabolic cost and mechanical work has been discussed in rec
ent 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 pro
portional to the square of joint torque and examined the optimal locomotor
pattern based on the energetic cost in a simple dynamical model of a hexapo
d by computer simulations. The obtained results well agree with characteris
tics in the locomotor patterns in legged animals; for example, the leg prot
raction time, step length, and the metabolic cost of transport are almost c
onstant for many velocities, the leg cycling period decreases with velocity
, and the energetic cost of locomotion induced by carrying loads linearly i
ncreases with mass loaded. This correspondence of the results of calculatio
n to experimental results suggest that the heat energy loss for torque gene
ration is proportional to the square of the torque during locomotion, and t
hat the locomotor pattern in legged animals is highly optimized based on th
e energetic cost.