plot.red 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. module plot; % device and driver independent plot services.
  2. % Author: Herbert Melenk.
  3. % Adjusted by A C Norman to be compatible with CSL - the original
  4. % was written to be fairly PSL-specific.
  5. % Minor corrections by Winfried Neun (October 1995)
  6. create!-package('(plot plotsynt plotexp2 pltpara plotexp3 plotimp2
  7. plotimp3 plotnum parray xvect),
  8. nil);
  9. global '(
  10. plotdriver!* % modulename of the actual driver.
  11. plotmax!* % maximal floating point number which
  12. % gnuplot supports on the machine
  13. % (mostly IEEE double or single precision).
  14. plotmin!* % lower bound (=1/plotmax!*)
  15. variation!* % definition of y-bigstep for smooth
  16. plotoptions!* % list for collecting the options.
  17. );
  18. fluid '(
  19. plotderiv!* % derivative for 2d plot
  20. );
  21. !#if(or (errorp (errorset '!*writingfaslfile nil nil))
  22. (not !*writingfaslfile)
  23. (errorp (errorset '(load fcomp) nil nil)))
  24. % prin2t "*** No support for fast float!";
  25. symbolic macro procedure fdeclare u; nil;
  26. symbolic macro procedure thefloat u; cadr u;
  27. !#endif
  28. % Create .. as infix operator.
  29. newtok '((!. !.) !*interval!*);
  30. put('!*interval!*,'prtch,'! !.!.! );
  31. if null get('!*interval!*,'simpfn)
  32. then <<precedence .., or; algebraic operator ..>>;
  33. % Reestablished these routines in order to support singularity handling
  34. % (which was better in some respects in Reduce 3.5) %WN
  35. symbolic procedure ploteval3xysingular(ff,f,x,xx,dx,y,yy,dy,zhi,zlo);
  36. % set up an iteration approaching a critical point.
  37. <<dx:=dx/4; dy:=dy/4;
  38. ploteval3xysingular1(ff,f,x,xx,dx,y,yy,dy,zhi,zlo,
  39. plotevalform(ff,f,{x . (xx+dx), y . (yy+dy)}),0)
  40. >>;
  41. symbolic procedure ploteval3xysingular1(ff,f,x,xx,dx,y,yy,dy,zhi,zlo,w,c);
  42. if null w then nil else if c>8 then nil else
  43. if w>zhi then zhi else
  44. if w<zlo then zlo else
  45. begin scalar wnew;
  46. dx:=dx/2; dy:=dy/2;
  47. wnew := plotevalform(ff,f,{x . (xx+dx), y . (yy+dy)});
  48. return
  49. if null wnew then nil else
  50. if abs(wnew-w) <abs wnew/20 then wnew else
  51. ploteval3xysingular1(ff,f,x,xx,dx,y,yy,dy,zhi,zlo,wnew,c+1);
  52. end;
  53. % I need the following definition only at compile time.
  54. macro procedure plotdriver u;
  55. {'apply,{'get,'plotdriver!*,mkquote cadr u},'list . cddr u};
  56. endmodule;
  57. end;