Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I want to solve 13 variables by 13 equations. And here is my program:

Solve[{RD == (1.1*NR)^0.6, 0.6*1.1^0.6*NR^-0.4 == wr/em, wr == em^0.2,
  Q == (0.6 NQ^(-1/3) + 0.02 R^(-1/3) + 0.38 K^(-1/3))^-3, 
  0.6 (Q/NR)^(4/3) == w, 0.02 (Q/R)^(4/3) == em, 
  0.38 (Q/K)^(4/3) == 0.04, NR + NQ + NU == 1 - L, 
  w (NR + NU) == wr*NR, C1/C2 == 4*em, 
  L == (1/1.04*0.2^0.2*0.8^0.8*em^-0.2*w)^-0.2, 
  Q == C1 + 0.25 Q*em^0.5, 
  0.25*Q*em^0.5 - em*C2 - em (R - RD) == 0}, {RD, NR, wr, em, Q, NQ, 
  R, K, w, NU, L, C1, C2}]

After executing this I get the following message

:General::ivar: 1.11396/(w/<<2>>^<<4>>)^0.2 is not a valid variable. >>

Here is how it looks in my notebook. Could anybody kindly answer what's going on?

share|improve this question
1  
Your full set of equations is just unsolvable by Solve. All you could do is use the result of Solve[{NR + NQ + NU == 1 - L, w*(NR + NU) == wrNR, C1/C2 == 4*em, Q == C1 + 0.25*Qem^0.5, 0.25*Qem^0.5 - emC2 - em*(R - RD) == 0}, {NR, w, em, Q, R}] to try to find numeric solutions using FindRoot. –  Rolf Mertig Oct 12 '12 at 7:19
    
I don't get that error with the code you posted. Did you try to restart the kernel? –  sebhofer Oct 12 '12 at 8:24
    
Thanks, Sebhofer. I even restarted computer and then did it again. But this time, the program already keeps running for 20 mins and did not show any results. How come? –  David Oct 12 '12 at 9:33
    
Also thanks for Rolf's reply. Could u please explain more clearly? –  David Oct 12 '12 at 9:34
3  
The error message is probably because you had previously assigned one of the variables. For example, a=5;Solve[a+b==0&&a-b==1,{a,b}] gives Solve::ivar: 5 is not a valid variable. –  celtschk Oct 12 '12 at 10:34

1 Answer 1

Probably way to hard for Solve; there are, in effect, some polynomials of high degree. One can make them explicit by substituting powers of things to remove radicals. Here is some laborious code to do that.

eqns = Rationalize[
  Rationalize[{RD == (1.1*NR)^0.6, 0.6*1.1^0.6*NR^-0.4 == wr/em, 
    wr == em^0.2, 
    Q == (0.6 NQ^(-1/3) + 0.02 R^(-1/3) + 0.38 K^(-1/3))^-3, 
    0.6 (Q/NR)^(4/3) == w, 0.02 (Q/R)^(4/3) == em, 
    0.38 (Q/K)^(4/3) == 0.04, NR + NQ + NU == 1 - L, 
    w (NR + NU) == wr*NR, C1/C2 == 4*em, 
    L == (1/1.04*0.2^0.2*0.8^0.8*em^-0.2*w)^-0.2, 
    Q == C1 + 0.25 Q*em^0.5, 
    0.25*Q*em^0.5 - em*C2 - em (R - RD) == 0}], 0]

exprs = Apply[Subtract, eqns, {1}]
exprs2 = PowerExpand[Numerator[Together[exprs]]]
powers = Cases[exprs2, aa_^bb_, Infinity]

base[aa_^bb_] := aa
expon[aa_^bb_] := bb

powers2 = SplitBy[Sort[powers], base]
bases = Map[base[First[#]] &, powers2, {1}]
expons = Map[expon, powers2, {2}]
newexpons = Apply[GCD, expons, {1}]
varrules = Thread[bases -> bases^Denominator[newexpons]]

exprs3 = PowerExpand[exprs2 /. varrules]
exprs4 = Numerator[Together[exprs3]]

Here is what we have.

{-45482911 NR^9 + 42954893 RD, 
 30555731 em^50 - 48095652 NR^6 wr, -em^10 + wr, 
 K^3 NQ^3 Q^3 + 90 K^3 NQ^2 Q^3 R + 57 K^2 NQ^3 Q^3 R + 
  2700 K^3 NQ Q^3 R^2 + 3420 K^2 NQ^2 Q^3 R^2 + 1083 K NQ^3 Q^3 R^2 - 
  125000 K^3 NQ^3 R^3 + 27000 K^3 Q^3 R^3 + 51300 K^2 NQ Q^3 R^3 + 
  32490 K NQ^2 Q^3 R^3 + 6859 NQ^3 Q^3 R^3, 3 Q^4 - 5 NR^20 w^5, 
 Q^4 - 50 em^50 R^4, -2 K^4 + 19 Q^4, -1 + L + NQ^3 + NR^15 + NU, 
 NR^15 w^5 + NU w^5 - NR^15 wr, 
 C1 - 4 C2 em^50, -155995864 em^2 + 140036747 L w, -4 C1 + 4 Q^3 - 
  em^25 Q^3, -4 C2 em^50 + em^25 Q^3 - 4 em^50 R^3 + 4 em^50 RD}

After all this, I expect the following to hang. But who knows...

Timing[ns = NSolve[exprs4];]
share|improve this answer
1  
+1 for the optimistic POV –  belisarius Oct 12 '12 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.