Interval series (verry.intervalseries)#

This module provides operations on power series with interval coefficients.

class verry.intervalseries.IntervalSeries(domain, coeffs)#

Bases: Scalar, Generic

Interval polynomial function.

Parameters:
  • domain (Interval) – Domain of the interval polynomial function. Note that domain must contain zero.

  • coeffs (Iterable[Interval]) – Coefficients with respect to the monomial basis.

Variables:
  • domain (Interval) – Domain of the interval polynomial function.

  • coeffs (list[Interval]) – Coefficients with respect to the monomial basis.

__call__(arg)#

Return compose(arg) or eval(arg) depending on the type of arg.

See also

compose, eval

compose(arg)#

Return the composition.

See also

eval, __call__

Examples

>>> from verry import FloatInterval as FI
>>> dom = FI(0, 1)
>>> f = IntervalSeries(dom, [FI(4), FI(3), FI(1)])
>>> g = IntervalSeries(dom, [FI(2), FI(-1), FI(5)])
>>> h = f.compose(g)
>>> print([x.mid() for x in h.coeffs[:-1]])
[14.0, -7.0]
copy()#

Return a copy of the series.

eval(arg)#

Return an interval containing the image of arg.

See also

compose, __call__

Examples

>>> from verry import FloatInterval as FI
>>> dom = FI(-2, 2)
>>> f = IntervalSeries(dom, [FI(8), FI(2), FI(-1)])
>>> u = f.eval(2)
>>> print(format(u, ".2f"))
[inf=8.00, sup=8.00]
>>> v = f.eval(FI(-1, 1))
>>> FI(5, 9).issubset(v)
True
integrate()#

Integrate the series in a term by term.

Examples

>>> from verry import FloatInterval as FI
>>> dom = FI(0, 1)
>>> x = IntervalSeries(dom, [FI(0), FI(1), FI(0), FI(0)])
>>> y = 3 * x**2 + 4 * x + 5
>>> z = y.integrate().round(3)
>>> z == x**3 + 2 * x**2 + 5 * x
True
reciprocal()#

Return the reciprocal of the series.

Raises:

ZeroDivisionError – If the constant term contains zero.

Examples

>>> from verry import FloatInterval as FI
>>> dom = FI(0, 1)
>>> x = IntervalSeries(dom, [FI(1), FI(1), FI(0), FI(0)])
>>> y = x.reciprocal()
>>> z = x * y
>>> print([x.sup for x in z.coeffs[:-1]])
[1.0, 0.0, 0.0]
round(order)#

Round the series.

Parameters:

order (int)

Examples

>>> from verry import FloatInterval as FI
>>> dom = FI(0, 1)
>>> x = IntervalSeries(dom, [FI(2), FI(1), FI(-3)])
>>> y = IntervalSeries(dom, [FI(5), FI(2), FI(1)])
>>> z = x * y
>>> w = z.round(1)
>>> z(0.5).issubset(w(0.5))
True