Well, as I wrote before, it is more complicated as the basic equation if your really want to make an optimal Yagi. This equation goes only for one element, called a dipole. You must know that only one of the rods is the dipole antenna, the other rods are for reflecting and directing the waves generated by the dipole element.Thanks. For practical reasons, those lengths may be too cumbersome, so could an exact fraction be used instead, e.g. ½ so 6.25 cm and 2.5862 cm respectively? It appears that’s what the yagi antennas you can buy online have done. Also, the one at the back appears to be longer for both 2.4 and 5.8?
Finally, what should the distances be between them?

More directors make a more complicated total wave pattern. I refer to some interesting websites with information on Yagi antennas and for online calculating the exact lenghts and spacings of the rods for a 3-element Yagi: 3-element Yagi calculator or yagi antenna or more info on Yagi. If you googlo on 'Yagi antenna' you will find numerous websites on the subject.
The spacing of the directors D3-D4 etc is usually the same as for D2-D3 since the effect will be less and less the further you go from the dipole element, but the first 3 have to be spaced at a different distance from each other. You see that making a Yagi is a lot more that just putting some rods together... And I have not mentionned skin effect of the thickness and the metal used etc. If you buy a Yagi you can only hope the manufacturer has done his homework properly.
I hope I did not make it too complicated but I think I have proved that antenna design is not an easy task
