Skip to main content
1 of 4
John
  • 700
  • 8
  • 13

Extracting variables

I'm looking for a way to extract a list of variables from an expression, for example with an input like:

Leff= (mc dm^2 + mc/12*(h^2 + 3 R^2) + ma da^2 + ma/12 La^2)/(mc dm + ma da)

I want this output: {mc, dm, ma, da, La, h, R}.

The built-in mathematica function "Variables" can do this but doesn't work with more complex expressions containing trascendental functions, any help would be very appreciated.

John
  • 700
  • 8
  • 13