# FindRoot Infinite expression 1/0 encountered error

I have 1 equation in 1 variable, which when I use Plot, looks like this:

i = 9
Plot[ A1[[i]]*(92)^(-1.7049946543060777) + B1[[i]]*(92)^(2.9716613209727445)-
c1[[i]]*80/0.057 + 65.89077138196083, {H1S, 125, 135}, AxesOrigin -> {125, 0}]


Where,

 A1[[9]]= -0.097752 H1S^2.70499-1.74292 H1S^4.67666 (-((0.213828 (-((1.70499
(106.316-  0.166667 H1S))/H1S^2.70499)+0.166667/H1S^1.70499))/H1S^0.266667)
+(511.685 (-(0.0311244-80/H1S^1.70499) (685034./H1S^1.70499-0.000448489 H1S^2.97166)
+(0.0358792-71./H1S^1.70499) (877653./H1S^1.70499-0.000389055 H1S^2.97166)))/
(H1S^2.97166 (-(-0.662221+1702.13/H1S^1.70499)(685034./H1S^1.70499
-0.000448489 H1S^2.97166)
+(-0.763386+1702.13/H1S^1.70499) (877653./H1S^1.70499-0.000389055 H1S^2.97166))));

B1[[9]]= (0.213828 (-((1.70499 (106.316-0.166667 H1S))/H1S^2.70499)
+0.166667/H1S^1.70499))/H1S^0.266667-(511.685 (-(0.0311244-80/H1S^1.70499)
(685034./H1S^1.70499-0.000448489 H1S^2.97166)+(0.0358792-71./H1S^1.70499)
(877653./H1S^1.70499-0.000389055 H1S^2.97166)))/(H1S^2.97166
(-(-0.662221+1702.13/H1S^1.70499) (685034./H1S^1.70499-0.000448489 H1S^2.97166)
+(-0.763386+1702.13/H1S^1.70499) (877653./H1S^1.70499-0.000389055 H1S^2.97166)));

c1[[9]]= -((-(0.0311244-80/H1S^1.70499) (685034./H1S^1.70499-0.000448489 H1S^2.97166)
+(0.0358792-71./H1S^1.70499) (877653./H1S^1.70499-0.000389055 H1S^2.97166))/
(-(-0.662221+1702.13/H1S^1.70499) (685034./H1S^1.70499-0.000448489 H1S^2.97166)
+(-0.763386+1702.13/H1S^1.70499) (877653./H1S^1.70499-0.000389055 H1S^2.97166)));


But when I use FindRoot to get the same solution,

i = 9;
FindRoot[  A1[[i]]*(92)^(-1.7049946543060777) + B1[[i]]*(92)^(2.9716613209727445)
- c1[[i]]*80/0.057 + 65.89077138196083 == 0, {H1S, 125, 120, 135}]


I get two "things" and the messages :

• Infinite expression 1/0 encountered
• Further output of Power::Infy will be supressed during this this calculation

and then it spits out what looks like the right solution if Plot is to be trusted

{H1S -> 128.907}


What am I doing wrong and how can solve this without the error messages? If the expressions was going to Infinity then it should show up on the Plot but the Plot looks well behaved. Perhaps some derivative is going to infinity during the FindRoot process. I have tried other methods specified in the "More Information" : "Brent" and "Secant" but am getting the same errors.

-

Defining your functions like you did

A1[[9]] = -0.097752 H1S^2.70499 - ... + (-0.763386 + 1702.13/H1S^1.70499)
(877653./H1S^1.70499 - 0.000389055 H1S^2.97166))


one gets :

Set::noval: Symbol A1 in part assignment does not have an immediate value. >>


This issue comes from an the fact that you use an immediate assignment to A1[[9]] see (Part) while A1 hasn't been defined. You could have assigned to A1[[9]] if you had evaluated e.g.

A1 = Table[0, {9}];


then you can do e.g.

A1[[9]] = 1;
A1

 {0, 0, 0, 0, 0, 0, 0, 0, 1}


A more appropriate way is to define a function using SetDelayed to A1[9, H1S_] i.e. lhs := rhs delayed assignment where rhs is reevaluated every time it is used, i.e defining A1, B1, c1 , use e.g. :

A1[9, H1S_] :=  formula for A1[[9]]
B1[9, H1S_] :=  formula for B1[[9]]
c1[9, H1S_] :=  formula for c1[[9]]


then FindRoot returns the expected result without any (error) messages generated :

FindRoot[ A1[9, H1S]*(92)^(-1.7049946543060777) + B1[9, H1S]*(92)^(2.9716613209727445)
-c1[9, H1S]*80/0.057 + 65.89077138196083 == 0, {H1S, 125, 120, 135}]

{H1S -> 128.903}


You can plot the graph of this function the same way :

Plot[ A1[9, H1S]*(92)^(-1.7049946543060777) + B1[9, H1S]*(92)^(2.9716613209727445)
-c1[9, H1S]*80/0.057 + 65.89077138196083, {H1S, 125, 135}, AxesOrigin -> {125, 0}]

-
Hi Artes, Thanks for responding. The thing is that I have 10 variables, $\{x_a,..,x_j\}$ and for each of those variables I have say 60 pieces of data. So $x_a = \{xa_1,xa_2,..,xa_{60}\}$. Now $A1 = f(x_a,..,x_j,H1S)$ and same for B1 and c1. Now for each 10-tuple of data from the x's , I want to find a H1S that solves my non-linear equation and ultimately I want to wind up with 60 values of H1S. How should I define my A1s etc so I can Import the data on $\{x_a,..,x_j\}$ and just do all my FindRoots in a Table and get 60 values of H1S? –  Amatya Sep 9 '12 at 0:18
contd.. In my original question, I simply typed in the values of $x_{a9},..,x_{j9}$ when $i=9$ so it looked like A1, B1 etc were only functions of H1S. –  Amatya Sep 9 '12 at 0:32
@Amatya It seems you could use Array, see e.g. this answer mathematica.stackexchange.com/questions/6669/…, if this is not quite clear for you how to proceed you should better ask another question (more precise) for a detailed answer. It is not so easy to do it in a comment. –  Artes Sep 9 '12 at 0:33
Thanks Artes. I will read that and if I still don't get it then I will ask a separate question about data structures. –  Amatya Sep 9 '12 at 18:56