Group Abstract Group Abstract

Message Boards Message Boards

Table of NSolve (and Solve) solutions creates extra unknown answers

POSTED BY: Ilan Riess
6 Replies
POSTED BY: Ilan Riess

Thank you. Here it is:

k2 = 7.25941*10^-11
k1 = 3.7008*10^-10
kx = 3.15569*10^-8
kvv = 0.152304
vmax = 0.32
t6 = Table[p2 /. NSolve[{vt*n^2 == (4*(vmax - vt)^3*k2 + 2*n*(vmax - vt)^2*k1 + 
         n^2*(vmax - vt)*kx + p2*2*(vmax - vt)*kx^2*n^2/kvv)*p2, 
     n^3 == (8*(vmax - vt)^3*k2 + 2*n*(vmax - vt)^2*k1)*p2, 
     vt == 10^lvt}, {p2, n, vt}], {lvt, -4, -0.5, 0.05}]

Out[8]   {{-0.0038515 - 0.0304568 I, -0.0038515 + 0.0304568 I, 
  0.000199833}, {-0.00386354 - 0.0304558 I, -0.00386354 + 0.0304558 I,
   0.000224192}, {-0.00387704 - 0.0304546 I, -0.00387704 + 
   0.0304546 I, 
  0.000251516}, {-0.00389219 - 0.0304534 I, -0.00389219 + 0.0304534 I,
   0.000282167}, {-0.00390917 - 0.030452 I, -0.00390917 + 0.030452 I, 
  0.000316546}, {-0.00392823 - 0.0304504 I, -0.00392823 + 0.0304504 I,
   0.000355107}, {-0.0039496 - 0.0304488 I, -0.0039496 + 0.0304488 I, 
  0.000398354}, {-0.00397356 - 0.0304469 I, -0.00397356 + 0.0304469 I,
   0.000446855},  etc....

t6//TableForm

Out[9]  {{-3.49461*10^6, -2.44888*10^6 - 1.74943*10^6 I, -2.44888*10^6 + 
   1.74943*10^6 I, 594461. - 821951. I, 594461. + 821951. I, 0.419391,
   0., 0.}, {-3.49528*10^6, -2.44938*10^6 - 1.74884*10^6 I, -2.44938*10^6 + 1.74884*10^6 I, 
  595306. - 821454. I, 595306. + 821454. I, 0.592224, 0., 0.}, {-3.49604*10^6, -2.44995*10^6 - 
   1.74817*10^6 I, -2.44995*10^6 + 1.74817*10^6 I,  596254. - 820897. I, 596254. + 820897. I, 0.836248, 0., 
  0.}, {-3.49689*10^6, -2.45059*10^6 -  1.74742*10^6 I, -2.45059*10^6 + 1.74742*10^6 I, 
  597319. - 820274. I, 597319. + 820274. I, 1.18076, 0., 0.},  etc...
POSTED BY: Ilan Riess

What do you mean by "unidentified"? You have a system of nonlinear polynomial equations, you can expect multiple solutions. In every row you get different solutions for a given value of lvt, I am not sure in what order. I supplied numerical values for vtn and p22:

k2 = 7.25941*10^-11; k1 = 3.7008*10^-10; kx = 
 3.15569*10^-8; kvv = 0.152304; vmax = 0.32; vtn = 1; p22 = 1; t6 = 
 Table[p2 /. 
   NSolve[{vtn^2 == (4 (vmax - vt)^3 k2 + 2 n (vmax - vt)^2 k1 + 
         n^2 (vmax - vt) kx + p22 (vmax - vt) kx^2 n^2/kvv) p2, 
     n^3 == (8 (vmax - vt)^3 k2 + 2 n (vmax - vt)^2 k1)*p2, 
     vt == 10^lvt}, {p2, n, vt}], {lvt, -4, -0.5, 0.05}]

Perhaps you are looking for real solutions only? If so, give NSolve the option Reals.

POSTED BY: Gianluca Gorni

Thank you. This answers my question.

POSTED BY: Ilan Riess

If you accept only positive solution, you can add the condition to the equations:

t6 = Table[
  p2 /. NSolve[{vt*
       n^2 == (4*(vmax - vt)^3*k2 + 2*n*(vmax - vt)^2*k1 +
         n^2*(vmax - vt)*kx + p2*2*(vmax - vt)*kx^2*n^2/kvv)*p2,
     n^3 == (8*(vmax - vt)^3*k2 + 2*n*(vmax - vt)^2*k1)*p2,
     vt == 10^lvt,
     p2 > 0},
    {p2, n, vt}],
  {lvt, -4, -0.5, 0.05}]
POSTED BY: Gianluca Gorni
Posted 1 year ago

There are no special hidden meanings to the result of NSolve. But if you want help understanding the results you're going to need to provide us with the actual example.

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