Gesus
asked on
maple 8 relation problem
> buildrelation:=proc(s1::se t,s2::set, z::relatio n)
> local x, y, ans,rel;
> ans:= NULL;
>
> for x in s1 do
> for y in s2 do
> if z then
> ans:=ans,[x,y];
> fi;
> od;
> od;
> return({ans});
> end:
> trace(buildrelation);
buildrelation
> buildrelation({$1..3},{$1. .3},x<y);
{--> enter buildrelation, args = {1, 2, 3}, {1, 2, 3}, x < y
ans :=
x := 1
y := 1
<-- ERROR in buildrelation (now at top level) = "cannot determine if this expression is true or false: %1"}
Error, (in buildrelation) cannot determine if this expression is true or false: x-y < 0
the above works if i put x<y directly in the program, but not when i give input it as the relationship "z".
any idea how i can correct this?
> local x, y, ans,rel;
> ans:= NULL;
>
> for x in s1 do
> for y in s2 do
> if z then
> ans:=ans,[x,y];
> fi;
> od;
> od;
> return({ans});
> end:
> trace(buildrelation);
buildrelation
> buildrelation({$1..3},{$1.
{--> enter buildrelation, args = {1, 2, 3}, {1, 2, 3}, x < y
ans :=
x := 1
y := 1
<-- ERROR in buildrelation (now at top level) = "cannot determine if this expression is true or false: %1"}
Error, (in buildrelation) cannot determine if this expression is true or false: x-y < 0
the above works if i put x<y directly in the program, but not when i give input it as the relationship "z".
any idea how i can correct this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i need to create proceedures to check relations for properties of reflexivity and transitivity
reflexitive rule - if Y is a subset of tX then X -> Y
Transitive Rule - if X -> Y & Y -> Z, then X -> Z