For Loop
- To: mathgroup at smc.vnet.net
- Subject: [mg44868] For Loop
- From: "Sheth, Payal R." <prsheth at utmb.edu>
- Date: Thu, 4 Dec 2003 03:04:31 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I am trying to solve for pTyr50for100 this FOR loop with three different variables (KmPdephos,Kcatautophos, Kcatphos). I basically want to calculate the value of pTyr50for100 for different combinations of these variables as defined in the loop However, once the innner loop is completed the value of the inner loop variable remains steady at the final value and that loop is exited. There is a logical error in this code which I havent been able to find and I was hoping someone could help me with it. To make things clearer heres the code For[dimKcatautophos = 0.0008; For[dimKmPdephos = 0.01; For[dimKcatphos = 0.008; ndsolutioncombined, dimKcatphos < 0.8, dimKcatphos += 0.1, pTyr50for100 = {dimKcatautophos/0.0008, \ dimKmPdephos/0.01, dimKcatphos/0.008, ((Lphos[50] /. ndsolutioncombined)/3)*100}; Print[pTyr50for100]], dimKmPdephos < 1, dimKmPdephos += 0.3, pTyr50for100 = \ {dimKcatautophos/0.0008, dimKmPdephos/0.01, dimKcatphos/0.008, ((Lphos[50] /. \ ndsolutioncombined)/ 3)*100}; Print[pTyr50for100]], dimKcatautophos < 0.08, dimKcatautophos += .1, pTyr50for100 = {dimKcatautophos/0.0008, dimKmPdephos/0.01, dimKcatphos/0.008, ((Lphos[50] /. ndsolutioncombined)/3)*100}; Print[ pTyr50for100]] ndsolution:= a set of 20 differential equations The output from this is 0.0008, 0.01, 0.008, {value at this condition) 0.0008, 0.01, 0.108, {value at this condition) 0.0008, 0.01, 0.208, {value at this condition} ... 0.308 .......... Here the Value of inner loop is changing as anticipated .... ......... 0.408............ .... ........... 0.508................ .................. 0.608 .... 0.708 ...... 0.808 0.0008, 0.31, 0.808 But here I would expect the inner loop to be evaluated after the increment in the middle loop 0.0008, 0.61, 0.808 Instead the inner loop value is constant (max value) and middle loop is evaluated