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.
Introduction. The Python Math Library provides us access to some common math functions and constants in Python, which we can use throughout our code for more complex mathematical computations. The library is a built-in Python module, therefore you don't have to do any installation to use it.
You can find them (at least on linux) in a subfolder of the lib-folder called lib-dynload. The math module is then in a file math.cpython-33m.so (on windows probably with . dll instead of . so ).
The numpy library in Python is most widely used for carrying out mathematical operations that involve matrices.
Sympy should do what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With