verry.intervalseries.IntervalSeries#
- class verry.intervalseries.IntervalSeries(coeffs, intvl)#
Bases:
Scalar
,Generic
Interval series.
- Parameters:
coeffs – Sequence of coefficients with respect to the monomial basis.
intvl (type[Interval] | None) – Type of each coefficient.
- __call__(arg)#
Return
compose(arg)
oreval(arg)
depending on the type of arg.
- compose(arg)#
Return the composition.
Examples
>>> from verry import FloatInterval as FI >>> f = IntervalSeries([4, 3, 1], intvl=FI) >>> g = IntervalSeries([2, -1, 5], intvl=FI) >>> h = f.compose(g) >>> print([coeff.mid() for coeff in h.coeffs]) [14.0, -7.0, 36.0, -10.0, 25.0]
- copy()#
Return a copy of the series.
- eval(arg)#
Return an interval containing the image of arg.
Examples
>>> from verry import FloatInterval as FI >>> f = IntervalSeries([8, 2, -1], intvl=FI) >>> y1 = f.eval(2) >>> print(format(y1, ".2f")) [8.00, 8.00] >>> y2 = f.eval(FI(-1, 1)) >>> FI(5, 9).issubset(y2) True
- integrate()#
Integrate the series in a term by term.
Examples
>>> from verry import FloatInterval as FI >>> x = IntervalSeries([0, 1], intvl=FI) >>> y = 3 * x**2 + 4 * x + 5 >>> z = y.integrate() >>> z == x**3 + 2 * x**2 + 5 * x True
- reciprocal()#
Return the reciprocal of the series.
- Raises:
ZeroDivisionError – If the constant term contains zero.
- round_type1(deg)#
Round the series in Type-I PSA. This method modifies the series in-place.
- Parameters:
deg – Truncation degree.
See also
Examples
>>> from verry import FloatInterval as FI >>> f = IntervalSeries([1, 2, -3], intvl=FI) >>> g = IntervalSeries([1, -1, 1], intvl=FI) >>> h1 = f * g >>> h2 = h1.copy() >>> h2.round_type1(deg=2) >>> h1(1).issubset(h2(1)) False
- round_type2(deg, domain)#
Round the series in Type-II PSA. This method modifies the series in-place.
- Parameters:
deg – Truncation degree.
See also
Examples
>>> from verry import FloatInterval as FI >>> f = IntervalSeries([1, 2, -3], intvl=FI) >>> g = IntervalSeries([1, -1, 1], intvl=FI) >>> h1 = f * g >>> h2 = h1.copy() >>> h2.round_type2(deg=2, domain=FI(0, 2)) >>> h1(1).issubset(h2(1)) True