Logplot := proc (v, r) options `Maple Advisor Database 1.01 for Maple 6`, `Copyright (c) 2000 by Robert B. Israel. All rights reserved`; local axspec, goodplot, x, a, b, X, f1, f1i, f2, pflag, ptype, ti, w, xti, yti, ax1, ax2, ax, pts, vo, opts, xopts, yvals, paratype, logaxes; paratype:= {[algebraic,algebraic,name=range], [{algebraic,procedure},{algebraic,procedure},range]}; if type(v,{paratype,list(paratype),set(paratype)}) then # parametric pflag:= true; ptype:= 1; opts:= [args[2..-1]]; elif type(v,{listlist,set(listlist),list(listlist)}) then # points pflag:= true; ptype:= 2; opts:= [args[2..-1]]; else # expression or procedures ptype:= 3; pflag:= typematch(r,a::realcons .. b::realcons); if not (pflag or typematch(r,x::name = a::realcons .. b::realcons)) then error "Invalid second argument" end if; opts:= [args[3..-1]]; end if; if (nops(opts) >= 1) and type(opts[1],[boolean,boolean]) then logaxes:=opts[1]; opts:= opts[2..-1] else logaxes:= [false,true]; end if; if ptype = 3 and hasoption(opts,'coords') then # make parametric if pflag then # procedures if type(v,{set,list}) then return Logplot(map((t,r) -> [(x -> x), t, r], v,r),logaxes,op(opts)) else return Logplot([(x -> x),v,r],logaxes,op(opts)) end if elif type(v,{set,list}) then return Logplot(map((t,r) -> [op(1,r),v,r],v,r),logaxes,op(opts)) else return Logplot([op(1,r),v,r],logaxes,op(opts)) end if end if; if hasoption(opts,'view',vo,xopts) then vo:= map(t -> if type(t,range) then map(log[10],t) else t fi, vo); opts:= ['view'= vo, op(xopts)]; else vo:= [DEFAULT,DEFAULT]; fi; if hasoption(opts,'tickmarks','ti','xopts') then opts:= ['xtickmarks'=ti[1],'ytickmarks'=ti[2],op(xopts)] fi; if not hasoption(opts,'xtickmarks',xti,'opts') then xti:= 4 fi; if not hasoption(opts,'ytickmarks',yti,'opts') then yti:= 4 fi; if not (pflag or hasoption(opts,'labels')) then opts:= ['labels'=[convert(x,string),""],op(opts)] fi; opts:= op(opts); if logaxes[1] then f1:= x -> 10^x; f1i:= log[10]; else f1:= x -> x; f1i:= x -> x; opts:= opts, 'xtickmarks'=xti fi; if logaxes[2] then f2:= log[10] else f2:= x -> x; opts:= opts, 'ytickmarks'=yti fi; if ptype <= 2 then goodplot:= `plots/dologplot`(logaxes[1],logaxes[2],v,opts) elif pflag then if type(v,{set,list}) then goodplot := plot(map((g -> f2 @ g @ f1),v), f1i(a) .. f1i(b),opts) else goodplot := plot(x -> f2(v(f1(x))), f1i(a) .. f1i(b),opts) end if elif type(v,{set,list}) then goodplot := plot(map(f2,subs(x = f1(X),v)), X = f1i(a) .. f1i(b), opts) else goodplot := plot(f2(subs(x = f1(X),v)), X = f1i(a) .. f1i(b), opts) end if; ax, goodplot:= selectremove(type,goodplot,specfunc(anything,AXESTICKS)); if nops(ax)=0 then ax:= PLOT(AXESTICKS(DEFAULT,DEFAULT)) fi; if not logaxes[1] then ax1:= op(1,op(ax)) elif vo[1] <> DEFAULT then ax1:= `Logplot/axis`(op(evalf(vo[1])),xti,logaxes[1]) elif (ptype=3) or type(xti,list) then ax1:= `Logplot/axis`(evalf(f1i(a)),evalf(f1i(b)),xti,logaxes[1]) else ax1:= op(1,op(ax)) fi; if not logaxes[2] then ax2:= op(2,op(ax)) elif vo[2] <> DEFAULT then ax2:= `Logplot/axis`(op(vo[2]),yti) elif type(yti,list) then ax2:= `Logplot/axis`(0,0,yti) elif ptype=3 then pts:= remove(has,map(t -> op(op(1,t)), convert(indets(goodplot, specfunc(anything,CURVES)),list)),undefined); yvals:= op(map2(op,2,pts)); ax2:= `Logplot/axis`(min(yvals),max(yvals),yti); else ax2:= op(2,op(ax)) fi; PLOT(op(goodplot),AXESTICKS(ax1,ax2)) end proc; `Logplot/axis`:= proc(x0,x1,ti) options `Maple Advisor Database 1.01 for Maple 6`, `Copyright (c) 2000 by Robert B. Israel. All rights reserved`; if type(ti, list) then map(t -> (evalf(log[10](t))=t), ti) else `plot/logaxes`(x0,x1,ti,10) fi end;