<< Reshape SYMSCI Toolbox Sign >>

SYMSCI Toolbox >> SYMSCI Toolbox > Set

Set

create a symbolic set

Calling Sequence

S = Set()
S = Set( a )

Arguments

a

symbolic, double, or integer matrix, or symbolic set

S

symbolic set

Description

Creates a symbolic set S. The elements of symbolic sets are symbolic scalars (cf. Sym).

Set()

Returns an empty set.

Set( a )

Returns a set with the elements of a matrix or vector a.

Extracting Elements

A(i)

Returns the i-th element of A specified by a scalar integer index i.

Returns a subset of A specified by a vector i of integer indices.

A( B )

Returns the set of elements which are members of A and B.

Please note, if B is a symbolic scalar (cf. Sym), then it is interpreted as a set with just one element.

Inserting Elements

A( B ) = C

Removes all elements of set B from A and then inserts all elements of set C into A.

Please note, if the empty matrix [] is used for B or C, then it is interpreted as an empty set.

Examples

// create empty sets
R = Set();
S = Set();

// add elements to S
S([]) = Sym("5");
S([]) = Sym("1.23");
S([]) = Sym("y");
S([]) = Sym("x+x")

// add elements to R
R([]) = Sym("x");
R([]) = Sym("5");
R([]) = Sym("2*y")

// Difference "D = S \ R"
D=S;
D(R)=[]

// Union "U = S or R"
U=S;
U([])=R

// Intersection "I = S and R"
I=R(S) // or I=S(R)

See Also

Authors

Bibliography

SymEngine: C++ library for fast symbolic manipulation.


Report an issue
<< Reshape SYMSCI Toolbox Sign >>