Link to home
Start Free TrialLog in
Avatar of Gesus
Gesus

asked on

maple 8 relation problem

> buildrelation:=proc(s1::set,s2::set,z::relation)
> 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?
Avatar of Gesus
Gesus

ASKER

i've sorted this out on my own, but i have another maple question, if anyone can help.

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
ASKER CERTIFIED SOLUTION
Avatar of imladris
imladris
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial