You're getting into specifics and that's more advanced than what Drex has explained. Have a read here and see if it answers your questions :
Apparently this guy got inspiration from someone in ZTH! Doesn't really talk about how he did the calculation though but is still a pretty good read.
the link is here:Exhaust Length,exhaust pipe,induction
Have fun...not sure of its accuracy!!... and unless you want to squeeze every last drop of bhp from the engine( full race specs) who wanna try????...please document