home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / utility / sm22a.zip / SYMBMATH.H15 < prev    next >
Text File  |  1993-04-22  |  2KB  |  75 lines

  1.         8.11 Plot Function Package
  2. ---------------------------------------------------------------------
  3. # The plot function package plot.sm
  4. # to plot a function.
  5. # plot(x^2, x)        # plot the function of x^2
  6. # plot(x^2, x,-6,6)    # plot the function of x^2 from x=-6 to x=6
  7. # end
  8.  
  9. output=off
  10. plot(y_,x_,x1_,x2_,dx_) := block(openfile('symbmath.out'),
  11.     table(y,x,x1,x2,dx),
  12.     closefile('symbmath.out'),
  13.     system(plotdata))
  14. plot(y_,x_,x1_,x2_) := plot(y,x,x1,x2,(x2-x1)*0.5)
  15. plot(y_,x_) := plot(y,x,-5,5,0.5)
  16. output=on
  17. end
  18. ----------------------------------------------------------------------
  19.  
  20.     If SymbMath is interfaced with the software PlotData, SymbMath 
  21. produces the data table of functions, and PlotData plots from the 
  22. table. So SymbMath seems to plot the function. This interface can be 
  23. used to solve equations graphically.
  24.     In the plot package 'plot.sm' the funcion
  25.         plot(y, x, x1, x2, dx)
  26. first open a file 'SymbMath.Out' for writing, then write the data table 
  27. of the function y into the file 'SymbMath.out', then close the file, 
  28. and finally automatically call the software PlotData to plot. After it 
  29. exits from PlotData, it automatically return to SymbMath.
  30.     The functions
  31.         plot(y, x)
  32.         plot(y, x from xmin to xmax)
  33. call the function plot(y,x,x1,x2,dx)
  34.     e.g. plot x^2.
  35.     Input:
  36. plot(x^2, x)
  37. end
  38.  
  39. in the software PlotData, just select the option to read the file 
  40. 'SymbMath.out' and to plot. PlotData read the data in the SymbMath 
  41. format without any modification (and in many data format). 
  42.     In PlotData, 
  43. in the main menu:
  44. 1 <Enter>
  45. in the read menu:
  46. 2 <Enter>
  47. <Enter>
  48. in the main menu:
  49. 2 <Enter>
  50. in the graph menu:
  51. 1 <Enter>
  52.  
  53. where <Enter> is the <Enter> key.
  54. Refer to PlotData for detail.
  55.     Note that if your monitor is Hercules, you must load the 
  56. MSHERC.COM program as a TRS program before you run PlotData. 
  57. Otherwise you will get Error when you plot.
  58.  
  59.         8.12 List Plot Package
  60. ----------------------------------------------------------------------
  61. # the list plot package 'listplot.sm'
  62. # to plot a list of data.
  63. # listplot([1,2,3,4,5,4,3,2,1])
  64. # end
  65.  
  66. output=off
  67. listplot(y_) := if(islist(y), block(yy=y, length=length(yy),
  68.     openfile('symbmath.out'),
  69.     table(yy[xx],xx,1,length),
  70.     closefile('symbmath.out'),
  71.     system(plotdata) ))
  72. output=on
  73. end
  74. ---------------------------------------------------------------------
  75.