I’m searching for a library that will let me manipulate functions with the standard operators (*, -, *, /, etc.).
Lets suppose you have a function f(x) = x ** 2 and g(x) = x + 2. I’d like to be able to write f * g and get a new functor that is essentialy x ** 2 * (x + 2) or f(g) and get (x + 2) ** 2.
I know this is not too hard to implement, you’ll just have to make a Functor class and overload it’s __call__ function, but I’m hoping there is a 3rd party library for it.
I’m not trying to use this for anything heavyweight just for learning. Thanks for the help.
Sympy should do what you want.