find a relation (set) with XCAS

Messages in english

Modérateur : xcasadmin

compsystems
Messages : 557
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

find a relation (set) with XCAS

Message par compsystems » sam. sept. 28, 2019 4:22 pm

Hello BP
How do I solve the following problem with Xcas? I tried using the ASSUME () command but I can't get the answer

A := set[ 2, 4, 5, 6 ]; B := set[ 1, 2, 3, 5 ]
R = { ( b, a ) ∈ BxA / a <= 6 - 2*b }

R -> set[ ( 1, 2 ), ( 1, 4 ), ( 2, 2 ) ] // answer

parisse
Messages : 5734
Inscription : mar. déc. 20, 2005 4:02 pm
Contact :

Re: find a relation (set) with XCAS

Message par parisse » sam. sept. 28, 2019 5:54 pm

set[j for j in A*B if j[0]<=6-2*j[1]]

compsystems
Messages : 557
Inscription : sam. févr. 04, 2017 11:34 pm
Localisation : Colombia
Contact :

Re: find a relation (set) with XCAS

Message par compsystems » sam. sept. 28, 2019 6:25 pm

THANKS
Xcas ok
A_:=set[2,4,5,6];B_:=set[1,2,3,5]; set[j for j in B_*A_ if j[1]<=6-2*j[0]];
-> [[1,2],[1,4],[2,2]]

Répondre