A symbol for an undefined function is created by giving the symbols command an extra class argument:
f, g = symbols('f g', cls=Function)
The same can be achieved by using the constructor Function :
f = Function('f')
g = Function('g')
With undefined functions, we can evaluate the general rules of calculus.
For example, let's evaluate the following expression:
This is symbolically computed in Python by using the following command:
x = symbols('x')
f, g = symbols('f g', cls=Function)
diff(f(x*g(x)),x)
When executed, the previous code returns the following as output:
This example shows how the product rule and the chain rule were applied.
We can even use an undefined function as a function in several variables, for example:
x = symbols('x:3')
f(*x)
which returns the following output:
Note the use of the star operator to unpack a tuple to form f with arguments;&...