Singleton [class]

The class splinekit.interval.Singleton is the concrete class that handles the degenerate intervals that contains only one real number.

This concrete class honors Interval and Degenerate; it handles intervals made of just one finite real number.


class splinekit.interval.singleton.Singleton(value: float)

Bases: Interval, Degenerate

The degenerate interval \(\{x\in{\mathbb{R}}|x=x_{0}\}=[x_{0},x_{0}].\)


property infimum: float

self.value


property supremum: float

self.value


property isleftopen: bool

False


property isrightopen: bool

False


property isopen: bool

False


property ishalfopen: bool

False


property isclosed: bool

True


property isleftbounded: bool

True


property isrightbounded: bool

True


property ishalfbounded: bool

False


property isbounded: bool

True


property isdegenerate: bool

True


property isproper: bool

False


property interior: Self

Empty()


property closure: Self

Singleton(self.value)


property diameter: float

0.0


property midpoint: float

self.value


sortorder() float

self.value


__contains__(x: float) bool

Tests if the number \(x\) is contained in this interval \(U,\) as in \(\left(x\in U\right).\)

Parameters:

x (float) – Real number whose membership is queried.

Returns:

  • False if x is not a member of this interval.

  • True if x is a member of this interval.

Return type:

bool

Examples

Load the library.
>>> import splinekit.interval as ivl
0.0 is in Singleton(0.0).
>>> 0.0 in ivl.Singleton(0.0)
True
float("inf") is not in RR().
>>> float("inf") in ivl.RR()
False

static __new__(cls, value: float) Self

Creates the degenerate interval \(\{x\in{\mathbb{R}}|x=x_{0}\}=[x_{0},x_{0}]\) that contains exactly one number.

Parameters:

value – The number contained by this degenerate interval.

Returns:

A Singleton interval if value is a finite number; an Empty interval otherwise.

Return type:

Interval