verry.affine.AffineForm#

final class verry.affine.AffineForm(value, **kwargs)#

Bases: Scalar, Generic

Affine form.

Parameters:

value (Interval) – Interval transformed into a new affine form that is independent of all existing affine forms.

Examples

>>> from verry import FloatInterval
>>> x0 = FloatInterval("-0.1", "0.1")
>>> y0 = (x0 + 1)**2 - 2 * x0
>>> print(format(y0, ".6f"))
[0.609999, 1.410001]
>>> x1 = AffineForm(x0)
>>> y1 = (x1 + 1)**2 - 2 * x1
>>> print(format(y1.range(), ".6f"))
[0.989999, 1.010001]
classmethod zero(intvl, ctx=None)#

Return an affine form consisting only of the constant term 0.

Parameters:
  • intvl (type[Interval]) – Interval type.

  • ctx (Context, optional) – Context to which the affine form belongs. If no context is specified, the current context is used.

copy()#

Return a shallow copy of the affine form.

rad()#

Return an upper bound of the radius.

range()#

Return the range of the affine form.

Example

>>> from verry import FloatInterval
>>> x = AffineForm(FloatInterval("0.1"))
>>> x.range() == x.mid() + x.rad() * x.interval(-1, 1)
True
reciprocal()#

Return the reciprocal of the affine form.

Raises:

ZeroDivisionError – If the range contains zero.