SelectNotFree2[expr, a, b, ...]
is similar to SelectNotFree
but it also differs from the latter in several respects.
If expr
is a list, SelectNotFree2
behaves exactly the same way as SelectNotFree
.
If expr
is not a list, SelectNotFree2
first expands the expression w.r.t. the arguments via Expand2
.
Furthermore, SelectNotFree2[a,b]
returns 0
. This differs from the behavior of SelectFree
but is consistent with the naive expectations when applying the function to a sum of terms.
Overview, FreeQ2, SelectFree, SelectNotFree, SelectFree2.
Note the difference between SelectNotFree and SelectNotFree2
[(a + b) c, b] SelectNotFree
a+b
[(a + b) c, b] SelectNotFree2
b c
[a, b] SelectNotFree
1
[a, b] SelectNotFree2
0
Here the behavior is identical
[a, a] SelectNotFree
a
[a, a] SelectNotFree2
a
When there are hidden zeros, SelectNotFree2
obviously works better
[(a - b + c)^2 - (a^2 - 2 a b + 2 a c + b^2 - 2 b c + c^2), a] SelectNotFree
-a^2+(a-b+c)^2+2 a b-2 a c
[(a - b + c)^2 - (a^2 - 2 a b + 2 a c + b^2 - 2 b c + c^2), a] SelectNotFree2
0