Group Abstract Group Abstract

Message Boards Message Boards

Solve a system of 8 equations with 8 variables using NSolve?

I am working in a system of 8 equations and am trying to solve for 8 variables. I ran NSolve[{equations},{vars},Reals], and it just spat out my equations back at me. Am I missing something or using this routine incorrectly? Any help would be appreciated. Pasting my code below

Clear["Global'*"]; NSolve[{(
    4 rin)/((kmn + 4) ((.25 wcr)^senc + 1) ((.25 wfr)^senf + 1)) - 
    36.923 == 
   0, (7 rin)/((kmn + 7) ((.5 wcr)^senc + 1) ((.5 wfr)^senf + 1)) - 
    63.077 == 
   0, (16 rin)/((kmn + 16) ((.75 wcr)^senc + 1) ((.75 wfr)^senf + 
       1)) - 147.962 == 
   0, (46 rin)/((kmn + 46) (wcr^senc + 1) (wfr^senf + 1)) - 270.769 ==
    0,
  (4 rin)/((kmn + 4) ((.25 dcr)^senc + 1) ((.25 dfr)^senf + 1)) - 
    33.323 == 
   0, (7 rin)/((kmn + 7) ((.5 dcr)^senc + 1) ((.5 dfr)^senf + 1)) - 
    83.446 == 
   0, (16 rin)/((kmn + 16) ((.75 dcr)^senc + 1) ((.75 dfr)^senf + 
       1)) - 498.46 == 
   0, (46 rin)/((kmn + 46) (dcr^senc + 1) (dfr^senf + 1)) - 1206.154 ==
    0}, {rin, kmn, wcr, senc, wfr, senf, dcr, dfr},Reals]
POSTED BY: Josh Wofford
11 Replies

Josh, I have used also the function Minimize[] by fixing 6 or 7 arguments and minimizing the function f[] on the rest of variables and succeed to find the following local solution:

In[1]:= f[6.171439493048681`*^14, 2.3506806096409836`*^13, \
0.16717122698568856, 1.0555557671120848`, 2.9971, 1.3111, 0, 0]

Out[1]= 20784.9

So you set up a Minimize[] instead of the FindMinimum in the code? Sorry I'm still learning the various ropes of mathematica

POSTED BY: Josh Wofford

I have fixed some variables and used Minimize[] for the rest of variables... Unfortunately, this is all I can do for the moment!

Valeriu, I have updated my equations slightly and tried to use the code you gave me but it is kicking out an error, and I can't seem to see where the problem is right off, but when it is convenient I would appreciate your help

Clear["Global'*"]; 
f[rin_, kmn_, wfr1_, senf_, wfr2_, dfr1_, dfr2_, 
  dfr3_] := (-33.323 + (4 rin)/((kmn + 4) ((.5 dfr1)^senf + 
          1)))^2 + (-83.446 + (7 rin)/((kmn + 7) ((dfr1)^senf + 
          1)))^2 + (-498.46 + (16 rin)/((kmn + 16)  ((dfr2)^senf + 
          1)))^2 + (-1206.154 + (46 rin)/((kmn + 46)  (dfr3^senf + 
          1)))^2 + (-270.769 + (46 rin)/((kmn + 46) (wfr2^senf + 
          1)))^2 + (-36.923 + (4 rin)/((kmn + 4) ((.5 wfr1)^senf + 
          1)))^2 + (-63.077 + (7 rin)/((kmn + 7) ((wfr1)^senf + 
          1)))^2 + (-147.962 + (16 rin)/((kmn + 16)  ((.5 wfr2)^
          senf + 1)))^2
FindMinimum[
 f[rin, kmn, wfr1, senf, wfr2, dfr1, drf2, 
  dfr3], {{rin, 0}, {kmn, 0}, {wfr1, 0}, {senf, 1}, {wfr2, 0}, {dfr1, 
   0}, {dfr2, 0}, {dfr3, 0}}]
POSTED BY: Josh Wofford

Apropos, Josh! You have done a mistake in writing argument of the function f[] in FindMinimum[]. The last but one argument must be dfr2 not drf2.

Ok. I can take this and check out some ideas. Bill, I'm a little lost as to what you mean with the NMinimize and Norm comment, do you have an example I could work with?

POSTED BY: Josh Wofford
Posted 8 years ago
POSTED BY: Bill Simpson

Indeed this all has given me some good ideas. I appreciate your help and suggestions Bill. Thank you

POSTED BY: Josh Wofford

You may use the function FindMinimum[] to find a local solution of the sum of squares of the right parts of the equations:

In[110]:= Remove["Global`*"]

f[rin_, kmn_, wcr_, senc_, wfr_, senf_, dcr_, 
  dfr_] := (-33.323 + (
    4 rin)/((1 + 0.25^senc dcr^senc) (1 + 0.25^senf dfr^senf) (4 + 
       kmn)))^2 + (-83.446 + (
    7 rin)/((1 + 0.5^senc dcr^senc) (1 + 0.5^senf dfr^senf) (7 + 
       kmn)))^2 + (-498.46 + (
    16 rin)/((1 + 0.75^senc dcr^senc) (1 + 0.75^senf dfr^senf) (16 + 
       kmn)))^2 + (-1206.154 + (
    46 rin)/((1 + dcr^senc) (1 + dfr^senf) (46 + 
       kmn)))^2 + (-270.769 + (
    46 rin)/((46 + kmn) (1 + wcr^senc) (1 + wfr^
       senf)))^2 + (-36.923 + (
    4 rin)/((4 + kmn) (1 + 0.25^senc wcr^senc) (1 + 
       0.25^senf wfr^senf)))^2 + (-63.077 + (
    7 rin)/((7 + kmn) (1 + 0.5^senc wcr^senc) (1 + 
       0.5^senf wfr^senf)))^2 + (-147.962 + (
    16 rin)/((16 + kmn) (1 + 0.75^senc wcr^senc) (1 + 
       0.75^senf wfr^senf)))^2
FindMinimum[
 f[rin, kmn, wcr, senc, wfr, senf, dcr, 
  dfr], {{rin, 0}, {kmn, 0}, {wcr, 0}, {senc, 1}, {wfr, 0}, {senf, 
   1}, {dcr, 0}, {dfr, 0}}]

During evaluation of In[110]:= FindMinimum::nrlnum: The function value {58.7515 +1.24773*10^-6 I,64.166 +5.73835*10^-6 I,-302.257+0.0000286716 I,-71.1665+0.000314776 I,-<<19>>+<<22>> I,21.2778 +1.47581*10^-7 I,-11.9125+3.24322*10^-7 I,-126.799+5.43301*10^-7 I} is not a list of real numbers with dimensions {8} at {rin,kmn,wcr,senc,wfr,senf,dcr,dfr} = {43.8887,-0.325894,-0.164521,1.,-0.164521,1.,-0.804443,-0.804443}.

Out[112]= {103366., {rin -> 43.8887, kmn -> -0.325894, 
  wcr -> -0.164521, senc -> 1., wfr -> -0.164521, senf -> 1., 
  dcr -> -0.804443, dfr -> -0.804443}}

If the minimal value would be $0$, it meant the solution of the initial system of equations, As the found minimal values is not $0$, it means only that the function FindMinimum[] did not find the solution of the system of equations. We can only assume that the system doesn't have the solution.

Sure, you may select other initial point to search for other local solutions.

I had posted a reply but it didn't look like it went to you. Posting this so it will notify you

POSTED BY: Josh Wofford
Posted 8 years ago

Perhaps there is no solution in the reals.

Could you use NMinimize and Norm or something similar and test this?

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard