Functions#
- class pybamm.Function(function: Callable, *children: Symbol, name: str | None = None, 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 todifferentiated_function (method, optional) – The function which was differentiated to obtain this one. Default is None.
Extends:
pybamm.expression_tree.symbol.Symbol
- create_copy(new_children: list[Symbol] | None = None, perform_simplifications: bool = True)[source]#
See
pybamm.Symbol.new_copy()
.
- 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.
- pybamm.normal_pdf(x: Symbol, mu: Symbol | float, sigma: Symbol | float)[source]#
Returns the normal probability density function at x.
- Parameters:
x (pybamm.Symbol) – The value at which to evaluate the normal distribution
mu (pybamm.Symbol or float) – The mean of the normal distribution
sigma (pybamm.Symbol or float) – The standard deviation of the normal distribution
- Returns:
The value of the normal distribution at x
- Return type:
- pybamm.normal_cdf(x: Symbol, mu: Symbol | float, sigma: Symbol | float)[source]#
Returns the normal cumulative distribution function at x.
- Parameters:
x (pybamm.Symbol) – The value at which to evaluate the normal distribution
mu (pybamm.Symbol or float) – The mean of the normal distribution
sigma (pybamm.Symbol or float) – The standard deviation of the normal distribution
- Returns:
The value of the normal distribution at x
- Return type: