Student Support Forum: 'Assigning variables from Solve in a Do Loop' topicStudent Support Forum > General > "Assigning variables from Solve in a Do Loop"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Billy 04/26/99 10:03am Can someone please help me with the following problem. I am trying to use Solve within a Do loop and I need to use the solved variables later in the Do loop. The best way I have found to assign a variable using Solve is: a=a /. Solve[{ 25.5+11.1+2*a==2*b+c+2*d, 2*3.76*a==2*e, d==x*(b+c+e)/(1-x) }, {a,e,d}][[1]]; The only problem is this doesn't seem to work in a Do loop. Is there any reason why it shouldn't? I listed the code I have used which gives me many errors. Any suggestions for a better way to do this would be appreciated. Do[{ Clear[a,b,c,d,e,x,\[CapitalDelta]H], b=44, c=42.9, \[CapitalDelta]H=-1, a=a /. Solve[{ 25.5+11.1+2*a==2*b+c+2*d, 2*3.76*a==2*e, d==x*(b+c+e)/(1-x) }, {a,e,d}][[1]]; d=d /. Solve[{ 25.5+11.1+2*a==2*b+c+2*d, 2*3.76*a==2*e, d==x*(b+c+e)/(1-x) }, {d,e}][[1]]; e=e /. Solve[{ 2*3.76*a==2*e, d==x*(b+c+e)/(1-x) }, e][[1]]; }, {x,0,0.20,0.01}] URL: ,

 Subject (listing for 'Assigning variables from Solve in a Do Loop') Author Date Posted Assigning variables from Solve in a Do Loop Billy 04/26/99 10:03am Re: Assigning variables from Solve in a Do Loop Forum Modera... 04/27/99 09:54am
 Next Comment > Help | Reply To Topic