With all things being equal. Assume that the 40' drop will require 50' of wiring

50' run, 15A at 240 volts;

#10 AWG drop 1.54V load 238.46V drop 0.6%

#12 AWG drop 2.45V load 237.55V drop 1.0%

#14 AWG drop 3.90V load 239.10V drop 1.6%

50' run, 20A at 240 volts;

#10 AWG drop 2.05V load 237.95V drop 0.86%

#12 AWG drop 3.27V load 236.74V drop 1.36%

#14 AWG drop 5.19V load 234.81V drop 2.16% *not to code*

50' run, 25A at 240 volts;

#10 AWG drop 2.57V load 237.43V drop 1.07%

#12 AWG drop 4.08V load 235.92V drop 1.70% *not to code*

#14 AWG drop 6.48V load 233.52V drop 2.70% *not to code*

50' run, 30A at 240 volts;

#10 AWG drop 3.08V load 236.92V drop 1.28%

#12 AWG drop 4.90V load 235.10V drop 2.04% *not to code*

#14 AWG drop 7.78V load 232.22V drop 3.24% *not to code*

It is all ohms law. (do not drive while being a resistor). An online calculator can be found at;

http://www.powerstream.com/Wire_Size.htm