Page 1 sur 1

SET functions

Publié : jeu. déc. 13, 2018 6:09 pm
par compsystems
Hi, BP
Does GIAC have functions to determine if one set is a subset of another? In addition, if an element belongs or not to a set and function to make the product Cartesian.

Thanks

Re: SET functions

Publié : jeu. déc. 13, 2018 6:36 pm
par parisse
is_element(1,[1,2,3]) or contains([1,2,3],1)
set[1,2]*set[3,4]

Re: SET functions

Publié : lun. déc. 17, 2018 3:30 am
par compsystems
thanks ^

and these two basic functions

Complement of a set and
Symmetric difference of sets

Re: SET functions

Publié : lun. déc. 17, 2018 6:36 am
par parisse
minus
I would appreciate if you could take a look at the help and documentation before posting. I mean if you open the Prg>Set menu you will see the minus command or if you open Help>Index for union, you will see in "See also" intersect and minus.

Re: SET functions

Publié : lun. déc. 17, 2018 2:17 pm
par compsystems
I mean the functions

Symmetric difference of sets: M Δ N
Complement of a set:
M' U
N' U

M:= set[ "A", "B", "C"]
N:= set[ "B", "G", "L", "E"]
U:= set[ "A", "B", "C", "G", "L", "E", "I", "J", "F", "H"]

M union N [↵] set["A","B","C","G","L","E"]
M intersect N [↵] set["B"]
M minus N [↵] set["A","C"]
M Δ N [↵] set[ "A", "C", "G", "L", "E"]
M' U [↵] set[ "J", "F", "G", "L", "E", "I", "H"]
N' U [↵] set[ "I", "H", "J", "F", "A", "C" ]

Re: SET functions

Publié : lun. déc. 17, 2018 2:59 pm
par parisse
I mean you can use minus for complementary and for the symmetric difference.

Re: SET functions

Publié : lun. déc. 17, 2018 4:54 pm
par compsystems
ok
Δ (Symmetric difference ) = (N minus M) union (M minus N)

//
In the help of XCAS-PC says that
is_element() Returns 1 if the point is on the geometric object and 0 otherwise.

You can apply this characteristic in sets object, that is, instead of returning the position (#), return a true / false symbolic value,
Since there are functions that return the position of an element
contains("a",set["b","a","c","a"]) [↵] 2
contains("d",set["b","a","c","a"]) [↵] 0

is_element("a",set["b","a","c","a"]) [↵] 2 => true
is_element("d",set["b","a","c","a"]) [↵] 0 => false



Thanks

Re: SET functions

Publié : lun. déc. 17, 2018 8:44 pm
par parisse
It's more precise to have the position and it's the same for testing.