Say I have a system of polynomial equations in the variables x[1],...,x[n]. Sometimes want to make such equations numerical (as in: the coefficients become floats) by applying N. What happens, though, is that the indices of my variables also get converted to floats, e.g.:
(*Input*)
N[ x[1]^2 == x[2] ]
(Output)
x[1.]^2 == x[2.]
Question: Is there an elegant method to make polynomial equations numerical without affecting indexed variables. Note that in the above example the square does not get converted to a float and I would like to keep it that way.
SetAttributes[x, NHoldAll]and nowN[x[1]]returnsx[1]btw, these are called indexed variables in Mathematica. – Nasser Nov 24 '21 at 16:422 x[1]^2 == 3 x[2] /. n_Integer :> N[n] /. x[n_] -> x[Round[n]]– Daniel Huber Nov 24 '21 at 16:55