safe said:After a lot of number crunching and modifications of formulas (most recently the PWM Current Warping effect)
What's the "PWM Current Warping Effect?" You mean the basic function of bucking a voltage?
The question of gearing vs hubmotor comes down to which transmission you rely more heavily on - the mechanical transmission of the gearing vs the electrical transmission afforded by the motor drive. In general mechanical transmissions are more efficient, so if you could go with a mechanical transmission only, you'd win. However, most ebikes have both; I know of very few brushed motors that are just connected straight to the battery. So you always have the controller loss anyway.
At wide-open throttle, most controllers are at their most efficient; this is generally near the base speed of the motor. Thus, a transmission that allows the motor to remain at or near this speed will definitely help with efficiency.
Mechanical transmissions are an excellent way to minimize the size of a motor. With a transmission, you don't have to size the motor for hill climbing torque while setting the voltage high enough to go at your top speed; you can use a smaller motor that generates less torque then use the gearing to increase the torque at low speeds. (Delta/wye switching is another way to accomplish this.) However, the smaller motor will be less efficient at cruising speeds, since physical size relates to things like winding resistance. So it's always a tradeoff.