| Complex | R Documentation |
The mathematical set of complex numbers, defined as the the set of reals with possibly imaginary components. i.e.
\\{a + bi \\ : \\ a,b \in R\\}
where R is the set of reals.
There is no inherent ordering in the set of complex numbers, hence only the contains
method is implemented here.
set6::Set -> Complex
new()Create a new Complex object.
Complex$new()
A new Complex object.
contains()Tests to see if x is contained in the Set.
Complex$contains(x, all = FALSE, bound = NULL)
xany. Object or vector of objects to test.
alllogical. If FALSE tests each x separately. Otherwise returns TRUE only if all x pass test.
boundlogical.
x can be of any type, including a Set itself. x should be a tuple if
checking to see if it lies within a set of dimension greater than one. To test for multiple x
at the same time, then provide these as a list.
If all = TRUE then returns TRUE if all x are contained in the Set, otherwise
returns a vector of logicals. For Intervals, bound is used to specify if elements lying on the
(possibly open) boundary of the interval are considered contained (bound = TRUE) or not (bound = FALSE).
If all is TRUE then returns TRUE if all elements of x are contained in the Set, otherwise
FALSE. If all is FALSE then returns a vector of logicals corresponding to each individual
element of x.
The infix operator %inset% is available to test if x is an element in the Set,
see examples.
equals()Tests if two sets are equal.
Complex$equals(x, all = FALSE)
xSet or vector of Sets.
alllogical. If FALSE tests each x separately. Otherwise returns TRUE only if all x pass test.
If all is TRUE then returns TRUE if all x are equal to the Set, otherwise
FALSE. If all is FALSE then returns a vector of logicals corresponding to each individual
element of x.
Infix operators can be used for:
| Equal | == |
| Not equal | != |
# Equals Set$new(1,2)$equals(Set$new(5,6)) Set$new(1,2)$equals(Interval$new(1,2)) Set$new(1,2) == Interval$new(1,2, class = "integer") # Not equal !Set$new(1,2)$equals(Set$new(1,2)) Set$new(1,2) != Set$new(1,5)
isSubset()Test if one set is a (proper) subset of another
Complex$isSubset(x, proper = FALSE, all = FALSE)
xany. Object or vector of objects to test.
properlogical. If TRUE tests for proper subsets.
alllogical. If FALSE tests each x separately. Otherwise returns TRUE only if all x pass test.
If using the method directly, and not via one of the operators then the additional boolean
argument proper can be used to specify testing of subsets or proper subsets. A Set is a proper
subset of another if it is fully contained by the other Set (i.e. not equal to) whereas a Set is a
(non-proper) subset if it is fully contained by, or equal to, the other Set.
When calling $isSubset on objects inheriting from Interval, the method treats the interval as if
it is a Set, i.e. ordering and class are ignored. Use $isSubinterval to test if one interval
is a subinterval of another.
Infix operators can be used for:
| Subset | < |
| Proper Subset | <= |
| Superset | > |
| Proper Superset | >=
|
Every Set is a subset of a Universal. No Set is a super set of a Universal,
and only a Universal is not a proper subset of a Universal.
If all is TRUE then returns TRUE if all x are subsets of the Set, otherwise
FALSE. If all is FALSE then returns a vector of logicals corresponding to each individual
element of x.
Set$new(1,2,3)$isSubset(Set$new(1,2), proper = TRUE) Set$new(1,2) < Set$new(1,2,3) # proper subset c(Set$new(1,2,3), Set$new(1)) < Set$new(1,2,3) # not proper Set$new(1,2,3) <= Set$new(1,2,3) # proper
strprint()Creates a printable representation of the object.
Complex$strprint(n = 2)
nnumeric. Number of elements to display on either side of ellipsis when printing.
A character string representing the object.
clone()The objects of this class are cloneable with this method.
Complex$clone(deep = FALSE)
deepWhether to make a deep clone.
Other special sets:
ExtendedReals,
Integers,
Logicals,
Naturals,
NegIntegers,
NegRationals,
NegReals,
PosIntegers,
PosNaturals,
PosRationals,
PosReals,
Rationals,
Reals,
Universal
## ------------------------------------------------
## Method `Complex$equals`
## ------------------------------------------------
# Equals
Set$new(1,2)$equals(Set$new(5,6))
Set$new(1,2)$equals(Interval$new(1,2))
Set$new(1,2) == Interval$new(1,2, class = "integer")
# Not equal
!Set$new(1,2)$equals(Set$new(1,2))
Set$new(1,2) != Set$new(1,5)
## ------------------------------------------------
## Method `Complex$isSubset`
## ------------------------------------------------
Set$new(1,2,3)$isSubset(Set$new(1,2), proper = TRUE)
Set$new(1,2) < Set$new(1,2,3) # proper subset
c(Set$new(1,2,3), Set$new(1)) < Set$new(1,2,3) # not proper
Set$new(1,2,3) <= Set$new(1,2,3) # proper
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.