If you look at the first example of FindFormula, why is the result Mathematica produces showing an Abs?
Table[{x, N[x Sin[x]]}, {x, 0, 4, .3}]
FindFormula[%, x]
The result on the web page is
$$1. x \sin(x)$$
However, when I run the example on V12.0.0. on Windows 10, it returns the result
$$1. ~abs (x) ~\sin(x)$$
All of the $x$ values are positive, so why is MMA adding the abs to the result?
It is as if MMA is figuring how to go back in time, but that is odd given that that is not the data set.
Update
If I kill my MMA session and run this again, it produces the expected result. However, if I rerun the FindFormula command, the Abs results shows up again and continuously shows that same result after re-entering the data and re-running the command.
FindFormula
has no way of knowing what you anticipate or consider desired unless you clarify with its options. As it generates likely formulas, it looks for the best fit within the allowed search time. For your data,{x Sin[x], 1.` x Sin[x], Abs[x] Sin[x], x Sin[Abs[x]]}
are all equivalent (i.e.,Simplify[Equal @@ {x Sin[x], 1.` x Sin[x], Abs[x] Sin[x], x Sin[Abs[x]]}, x >= 0]
evaluates toTrue
) and would provide identical fits. It likely returns the first of these formulas tried which appears to be determined by the random seeding. $\endgroup$