       Re: FindRoot::nlnum error message for non-linear system of equations

• To: mathgroup at smc.vnet.net
• Subject: [mg57058] Re: [mg57042] FindRoot::nlnum error message for non-linear system of equations
• From: DrBob <drbob at bigfoot.com>
• Date: Sat, 14 May 2005 04:57:56 -0400 (EDT)
• References: <200505130244.WAA23978@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```You don't have a value for e4. To narrow it down to that, I copied appropriate elements from your FindRoot statement to get the following:

expr = {m14 -
m11 - ro*v3*A3 == 0, m11 + m23 - m21 - m24 - ro*v1*A1 ==
0, m24 + m33 + m42 - m31 - ro*v2*A2 == 0, m21 + m31 - m14 - m44 - m51 -
m61 + ro*v1*A1 + ro*v2*A2 + ro*v3*A3 - ro*v4*A4 - ro*
v5*A5 - ro*v6*A6 == 0, m44 +
m51 + m54 - m53 + ro*v4*A4 + ro*v7*A7 == 0, m61 + m64 - m54 - m63 + ro*
v6*A6 - ro*v7*A7 == 0, m14 - ro*K14*(pow - p1)^n14 == 0, m23 - ro*
K23*(pow - p2)^n23 == 0, m33 - ro*K33*(pow - p3)^n33 == 0, m11 - ro*
K11*(p1 - p2)^n11 == 0, m24 - ro*K24*(p2 - p3)^n24 == 0,
m21 - ro*K21*(p2 - p4)^n21 == 0, m42 - ro*K42*(p4 -
p3)^n42 == 0, m31 - ro*K31*(p3 - p4)^n31 == 0, m44 - ro*K44*(p4 -
p5)^n44 == 0, m83 - ro*K83*(p4 -
pos)^n83 == 0, m51 - ro*K51*(p4 - p5)^n51 == 0, m61 - ro*K61*(p4 -
p6)^n61 == 0, m64 - ro*K64*(pos - p6)^n64 == 0, m54 - ro*K54*(p6 -
p5)^n54 == 0, m63 - ro*K63*(p6 - pol)^n63 == 0, m53 - ro*K53*(p5 -
pol)^n53 == 0, p2*v1*A1 - 0.5*ro*(v1^3)*A1*ev1 - p41*v1*A1 == 0, p3*
v2*A2 - 0.5*ro*(v2^3)*A2*ev2 - p42*v2*A2 == 0, p1*v3*
A3 - 0.5*ro*(v3^3)*A3*ev3 - p43*v3*A3 == 0, p44*v4*A4 - 0.5*
ro*(v4^3)*A4*ev4 - p54*v4*A4 == 0, p45*v5*A5 - 0.5*ro*(v5^3)*A5*
ev5 - pos*v5*A5 == 0, p46*v6*A6 - 0.5*ro*(v6^3)*A6*ev6 - p66*v6*A6 == 0,
p67*v7*A7 - 0.5*ro*(v7^3)*A7*
ev7 - p57*v7*A7 == 0, (p41*v1*A1 + 0.5*ro*(v1^3)*A1) + (p42*v2*A2 + 0.5*
ro*(v2^3)*A2) + (p43*v3*A3 +
0.5*ro*(v3^3)*A3) - (p45*v5*A5 + 0.5*ro*(v5^3)*A5) - (p46*v6*A6 + 0.5*
ro*(v6^3)*A6) - (p44*v4*A4 + 0.5*
ro*(v4^3)*A4) == 0, p41 - p42 == 0, p41 - p43 == 0, p41 - p44 == 0,
p41 - p45 == 0, p4 - p41 == 0, p5 - p54 == 0, p5 - p57 == 0, p6 -
p66 == 0, p6 - p67 == 0};
initial = {{m14, 0.0125}, {m23, 0.0106}, {m33, 0.0233}, {m11,
0.001}, {m24, 0.002}, {m21, 0.003}, {m42,
0.004}, {m31, 0.005}, {m44, 0.006}, {m83, 0.007}, {m51, 0.008}, {
m61, 0.009}, {m64, 0.01}, {
m54, 0.011}, {m63, 0.0103}, {m53, 0.0186}, {v1,
0.90}, {v2, 0.63}, {v3, 0.60}, {
v4, 0.33}, {v5, 0.54}, {v6, 0.52}, {v7, 0.22}, {p1, 14.}, {p2,
12.}, {p3, 10.}, {p4, 0.}, {p41, 0.1}, {p42, 0.2}, {p43, 0.3}, {
p44, 0.4}, {p45, 0.5}, {p46,
0.6}, {p5, -20.}, {p54, -20.1}, {p57, -20.2}, {p6, -30.}, {
p66, -30.1}, {p67, -30.2}};

With that, your FindRoot is equivalent to this one:

results = FindRoot[expr, Sequence @@ initial // Evaluate];

ColumnForm[results]

It gives exactly the same error message, too.

Here are the variables used in your equations but not initialized, the variables with initial values in FindRoot, and the difference (computed AFTER your initialization statements for ro, A1, ..., pos):

allVar=Union@Cases[expr,_Symbol,Infinity];
searchVar=Union@Cases[initial,_Symbol,Infinity];
missing=Complement[allVar,searchVar]

{ev4}

Bobby

On Thu, 12 May 2005 22:44:26 -0400 (EDT), <daniel.chung at yale.edu> wrote:

> Hello,
> I have recently started using Mathematica and I've been using it to
> solve non-linear systems of equations via the FindRoot command.  I am
> using it to solve approximations of building airflow and when I had a
> relatively small system of 6 equations and 6 unknowns I had no problem
> getting it to solve for the unknowns. More recently though I have been
> trying to solve a system of 39 equations with 39 unknowns and I've been
> running into error messages. I've tried changing the format of the
> start values to include a range but I still get a FindRoot::nlnum error
> message.  Any help would be appreciated.
> -Daniel Chung, daniel.chung at yale.edu
>
> Here is the text for the input followed by the generated error message:
>
> Clear[
>     (* Variables - 39 unknowns  *)
>             m14, m23, m33, m11, m24, m21, m42,m31, m44, m83, m51, m61,
>         m64, m54, m63, m53,
>             v1,v2,v3,v4,v5,v6, v7,
>             p1,p2,p3,p4,p41, p42, p43, p44, p45, p46, p5, p54, p57,
>         p6, p66, p67
>      ];
> (* Constants  *)
>         ro = 1.2;
>         A1= 0.0099; A2 = 0.0300; A3 = 0.0200; A4 = 0.0250;
>         A5 =0.0300; A6 =0.0300; A7 = 0.0250;
>         ev1 = 2.4;  ev2 = 2.4; ev3 =2.4; ev5 =2.4; ev6 =2.4; ev7 = 2.4;
>         K14 = 0.00373;  K23 = 0.00328; K33 = 0.00319;  K53 = 0.00310;
>         K63 = 0.00152;  K83 = 0.00190;  K11 = 0.00389;
>         K21 = 0.00562;  K24 = 0.0000472;  K31 = 0.00415;
>         K42 = 0.000825;
>         K44 = 0.00157;  K51 = 0.00418;  K54 = 0.00175;
>         K61 = 0.000344;   K64 = 0.000553;
>         n14 = 0.58;  n23 = 0.60; n33 = 0.58;  n53 = 0.54;  n63 = 0.56;
>         n83 = 0.59; n11 = 0.90;        n21 = 0.78;  n24 = 0.87;  n31 =
> 0.59;
>         n42 = 0.65;  n44 = 0.51;  n51 = 0.76; n54 = 0.64; n61 = 0.81;
>         n64 = 0.69;
> (* Boundary Conditions  *)
>         pow = 16;
>         pol = -81;
>         pos = -2.8;
> results=FindRoot [
>     { m14-m11-ro*v3*A3 ==0,
>       m11+m23-m21-m24-ro*v1*A1==0,
>       m24+m33+m42-m31-ro*v2*A2==0,
>       m21+m31-m14-m44-m51-m61+ro*v1*A1+ro*v2*A2+ro*v3*A3-ro*v4*A4-
>         ro*v5*A5-ro*v6*A6==0,
>       m44+m51+m54-m53+ro*v4*A4+ro*v7*A7==0,
>       m61+m64-m54-m63+ro*v6*A6-ro*v7*A7==0,
>       m14-ro*K14*(pow-p1)^n14 == 0,
>       m23-ro*K23*(pow-p2)^n23 == 0,
>       m33-ro*K33*(pow-p3)^n33 == 0,
>       m11-ro*K11*(p1-p2)^n11 == 0,
>       m24-ro*K24*(p2-p3)^n24 == 0,
>       m21-ro*K21*(p2-p4)^n21 == 0,
>       m42-ro*K42*(p4-p3)^n42 == 0,
>       m31-ro*K31*(p3-p4)^n31 == 0,
>       m44-ro*K44*(p4-p5)^n44 == 0,
>       m83-ro*K83*(p4-pos)^n83 == 0,
>       m51-ro*K51*(p4-p5)^n51 == 0,
>       m61-ro*K61*(p4-p6)^n61 == 0,
>       m64-ro*K64*(pos-p6)^n64 == 0,
>       m54-ro*K54*(p6-p5)^n54 == 0,
>       m63-ro*K63*(p6-pol)^n63 == 0,
>       m53-ro*K53*(p5-pol)^n53 == 0,
>       p2*v1*A1-0.5*ro*(v1^3)*A1*ev1-p41*v1*A1 == 0,
>       p3*v2*A2-0.5*ro*(v2^3)*A2*ev2-p42*v2*A2 == 0,
>       p1*v3*A3-0.5*ro*(v3^3)*A3*ev3-p43*v3*A3 == 0,
>       p44*v4*A4-0.5*ro*(v4^3)*A4*ev4-p54*v4*A4 == 0,
>       p45*v5*A5-0.5*ro*(v5^3)*A5*ev5-pos*v5*A5 == 0,
>       p46*v6*A6-0.5*ro*(v6^3)*A6*ev6-p66*v6*A6 == 0,
>       p67*v7*A7-0.5*ro*(v7^3)*A7*ev7-p57*v7*A7 == 0,
>       (p41*v1*A1+0.5*ro*(v1^3)*A1)+(p42*v2*A2+0.5*ro*(v2^3)*A2)+
>                 (p43*v3*A3+0.5*ro*(v3^3)*A3) -
>                 (p45*v5*A5+0.5*ro*(v5^3)*A5) -
>                 (p46*v6*A6+0.5*ro*(v6^3)*A6) -
>                 (p44*v4*A4+0.5*ro*(v4^3)*A4) == 0,
>       p41-p42 == 0,
>       p41-p43 == 0,
>       p41-p44 ==0,
>       p41-p45 == 0,
>       p4-p41 == 0,
>       p5-p54 == 0,
>       p5-p57 == 0,
>       p6-p66 == 0,
>       p6-p67 == 0
>     },
>         (* Initial Guesses  *)
>              {m14,0.0125}, {m23,0.0106}, {m33,0.0233}, {m11,0.001},
>         {m24,0.002}, {m21,0.003}, {m42,0.004}, {m31,0.005}, {m44,0.006},
>          {m83,0.007}, {m51,0.008}, {m61,0.009}, {m64,0.01}, {m54,0.011},
>         {m63,0.0103}, {m53,0.0186}, {v1,0.90},{v2,0.63},{v3,0.60},
>         {v4,0.33},{v5,0.54},{v6,0.52}, {v7,0.22},{p1,14.},{p2,12.},
>         {p3,10.},{p4,0.},{p41,0.1},{p42,0.2},{p43,0.3},{p44,0.4},
>         {p45,0.5},{p46,0.6},{p5,-20.},{p54,-20.1},{p57,-20.2},{p6,-30.},
>         {p66,-30.1},{p67,-30.2}
>     ];
>
> ColumnForm[results]
>
> FindRoot::nlnum: The function value {-0.0029, -0.004092, 0.00162, -
> 0.027788, 0.0229, 0.00982, 0.00580905, <<28>>,
> 0.1, 0.2, 0.1, 0.2} is not a list of numbers with dimensions {39} at
> {m14, m23, m33, m11, m24, m21, m42, m31, m44, m83, m51, m61, <<21>>,
> p5, p54, p57, p6, p66, p67} =
> {0.0125, 0.0106, 0.0233, 0.001, 0.002, 0.003, 0.004, 0.005, <<27>>, -
> 20.2, -30., -30.1, -30.2}. More..
>
>
>
>

--
DrBob at bigfoot.com

```

• Prev by Date: Re: Re: Representation and Simulation of Dynamic Systems
• Next by Date: Re: Hold problems with FindRoot
• Previous by thread: Re: FindRoot::nlnum error message for non-linear system of equations
• Next by thread: How to call a remote Kernal?