i = float (raw_input("Enter i"))
Pd = int (raw_input("Enter Pd"))
while True:
P1= (i-6.95)/(2*9.68*0.0001)
P2= (i-7.051)/(2*7.378*0.0001)
P3= (i-6.531)/(2*1.04*0.001)
e= Pd-P1-P2-P3
if e<=1 :
F1=9.68*0.0001*P1*P1 + 6.95*P1 + 749.55
F2=7.738*0.0001*P2*P2 + 7.051*P2 + 1285
F3=1.04*0.001*P3*P3 + 6.531*P3 + 1531
F= F1+F2+F3
print 'Total cost F is {0}\n'.format(F)
print P1
print P2
print P3
break
else :
i=i + 0.1(i)
I wrote a simple while loop like this to calculate the power demand and generation. to entre a power demand Pd #and incremental cost. I can calculate each power generator output P1 P2 and P3. there is a iteration required #which is when Pd-the sum of P1 P2 and P3, should be less than one.
when I run it by inputting i=8.5 and pd=2500, the results are 800.619834711981.973434535, 946.634615385. it means #the thing never iterate since the sum of this three are not 2500.
can someone tell me why is not iterating and what is wrong with my while true loop.