I can't help directly with the formula thing, but I can say that back in the 70s I read an article somewhere that gave a formula for working out the tuned length and ID based on bore/stroke etc. I cannot say how accurate this concept was/is, but I did use it to develop a pipe for my TT500F. If I remember right, to get max power at about 6500 on a TT500, the tuned length for a 1.75" ID pipe was something like 36.5". I found me an old reverse cone megaphone from a system for an earlier XL250 and added that to a 1.5" "tuned" length header using a 1.75" joiner, and the end result was one of the fastest 500s I ever owned. The weird thing was a mate copied the dimensions exactly and made his own pipe and the bike ran like crap... The formula suggested that the longer the header, the lower the power peak, or in effect the less power was developed. I always wondered how well things like Hanco pipes and Peter Allen pipes were, given that they had headers of something like 45" length to wind around the shocks. According to that formula, those engines should have actually lost several HP. That pipe in the ebay advert looks absolutely spot-on just from eyeballing it...
Anyways, what I am trying to say I guess is that yes there's a formula, and I am sure someone knows what that is. Not sure about twin headers tho.