Previous topic

Broadcasting Operators

Next topic

Input Parameter

This Page

Functions

class pybamm.Function(function, *children, name=None, derivative='autograd', differentiated_function=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 to

  • derivative (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.Symbol) –

create_copy()[source]

See pybamm.Symbol.new_copy().

diff(variable)[source]

See pybamm.Symbol.diff().

evaluate(t=None, y=None, y_dot=None, inputs=None, known_evals=None)[source]

See pybamm.Symbol.evaluate().

is_constant()[source]

See pybamm.Symbol.is_constant().

property julia_name

Return the name of the equivalent Julia function, for generating Julia code

to_equation()[source]

Convert the node and its subtree into a SymPy equation.

class pybamm.SpecificFunction(function, child)[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

property julia_name

See pybamm.Function.julia_name()

class pybamm.Arcsinh(child)[source]

Arcsinh function.

property julia_name

See pybamm.Function.julia_name()

pybamm.arcsinh(child)[source]

Returns arcsinh function of child.

class pybamm.Arctan(child)[source]

Arctan function.

property julia_name

See pybamm.Function.julia_name()

pybamm.arctan(child)[source]

Returns hyperbolic tan function of child.

class pybamm.Cos(child)[source]

Cosine function.

pybamm.cos(child)[source]

Returns cosine function of child.

class pybamm.Cosh(child)[source]

Hyberbolic cosine function.

pybamm.cosh(child)[source]

Returns hyperbolic cosine function of child.

class pybamm.Erf(child)[source]

Error function.

pybamm.erf(child)[source]

Returns error function of child.

pybamm.erfc(child)[source]

Returns complementary error function of child.

class pybamm.Exp(child)[source]

Exponential function.

pybamm.exp(child)[source]

Returns exponential function of child.

class pybamm.Log(child)[source]

Logarithmic function.

pybamm.log(child, base='e')[source]

Returns logarithmic function of child (any base, default ‘e’).

pybamm.log10(child)[source]

Returns logarithmic function of child, with base 10.

class pybamm.Max(child)[source]

Max function.

property julia_name

See pybamm.Function.julia_name()

pybamm.max(child)[source]

Returns max function of child. Not to be confused with pybamm.maximum(), which returns the larger of two objects.

class pybamm.Min(child)[source]

Min function.

property julia_name

See pybamm.Function.julia_name()

pybamm.min(child)[source]

Returns min function of child. Not to be confused with pybamm.minimum(), which returns the smaller of two objects.

pybamm.sech(child)[source]

Returns hyperbolic sec function of child.

class pybamm.Sin(child)[source]

Sine function.

pybamm.sin(child)[source]

Returns sine function of child.

class pybamm.Sinh(child)[source]

Hyperbolic sine function.

pybamm.sinh(child)[source]

Returns hyperbolic sine function of child.

class pybamm.Sqrt(child)[source]

Square root function.

pybamm.sqrt(child)[source]

Returns square root function of child.

class pybamm.Tanh(child)[source]

Hyperbolic tan function.

pybamm.tanh(child)[source]

Returns hyperbolic tan function of child.