Variable#

class rateslib.dual.Variable(real, vars=(), dual=NoInput.blank)#

Bases: object

A user defined, exogenous variable that automatically converts to a Dual or Dual2 type dependent upon the overall AD calculation order.

See what is an exogenous variable?

Parameters:
  • real (float) – The real coefficient of the underlying dual number.

  • vars (tuple of str, optional) – The labels of the variables for which to record derivatives. If not given the Variable represents a constant - it would be better to define just a float.

  • dual (1d ndarray, optional) – First derivative information contained as coefficient of linear manifold. Defaults to an array of ones the length of vars if not given.

real#
Type:

float

vars#
Type:

str, tuple of str

dual#
Type:

1d ndarray

Methods Summary

to_dual()

to_dual2()

to_json()

Serialize this object to JSON format.

Methods Documentation

to_dual()#
to_dual2()#
to_json()#

Serialize this object to JSON format.

The object can be deserialized using the from_json() method.

Return type:

str