# Error: "ReplaceAll: ... is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing." when solving a root

I have this code:

\[Alpha]=0.86;
\[Beta]=0.6;
g=0.0005;
p[x_,y_,t_,ta_,f_,fa_,u_]:=(((\[Alpha]^\[Alpha])((1-\[Alpha])^(1-\[Alpha])) (y-(t+ta)*x-(f+fa)))/u)^(1/(1-\[Alpha]));
r[x_,y_,t_,ta_,f_,fa_,u_]:=(p[x,y,t,ta,f,fa,u](g))((1/(p[x,y,t,ta,f,fa,u](\[Beta])(g)))^(\[Beta]/(\[Beta]-1)))-1((1/(p[x,y,t,ta,f,fa,u](\[Beta])(g)))^(1/(\[Beta]-1)));

Table[

y = 70000;
t = 600;
f = 0;
ta = 0;
fa = 0;
ra = 45000;

Lu[u_] := (solution =
FindRoot[{r[x, y, t, ta, f, fa, u] - ra == 0}, {xbar, 10},
AccuracyGoal -> 1]; xbar /. solution);]


There is more code after this inside the table function, but the FindRoot part gives me this error:

"ReplaceAll::reps: {FindRoot[{r[x,y,t,ta,f,fa,3000]-ra==0},{xbar,10},AccuracyGoal->1]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing."

Any help on solving this would be greatly appreciated.

• [Alpha] is not defined. Nov 4, 2021 at 20:12
• Instead of Lu[u_]... try just FindRoot[{r[x,y,t,ta,f,fa,u]-ra==0},{xbar,10},AccuracyGoal->1] with a value for u that makes this fail substituted in there. Exactly what does the result of that look like? Is that something in exactly the correct form that will make sense when you try to use that with /. ? The more usual form is Lu[u_]:=xbar/.FindRoot[...] Is there a good reason you are not doing that?
– Bill
Nov 4, 2021 at 20:13
• If I just write that, it treats it as text Nov 4, 2021 at 20:31
• @Bill There is a good reason, becayse Lu[u_] is being used in another function later on Nov 5, 2021 at 12:30
• I am trying to tell you how to find and fix the error you are getting so you can later get the solution you want. You reposted the same question and people told you to do the same thing that I did.
– Bill
Nov 5, 2021 at 14:49