Here's a similar question as the the preceding question with the same title, but this time with vectors, which I need to use. I followed the suggestion in the answer the the previous question, but it yields the same error. I just don't understand why functions in Mathematica behave the way they do.
aVec = {a[1], a[2]};
bVec = {b[1]};
y[aVec_, bVec_] = bVec[[1]]*x^2 - aVec[[1]] - aVec[[2]]
g[aVec_, bVec_] := x /. FindRoot[y[aVec, bVec] == 0, {x, 1}]
g[{1, 2}, {1}]
During evaluation of In[5]:= FindRoot::nlnum: The function value {-1. a[1.]-1. a[2.]+1. b[1.]} is not a list of numbers with dimensions {1} at {x} = {1.}. >>
During evaluation of In[5]:= ReplaceAll::reps: {FindRoot[y[{1,2},{1}]==0,{x,1}]} is neither a list of replacement rules nor a valid dispatch table, and so cannot be used for replacing. >>
(* x /. FindRoot[y[{1, 2}, {1}] == 0, {x, 1}] *)
advanced help
. The same is true for editing. Also, be sure to readTour
underhelp
at the top of the page. $\endgroup$