Re: Solve[] for equations?

*To*: mathgroup at smc.vnet.net*Subject*: [mg31998] Re: Solve[] for equations?*From*: "Alan Mason" <swt at austin.rr.com>*Date*: Sun, 16 Dec 2001 03:44:34 -0500 (EST)*References*: <9v7857$s6n$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

"Doug VanGoethem" <djvango at sandia.gov> wrote in message news:9v7857$s6n$1 at smc.vnet.net... > I have a system of equations > > eq1 = Rac == R1(R2+R3+R4)/(R1+R2+R3+R4) > eq2 = Rad == R2(R1+R3+R4)/(R1+R2+R3+R4) > eq3 = Rbc == R3(R1+R2+R4)/(R1+R2+R3+R4) > eq4 = Rbd == R4(R1+R2+R3)/(R1+R2+R3+R4) > > I'd like to get R1, R2, R3, and R4 in terms of Rac, Rad, Rbc, and Rbd. Four > equations, four unknowns -- it seems simple in concept so I figured Mathematica > could do it easily. I thought that something along the lines of: > > Solve[{eqs},{R1, R2, R3, R4}] or > Solve[{eqs}, R1, {R2, R3, R4}] > > would have worked, but these give {}. They only permutation of commands > that seemed to do anything was something like > > Solve[eq1, R1] > > but one can do that easily by hand so what's the point. > > Is there some other command I should be using besides Solve? Is there some > mathematical reason that I don't recognize as to why this won't work? I > would appreciate any insights. > > Thanks in advance, > Doug VanGoethem Hello, The problem is actually quite difficult. It's not reasonable to expect to be able to solve the four equations exactly in closed form for the R's in terms of the t's (in my notation -- I replaced Rac etc. with t1, t2, t3, t4). I was able to get some partial results (up to three of the equations in three of the R's). The documentation for Solve in misleading -- I got nowhere with Solve[eqns, vars, elims], had to use Solve[eqns, vars]. Apparently the system determines what the other variables are and will try to eliminate them. Notebook follows. In[114]:= eq1 = t1 == R1(R2+R3+R4)/(R1+R2+R3+R4) eq2 = t2 == R2(R1+R3+R4)/(R1+R2+R3+R4) eq3 = t3 == R3(R1+R2+R4)/(R1+R2+R3+R4) eq4 = t4 == R4(R1+R2+R3)/(R1+R2+R3+R4) In[118]:= eqns = {eq1, eq2, eq3, eq4} T = {t1, t2, t3, t4} R = {R1, R2, R3, R4} (* The Jacobian determinant for this change of variables is generically nonzero. *) In[121]:= Solve[eqns, T, R](* The documentation, Sec. 3.4.8 of the Mathematica book, suggests this should work. But I find you have to use Solve[eqns, T], i.e., Solve with only two arguments not three. The system automatically figures out what the other \ variables (elims)are. In any case, this problem is trivial because it's already solved for the t's. Instead, I had to Abort *) Out[121]= $Aborted In[122]:= Solve[eqns, R, T] (* Again, wrong form apparently. *) Out[122]= {{}} In[123]:= Solve[eqns, R] (* timed out, see sequence of simpler problems below *) Out[123]= $Aborted In[124]:= Solve[eqns, T] (* trivial *) Out[124]= \!\({{t1 \[Rule] \(R1\ \((R2 + R3 + R4)\)\)\/\(R1 + R2 + R3 + R4\), t2 \[Rule] \(R2\ \((R1 + R3 + R4)\)\)\/\(R1 + R2 + R3 + R4\), t3 \[Rule] \(R3\ \((R1 + R2 + R4)\)\)\/\(R1 + R2 + R3 + R4\), t4 \[Rule] \(\((R1 + R2 + R3)\)\ R4\)\/\(R1 + R2 + R3 + R4\)}}\) In[125]:= Solve[eqns, {R1}] (* Looks OK -- No solution of the 4 eqns for R1 with all the other variables t, R eliminated *) Out[125]= {} In[126]:= Solve[eqns[[1]], {R1}](* OK *) Out[126]= \!\({{R1 \[Rule] \(R2\ t1 + R3\ t1 + R4\ t1\)\/\(R2 + R3 + R4 - t1\)}}\) In[127]:= Solve[Take[eqns, 2], Take[R, 2]] (* OK, not exactly simple. Since t3, t4 don't appear here in the first two eqns, we're solving these eqns for R1, R2 with t1, t2, R3, R4 eliminated. 2 eqns, 6 variables, four degrees of freedom eliminated. Problem looks well-posed *) Out[127]= \!\({{R1 \[Rule] \(1\/\(\(-R3\) - R4 + t1 - t2\)\) \((\(-R3\)\ t1 - R4\ t1 + R3\^3\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(3\ R3\^2\ R4\)\/\(2\ \ \((R3 + R4 + t1 - t2)\)\) + \(3\ R3\ R4\^2\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) \ + R4\^3\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(R3\^2\ t1\)\/\(2\ \((R3 + R4 + t1 \ - t2)\)\) + \(R3\ R4\ t1\)\/\(R3 + R4 + t1 - t2\) + \(R4\^2\ t1\)\/\(2\ \((R3 \ + R4 + t1 - t2)\)\) + R3\ t2 + R4\ t2 - \(3\ R3\^2\ t2\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) - \(3\ \ R3\ R4\ t2\)\/\(R3 + R4 + t1 - t2\) - \(3\ R4\^2\ t2\)\/\(2\ \((R3 + R4 + \ t1 - t2)\)\) - \(R3\ t1\ t2\)\/\(R3 + R4 + t1 - t2\) - \(R4\ t1\ t2\)\/\(R3 + \ R4 + t1 - t2\) + \(R3\ t2\^2\)\/\(R3 + R4 + t1 - t2\) + \(R4\ t2\^2\)\/\(R3 + \ R4 + t1 - t2\) + \(R3\^2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \ \((R3 + R4 + t1 - t2)\)\) + \(R3\ R4\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ \ t2\)\)\/\(R3 + R4 + t1 - t2\) + \(R4\^2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ \ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(R3\ t1\ \@\(R3\^2 + 2\ R3\ R4 \ + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(R4\ t1\ \@\(R3\^2 \ + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) - \(R3\ \ t2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\ \)\) - \(R4\ t2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + \ R4 + t1 - t2)\)\))\), R2 \[Rule] \(\(-R3\^2\) - 2\ R3\ R4 - R4\^2 + 2\ R3\ t2 + 2\ R4\ t2 - \ \((R3 + R4)\)\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 \ + t1 - t2)\)\)}, {R1 \[Rule] \(1\/\(\(-R3\) - R4 + t1 - t2\)\) \((\(-R3\)\ t1 - R4\ t1 + R3\^3\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(3\ R3\^2\ R4\)\/\(2\ \ \((R3 + R4 + t1 - t2)\)\) + \(3\ R3\ R4\^2\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) \ + R4\^3\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(R3\^2\ t1\)\/\(2\ \((R3 + R4 + t1 \ - t2)\)\) + \(R3\ R4\ t1\)\/\(R3 + R4 + t1 - t2\) + \(R4\^2\ t1\)\/\(2\ \((R3 \ + R4 + t1 - t2)\)\) + R3\ t2 + R4\ t2 - \(3\ R3\^2\ t2\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) - \(3\ \ R3\ R4\ t2\)\/\(R3 + R4 + t1 - t2\) - \(3\ R4\^2\ t2\)\/\(2\ \((R3 + R4 + \ t1 - t2)\)\) - \(R3\ t1\ t2\)\/\(R3 + R4 + t1 - t2\) - \(R4\ t1\ t2\)\/\(R3 + \ R4 + t1 - t2\) + \(R3\ t2\^2\)\/\(R3 + R4 + t1 - t2\) + \(R4\ t2\^2\)\/\(R3 + \ R4 + t1 - t2\) - \(R3\^2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \ \((R3 + R4 + t1 - t2)\)\) - \(R3\ R4\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ \ t2\)\)\/\(R3 + R4 + t1 - t2\) - \(R4\^2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ \ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) - \(R3\ t1\ \@\(R3\^2 + 2\ R3\ R4 \ + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) - \(R4\ t1\ \@\(R3\^2 \ + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\)\) + \(R3\ \ t2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 + t1 - t2)\ \)\) + \(R4\ t2\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + \ R4 + t1 - t2)\)\))\), R2 \[Rule] \(\(-R3\^2\) - 2\ R3\ R4 - R4\^2 + 2\ R3\ t2 + 2\ R4\ t2 + \ \((R3 + R4)\)\ \@\(R3\^2 + 2\ R3\ R4 + R4\^2 + 4\ t1\ t2\)\)\/\(2\ \((R3 + R4 \ + t1 - t2)\)\)}}\) In[113]:= Solve[Take[eqns,3], Take[R, 3]](* Very long and involved expression, but looks OK. 3 eqns, 7 variables (no t4), eliminate four degrees of freedom (R4, t1, t2, t3). Again, problem looks well-posed, should generically have a zero-dim solution set (possibly empty) *) (* The final problem Solve[eqns, R] is just too difficult and times out. *)

**equations**

**beginner question**

**Re: Re: Re: Solve[] for equations?**

**Re: Solve[] for equations?**