To get all variables from a sympy expression, one can call .free_symbols
on the expression. I would like to retrieve all functions used in an expression. For example, from y
in
from sympy import *
f = Function('f')
g = Function('g')
x = Symbol('x')
y = f(x) + 2*g(x)
I'd like to get f
and g
.
Any hints?