Thanks for the corrections to my stupid mistakes! I should have known
something was wrong.
Re:
freeof(2,1/x^2) => false
freeof(-2,1/x^2) => true
freeof(-x,f(-x)) => false
freeof(-x,f(- -x)) => true
my inclination would be to disallow numbers in the first argument (and
expressions other than simple subscripts) as not very well-defined or
useful.
> I don't know if it is possible to turn the simplifier off when evaluating freeof or if this would cause trouble then.
By the time freeof "sees" the argument, it has already been
simplified, which is correct and reasonable behavior. Do you really
want freeof(x,x-x) to be false but (ex: x-x, freeof(x,ex)) to be true
(referential transparency)? Perhaps you are thinking of part's
behavior (using nformat), where part(1/x^2,2,2) => 2 ? I do not think
that is useful behavior for freeof; and it has very significant
overhead.
-s