inequalities := proc( ineqs::{`<`, `<=`,`=`, set({`<`, `<=`,`=`})}, xrange::(name = range), yrange::(name = range)) options `Maple Advisor Database 1.01 for Maple 6`, `Copyright (c) 1998 by Robert B. Israel. All rights reserved`; local opt, xopts, opts, ineq, onames, gridopt, pl, polyf, polye, curvc, curvo, newc, fn, cb, cw,a,b,c,d, coopt, coo, F, q, s; if type(ineqs, {`<`, `<=`, `=`}) then RETURN(inequalities({ineqs}, args[2 .. nargs])) fi; onames := ['optionsclosed', 'optionsopen', 'optionsexcluded', 'optionsfeasible']; for opt in onames do opts[opt] := NULL od; xopts := NULL; gridopt := NULL; coopt := NULL; for opt in args[4 .. nargs] do if type(opt, `=`) then if member(lhs(opt), onames) then opts[lhs(opt)] := opts[lhs(opt)], rhs(opt) elif lhs(opt) = 'grid' then gridopt := opt elif lhs(opt) = 'coords' then coopt:= opt else xopts := xopts, opt fi else xopts := xopts, opt fi od; if not has([opts['optionsfeasible']], {color, colour}) then opts['optionsfeasible'] := opts['optionsfeasible'], colour = green fi; if not has([opts['optionsexcluded']], {color, colour}) then opts['optionsexcluded'] := opts['optionsexcluded'], colour = white fi; if not has([opts['optionsclosed']], {color, colour}) then opts['optionsclosed'] := opts['optionsclosed'], colour = blue fi; if not has([opts['optionsclosed']], linestyle) then opts['optionsclosed'] := opts['optionsclosed'], linestyle = 0 fi; if not has([opts['optionsopen']], {color, colour}) then opts['optionsopen'] := opts['optionsopen'], colour = red fi; if not has([opts['optionsopen']], linestyle) then opts['optionsopen'] := opts['optionsopen'], linestyle = 2 fi; if not has([xopts], style) then xopts := xopts, style = patchnogrid fi; if coopt = NULL and not has([xopts], labels) then xopts := xopts, labels=[lhs(xrange), lhs(yrange)] fi; curvc := NULL; curvo := NULL; cb := `plot/options2d`(colour = black); cw := `plot/options2d`(colour = white); a:= evalf(op(1,rhs(xrange))); b:= evalf(op(2,rhs(xrange))); c:= evalf(op(1,rhs(yrange))); d:= evalf(op(2,rhs(yrange))); if coopt = NULL then polyf := POLYGONS(evalf([[a,c],[a,d],[b,d],[b,c]]), `plot/options2d`(opts['optionsfeasible'])); else coo:= op(2,coopt); if type(coo,function) then s:= zip(`=`,[_a,_b,_c],[op(coo)]); coo:= op(0,coo) fi; q:= `plot3d/coordSystems`[coo]; if not type(q, list) or nops(q) <> 2 then error coo,` is not a known two-dimensional coordinate system` fi; if s <> 's' then q:= subs(s,q) fi; if has(q,{_a,_b,_c}) then q:= subs(_a=1,_b=1/2,_c=1/3, q) fi; F:= plottools[transform](unapply(evalf(q),(_x,_y))); pl := plots[implicitplot](lhs(xrange)-a,xrange,yrange,gridopt,filled=true, coloring = [black,white]); polyf := F(POLYGONS(op(select(type,op(select(has, pl, cw)),list)), `plot/options2d`(opts['optionsfeasible']))); fi; polye := {}; for ineq in ineqs do if type(ineq,`=`) then newc:= select(type, plots[implicitplot](rhs(ineq) - lhs(ineq), xrange, yrange, gridopt), specfunc(anything,CURVES)); if coopt <> NULL then newc:= map(F,newc) fi; if hastype(newc,list) then curvc:= curvc, op(newc) fi else pl := plots[implicitplot](rhs(ineq) - lhs(ineq), xrange, yrange, filled = true, gridopt, coloring = [black, white]); pl:= remove(t -> type(t,function) and op(t)=NULL, pl); if coopt <> NULL then pl:= F(pl) fi; newc:= select(type, pl, specfunc(anything,CURVES)); if hastype(newc,list) then if type(ineq, `<=`) then curvc := curvc, op(newc) else curvo := curvo, op(newc) fi fi; polye := polye union {op(select(type,op(select(has, pl, cb)),list))} fi od; if curvc <> NULL then fn := subs( _T = `plot/options2d`(opts['optionsclosed']) , x -> CURVES(op(x), _T)); curvc := op(map(fn, [curvc])) fi; if curvo <> NULL then fn := subs(_T = `plot/options2d`(opts['optionsopen']), x -> CURVES(op(x), _T)); curvo := op(map(fn, [curvo])) fi; if polye = {} then polye:= NULL else polye := POLYGONS(op(polye), `plot/options2d`(opts['optionsexcluded'])) fi; plots[display]([polye, polyf, curvc, curvo], xopts) end;