I am using Maple to solve some inequalities where the solution I get is a RealRange or a real constant. And I want to get an union of these values. I wrote a short procedure which does the work. But is there a better way to do this (there must be :-) )? > RealRangeUnion:=proc(L::list) local L2, rel, rel2, eq, sol, x; > assume(x, real); > L2:=map(a->`if`(a::realcons, x = a, x in a), L); > rel:=convert(L2, relation); > rel2:=convert(Or(op(rel)), relation); > eq:=piecewise(rel2,1,0); > sol:=solve(1=eq,x); > RETURN(sol); > end proc: > > L:=[RealRange(Open(-2),-1), RealRange(Open(0),1), RealRange(1/2,2), -3, -2]; > RealRangeUnion(L); -3, RealRange(-2, -1), RealRange(Open(0), 2)

Please Wait...