All functions support the methods documented below, inherited from
- class sympy.core.function.Function(*args)
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
- Trigonometric Functions
- Trigonometric Inverses
- Hyperbolic Functions
- Hyperbolic Inverses
- Singularity Function
- Gamma, Beta and related Functions
- Error Functions and Fresnel Integrals
- Exponential, Logarithmic and Trigonometric Integrals
- Bessel Type Functions
- Airy Functions
- Riemann Zeta and Related Functions
- Hypergeometric Functions
- Elliptic integrals
- Mathieu Functions
- Orthogonal Polynomials
- Spherical Harmonics
- Tensor Functions