Re: Problem NSolve
- To: mathgroup at smc.vnet.net
- Subject: [mg90672] Re: Problem NSolve
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Fri, 18 Jul 2008 04:03:57 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g5n45f$sb8$1@smc.vnet.net>
Jorge wrote:
> As soon as I have programmed the problem to resolving, 23 equations with 23 variables, I use the function Nsolve, but the program returns to me the following message of mistake
>
> General::ivar: 0 is not a valid variable. >>
One -- possibly more -- variable has been initialized by mistake to zero
prior to call Solve[].
In[1]:= x = 0;
eqns = {a x + y == 7, b x - y == 1};
vars = {x, y};
Solve[eqns, vars]
During evaluation of In[1]:= General::ivar:0 is not a valid variable. >>
Out[4]= Solve[{y == 7, -y == 1}, {0, y}]
In[5]:= x =.; (* This erase any value hold by the variable x. *)
eqns = {a x + y == 7, b x - y == 1};
vars = {x, y};
Solve[eqns, vars]
Out[8]=
8 a - 7 b
{{x -> -----, y -> -(-------)}}
a + b a + b
> I have programmed my problem of the following form:
>
> ecu{lhs1==0,lhs2=0,...,lhs23}
> sol=Nsolve[ecu{var1,var2,...,var23}]
Pay close attention to the syntax: A single equal sign (=) is an
*assignment*, whereas a double equal sign (==) is s *test for equality*.
Regards,
-- Jean-Marc