relentless.model.ArithmeticMean#

class relentless.model.ArithmeticMean(a, b)#

Arithmetic mean of two values.

The arithmetic mean \(v\) of two values \(a\) and \(b\) is:

\[v = \frac{a+b}{2}\]

This variable may be useful for implementing mixing rules.

Parameters:

Methods

compute(a, b)

Implementation of the value.

compute_derivative(param, a, b)

Implementation of the derivative.

derivative(var)

Calculate derivative with respect to a Variable.

Attributes

count

names

params

Names of parameters

value

Value of the variable.

compute(a, b)#

Implementation of the value.

This method should implement calculation of the variable from the parameter keywords. The parameters will be passed as keyword arguments.

compute_derivative(param, a, b)#

Implementation of the derivative.

This method should implement the partial derivative with respect to the named dependency param given the current value of this variable. The parameters will be passed as keyword arguments.

Parameters:

param (str) – Name of the dependency.

derivative(var)#

Calculate derivative with respect to a Variable.

The derivative is evaluated using the VariableGraph. Any values of the graph that are needed will be updated.

Parameters:

var (Variable) – Variable with respect to which to take the derivative.

Returns:

The calculated derivative.

Return type:

float

property params#

Names of parameters

Type:

tuple

property value#

Value of the variable.

The variable will be evaluated using the VariableGraph if it needs to be recomputed.

Type:

float