Functions#
- class pybamm.Function(function: Callable, *children: Symbol, name: str | None = None, derivative: str | None = 'autograd', differentiated_function: Callable | None = None)[source]#
A node in the expression tree representing an arbitrary function.
- Parameters:
function (method) – A function can have 0 or many inputs. If no inputs are given, self.evaluate() simply returns func(). Otherwise, self.evaluate(t, y, u) returns func(child0.evaluate(t, y, u), child1.evaluate(t, y, u), etc).
children (
pybamm.Symbol
) – The children nodes to apply the function toderivative (str, optional) – Which derivative to use when differentiating (“autograd” or “derivative”). Default is “autograd”.
differentiated_function (method, optional) – The function which was differentiated to obtain this one. Default is None.
Extends:
pybamm.expression_tree.symbol.Symbol
- diff(variable: Symbol)[source]#
See
pybamm.Symbol.diff()
.
- evaluate(t: float | None = None, y: ndarray | None = None, y_dot: ndarray | None = None, inputs: dict | str | None = None)[source]#
- class pybamm.SpecificFunction(function: Callable, child: Symbol)[source]#
Parent class for the specific functions, which implement their own diff operators directly.
- Parameters:
function (method) – Function to be applied to child
child (
pybamm.Symbol
) – The child to apply the function to
- pybamm.max(child: Symbol)[source]#
Returns max function of child. Not to be confused with
pybamm.maximum()
, which returns the larger of two objects.
- pybamm.min(child: Symbol)[source]#
Returns min function of child. Not to be confused with
pybamm.minimum()
, which returns the smaller of two objects.