IntervalProd.insert

IntervalProd.insert(index, *intvs)[source]

Return a copy with intvs inserted before index.

The given interval products are inserted (as a block) into self, yielding a new interval product whose number of dimensions is the sum of the numbers of dimensions of all involved interval products. Note that no changes are made in-place.

Parameters:
indexint

Index of the dimension before which other is to be inserted. Must fulfill -ndim <= index <= ndim. Negative indices count backwards from self.ndim.

intv1, ..., intvNIntervalProd

Interval products to be inserted into self.

Returns:
newintvpIntervalProd

The enlarged interval product.

Examples

>>> intv = IntervalProd([-1, 2], [-0.5, 3])
>>> intv2 = IntervalProd(0, 1)
>>> intv.insert(0, intv2)
IntervalProd([ 0., -1.,  2.], [ 1. , -0.5,  3. ])
>>> intv.insert(-1, intv2)
IntervalProd([-1.,  0.,  2.], [-0.5,  1. ,  3. ])
>>> intv.insert(1, intv2, intv2)
IntervalProd([-1.,  0.,  0.,  2.], [-0.5,  1. ,  1. ,  3. ])