All functions support the methods documented below, inherited from
- class sympy.core.function.Function(*args)[source]
Base class for applied mathematical functions.
It also serves as a constructor for undefined function classes.
See the Writing Custom Functions guide for details on how to subclass
Functionand what methods can be defined.
To create an undefined function, pass a string of the function name to
>>> from sympy import Function, Symbol >>> x = Symbol('x') >>> f = Function('f') >>> g = Function('g')(x) >>> f f >>> f(x) f(x) >>> g g(x) >>> f(x).diff(x) Derivative(f(x), x) >>> g.diff(x) Derivative(g(x), x)
Assumptions can be passed to
Functionthe same as with a
Symbol. Alternatively, you can use a
Symbolwith assumptions for the function name and the function will inherit the name and assumptions associated with the
>>> f_real = Function('f', real=True) >>> f_real(x).is_real True >>> f_real_inherit = Function(Symbol('f', real=True)) >>> f_real_inherit(x).is_real True
Note that assumptions on a function are unrelated to the assumptions on the variables it is called on. If you want to add a relationship, subclass
Functionand define custom assumptions handler methods. See the Assumptions section of the Writing Custom Functions guide for more details.
Custom Function Subclasses
The Writing Custom Functions guide has several Complete Examples of how to subclass
Functionto create a custom function.
Returns the method as the 2-tuple (base, exponent).
Returns the first derivative of the function.
- classmethod is_singular(a)[source]
Tests whether the argument is an essential singularity or a branch point, or the functions is non-holomorphic.