Re: problem with numerical values in Solve/NSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg63759] Re: problem with numerical values in Solve/NSolve
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 13 Jan 2006 04:49:00 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <dq53td$abp$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jacob Grose wrote: > Hello, > > I writing a physics simulation and I need to solve a system of 41 equations. However, I am having problems even with a more simple 5x5 matrix. The problem is as follows: If I symbolically solve the matrix m1: > > \!\(\* > TagBox[ > RowBox[{"(", "\[NoBreak]", GridBox[{ > {\(\(-a\) - b - c\), "0", "f", "h", "l"}, > {"0", \(\(-c\) - d - e\), "g", "k", "m"}, > {"a", "c", \(\(-f\) - g\), "0", "0"}, > {"b", "d", "0", \(\(-h\) - k\), "0"}, > {"c", "e", "0", "0", \(\(-l\) - m\)} > }], "\[NoBreak]", ")"}], > Function[ BoxForm`e$, > MatrixForm[ BoxForm`e$]]]\) > > Using the code: > > variables = Array[p, 5]; > evec = Simplify[Solve[m1.variables \[Equal] Table[0, {i, 1, 5}], Array[p, 4]]] > > I get a result. However, if I try to solve for a matrix (m) of the same form but with values substituted for the variables: > > \!\(\* > TagBox[ > RowBox[{"(", "\[NoBreak]", GridBox[{ > {\(-1.870413280501348`*^10\), > "0", "1.7479373054791087`*^8", " > 7.607967609656633`*^9", "2.5605854781972427`*^7"}, > {"0 > ", \(-1.2870235495030115`*^10\), "206293.3885126606`", \ > "8.754725514677356`*^7", "1.3554510956434595`*^10"}, > {"1.747937063721231`*^10", "2.062933885126606`*^7 > ", \(-1.7500002393642354`*^8\), "0", "0"}, > {"1.2247621677975328`*^9", "8.754722967399057`*^9", "0", \ > \(-7.695514864803407`*^9\), "0"}, > {"0.0036402209477187386`", "4.094883188779791`*^9", "0", "0", \ > \(-1.3580116811216568`*^10\)} > }], "\[NoBreak]", ")"}], > Function[ BoxForm`e$, > MatrixForm[ BoxForm`e$]]]\) > > Using the same code: > > variables = Array[p, 5]; > evec = Simplify[Solve[m.variables \[Equal] Table[0, {i, 1, 5}], Array[p, 4]]] > > mathematica returns: {}. > > I tried using Nsolve instead of solve, as well as setting $MaxExtraPrecision = 5000, but it didn't help. Any ideas? > > Thanks, > Jacob > Hi Jacob, According to Mathematica online documentation, "Solve gives {} if there are no possible solutions to the equations." Since some elements of m1 depend on the values of the others, have you checked that the matrix m satisfies these requirements? For example, In[1]:= m1 = {{-a - b - c, 0, f, h, l}, {0, -c - d - e, g, k, m}, {a, c, -f - g, 0, 0}, {b, d, 0, -h - k, 0}, {c, e, 0, 0, -l - m}}; In[2]:= m2 = m1 /. {a -> 1, b -> 2, c -> 3, d -> 4, e -> 5, f -> 6, g -> 7, h -> 8, i -> 9, j -> 10, k -> 11, l -> 12, m -> 13} Out[2]= {{-6, 0, 6, 8, 12}, {0, -12, 7, 11, 13}, {1, 3, -13, 0, 0}, {2, 4, 0, -19, 0}, {3, 5, 0, 0, -25}} In[3]:= variables = Array[p, 5]; evec = Simplify[Solve[m2 . variables == Table[0, {i, 1, 5}], Array[p, 4]]] Out[4]= {{p[1] -> (1535*p[5])/367, p[2] -> (914*p[5])/367, p[3] -> (329*p[5])/367, p[4] -> (354*p[5])/367}} In[5]:= m3 = m2 /. -25 -> 25 Out[5]= {{-6, 0, 6, 8, 12}, {0, -12, 7, 11, 13}, {1, 3, -13, 0, 0}, {2, 4, 0, -19, 0}, {3, 5, 0, 0, 25}} In[6]:= variables = Array[p, 5]; evec = Simplify[Solve[m3 . variables == Table[0, {i, 1, 5}], Array[p, 4]]] Out[7]= {} Best regards, /J.M.