7

I'd like to define specific partial derivative operators that change based on if the passed expression is a function of, for example, x vs. xi. I'm not finding anything in the documentation on how to code a check for the expressions dependence. My question is, if given some function f[x,y], how can I check the variables that it depends on?

kglr
  • 394,356
  • 18
  • 477
  • 896
mads
  • 73
  • 3

1 Answers1

12

Perhaps Internal`DependsOnQ:

h = f[x, g[y]];
Internal`DependsOnQ[h, #] & /@ {x, y, g[y], w}

{True, True, True, False}

kglr
  • 394,356
  • 18
  • 477
  • 896