gnuplot.tst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. on demo;
  2. plot(sin x,x=(-3 .. 3));
  3. plot(s=sin phi,phi=(-3 .. 3));
  4. plot(sin phi,cos phi,phi=(-3 .. 3));
  5. plot(sin(1/x),x=(-1 .. 1),y=(-3 .. 3));
  6. plot(sin(1/x),x=(-10 .. 10));
  7. plot(y=tan x,y=(-10 .. 10));
  8. plot (cos sqrt(x**2 + y**2),x=(-3 .. 3),y=(-3 .. 3));
  9. plot (cos sqrt(x**2 + y**2),x=(-3 .. 3),y=(-3 .. 3),hidden3d);
  10. plot(x*y, x=(0 .. 2), y=(0 .. 2));
  11. plot(x*y, x=(-2 .. 2), y=(-2 .. 2));
  12. plot(x+y, x=(0 .. 2), y=(0 .. 2));
  13. plot(1/(x**2+y**2),x=(-0.5 .. 0.5),y=(-0.5 .. 0.5));
  14. plot(1/(x**2+y**2),x=(-0.5 .. 0.5),y=(-0.5 .. 0.5),hidden3d);
  15. plot(1/(x**2+y**2),x=(0.1 .. 5),y=(0.1 .. 5),size="0.7,1");
  16. plot(1/(x**2+y**2),x=(0.1 .. 5),y=(0.1 .. 5),view="30,89");
  17. plot(1/(x**2+y**2),x=(-0.5 .. 0.5),y=(-0.5 .. 0.5),
  18. hidden3d,contour,view="70,20");
  19. % this may be slow on some machines because of
  20. % a delicate evaluation context.
  21. plot(sinh(x*y)/sinh(2*x*y),hidden3d);
  22. %parametric curves and surfaces
  23. plot(point(cos(u),sin(u),0.1*u),u=(0 .. 4*pi),points=100);
  24. plot(point(sin(u)*cos(v),sin(u)*sin(v),cos(u)),u=(0 .. pi),v=(0 .. 2*pi)
  25. ,points=60);
  26. % implicit curves and surfaces
  27. plot(x^3+y^3 -3*x*y ={0,1,2,3},x=(-2.5 .. 2),y=(-5 .. 5));
  28. plot(x^2+y^2+z^2-1=0,x=(-1 .. 1),y=(-1 .. 1),points=40);
  29. % equations and parts
  30. wss :=
  31. {{u=(665280*t**6 + 1995840*t**5*x**2 - 3991680*t**5
  32. + 831600*t**4*x**4 - 9979200
  33. *t**4*x**2 + 19958400*t**4 + 110880*t**3*x**6 - 3326400*t**3*x**4 +
  34. 39916800*t**3*x**2 - 79833600*t**3 + 5940*t**2*x**8 - 332640*t**2*x**6 +
  35. 9979200*t**2*x**4 - 119750400*t**2*x**2 + 239500800*t**2 + 132*t*x**10 -
  36. 11880*t*x**8 + 665280*t*x**6 - 19958400*t*x**4 + 239500800*t*x**2 -
  37. 479001600*t + x**12 - 132*x**10 + 11880*x**8 - 665280*x**6 + 19958400*x**4
  38. - 239500800*x**2 + 479001600)/479001600}}$
  39. plot(rhs first first wss,x=(-5 .. 5),t=(-1 .. 1),hidden3d);
  40. % general curves and surfaces computed as lists of data points
  41. plot {{0,0},{0,1},{1,1},{0,0},{1,0},{0,1},{0.5,1.5},{1,1},{1,0}};
  42. on rounded;
  43. w:=for j:=1:200 collect {1/j*sin j,1/j*cos j,j/200}$
  44. plot w;
  45. % the following examples need some computing time
  46. w:= {for j:=1 step 0.1 until 20 collect
  47. {1/j*sin j,1/j*cos j,j},
  48. for j:=1 step 0.1 until 20 collect
  49. {(0.1+1/j)*sin j,(0.1+1/j)*cos j,j}
  50. }$
  51. plot w;
  52. dd:=pi/15;
  53. w:=for u:=dd step dd until pi-dd collect
  54. for v:=0 step dd until 2pi collect
  55. {sin(u)*cos(v), sin(u)*sin(v), cos(u)}$
  56. plot w;
  57. symbolic procedure ikeda(tt);
  58. % from Willi-Hans Steeb: The NONLINEAR WORKBOOK, chap. 1.2
  59. % World Scientific, 1999
  60. begin scalar taut,X,Y,x1,y1,c1,c2,c3,rho;
  61. x := 0.5; y := 0.5;
  62. c1 := 0.4; c2 := 0.9; c3 := 9.0; rho := 0.85;
  63. return
  64. 'list .
  65. for ttt :=0:tt collect
  66. << x1 := x; y1 := y; taut := c1 -c3/(1 + x1^2 + y1^2);
  67. x := rho + c2*x1*cos taut - y1*sin(taut);
  68. y := c2*(x1*sin(taut) + y1*cos(taut));
  69. list('list, floor (90*x +200 + 0.5), floor (90*y +200 + 0.5)) >>;
  70. end;
  71. ikeda := lisp ikeda(20000)$
  72. plot(ikeda,style=points);
  73. plot(ikeda,style=dots);
  74. plot(ikeda,style=errorbars);
  75. plotreset;
  76. end;