       Re: non linear system with 8 equations

• To: mathgroup at smc.vnet.net
• Subject: [mg117210] Re: [mg117182] non linear system with 8 equations
• From: Ruggero <giurrero at gmail.com>
• Date: Fri, 11 Mar 2011 04:35:51 -0500 (EST)
• References: <201103102103.QAA11337@smc.vnet.net> <4D79634E.6020600@wolfram.com>

```2011/3/11 Daniel Lichtblau <danl at wolfram.com>:
> wiso wrote:
>>
>> I've a non linear system with 8 equation:
>>
>> solution = Solve[{n == ng + nn,
>>     na == eag ng + ean nn,
>>    nb == ebg ng + ebn nn,
>>    nc == ecg ng + ecn nn,
>>    nab == kabg eag ebg ng + kabn ean ebn nn,
>>    nac == kacg eag ecg ng + kacn ean ecn nn,
>>    nbc == kbcg ebg ecg ng + kbcn ebn ecn nn,
>>    nabc == kabcg eag ebg ecg ng + kabcn ean ebn ecn nn }, {ng, n=
n,
>>    eag, ebg, ecg, ean, ebn, ecn}];
>>
>> my pc is cogitating since more than one hour. Is there some method to
>> speed it up? All variables are real, n* are positive integer, e* are
>> real 0<e*<1. k* are known parameters
>
> I doubt Solve will have any chance with this. It would need to compute so=
me
> flavor of GroebnerBasis, and that seems to be a difficult undertaking for
> this system.
>
> If you provide explicit numeric values for those parameters then NSolve w=
ill
> handle it. Below is some code for this. It takes the polynomials, variabl=
es
> of interest, parameter substitutions, and constraints entered as a list.
>
> In:=
> constrainedSolutions[polys_, vars_, paramsubs_, constraints_] :=
>  Module[
>  {solns},
>  solns = NSolve[polys /. paramsubs, vars];
>  Pick[solns, Quiet[And @@@ Release[constraints /. solns]]
>   ]]
>
> Here is your example. I changed the constraints so as to find parameter
> substitutions that might yield a few valid solutions. I show one such run
> below.
>
> In:=
> eqns = {n == ng + nn, na == eag ng + ean nn, nb == ebg ng +=
ebn nn,
>   nc == ecg ng + ecn nn, nab == kabg eag ebg ng + kabn ean ebn =
nn,
>   nac == kacg eag ecg ng + kacn ean ecn nn,
>   nbc == kbcg ebg ecg ng + kbcn ebn ecn nn,
>   nabc == kabcg eag ebg ecg ng + kabcn ean ebn ecn nn};
> polys = Apply[Subtract, eqns, 1];
> vars = {ng, nn, eag, ebg, ecg, ean, ebn, ecn};
> params = Complement[Variables[polys], vars];
> paramsubs = Thread[params -> RandomReal[{-10, 10}, Length[params]]];
> SeedRandom;
> constraints =
>  Flatten[{Map[Hold[Head[#] === Real] && # >= 0 &, {ng, nn}],
>    Map[Hold[Head[#] === Real] && -100 <= # <= 100 &, {eag, =
ebg, ecg,
>      ean, ebn, ecn}]}];
>
> In:= constrainedSolutions[polys, vars, paramsubs, constraints]
>
> Out= {{ng -> 7.30836, nn -> 0.254874, eag -> 0.186697,
>  ebg -> -0.90457, ecg -> -0.0648619, ean -> 2.44744, ebn -> 0.726247,
>   ecn -> -2.57797}, {ng -> 4.8318, nn -> 2.73144, eag -> -0.428736,
>  ebg -> -1.02281, ecg -> -0.46866, ean -> 1.48632, ebn -> -0.543236,
>  ecn -> 0.414936}, {ng -> 1.00957, nn -> 6.55367, eag -> -0.174131,
>  ebg -> -3.37666, ecg -> -4.50395, ean -> 0.330202, ebn -> -0.460332,
>   ecn -> 0.521227}}
>
> If you know a priori that your system will have exactly one solution
> satisfying the constraints, then you might do better using FindRoot with
> appropriate initial values for the variables. But for this particular sys=
tem
> of polynomials NSolve will be fast (again, provided you give numerical
> values up front for the parameters).
>
> Daniel Lichtblau
> Wolfram Research
>

Thank you for the reply (why didn't you post it on the ng?). Well, I
know I can find a numberical solution very quickly, but I need to find
a closed formula, even expressed as root of a n degree polynomial. My
big problem is that every know number is known with an error, as n +/-
delta n, and I want to propagate every error in the solution.

```

• Prev by Date: Re: non linear system with 8 equations
• Next by Date: Re: determining boundary of a region in n-dimensional euclidean space
• Previous by thread: non linear system with 8 equations
• Next by thread: Re: non linear system with 8 equations