RE: Center of Gravity
How it is done is you calculate a neutral point for the wing-body shape. Then the effect of the horizontal tail on that is calculated. Depending on desired stability the CG is selected.
There isn't necessarily a one formula answer. Could I ask what airplane or shape are you trying to do?
For instance a flying wing with no sweep flies OK with the CG at 20% of the wing chord.
For a "standard normal" type of airplane like we all know and love a CG at around 30% of the wing chord is OK.
Rather than try to calculate the CG anymore I just make a small foam glider of the configuration and adjust elevator trim and nose weight until it will glide nice. So far using the same percentage chord on the model has worked fine.
I would especially use the technique for anything that is strange or wierd in shape. It is a good approach that works.