home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / sm331a.zip / POLAR.SM < prev    next >
Text File  |  1993-11-12  |  585b  |  21 lines

  1. #    plot r=f(t) on polar plane.
  2. #    by default tmin:=0, tmax:=2*pi, rmin:=0, rmax:=10
  3. #    e.g. polar(1, t)    # r=1
  4.  
  5. polar(r_, t_, tmin_, tmax_, rmin_, rmax_) := block(numeric:=on,
  6.     graph,
  7.     dt:=(tmax-tmin)/getmaxx,
  8.     tstep:=dt*10,
  9.     dr:=(rmax-rmin)/getmaxy,
  10.     getmaxx2:=getmaxx*0.5,
  11.     getmaxy2:=getmaxy*0.5,
  12.     moveto(getmaxx2,getmaxy2),
  13.     do( lineto(cos(t)*(r-rmin)/dt+getmaxx2,getmaxy2-(r-rmin)*sin(t)/dr),
  14.     t,tmin,tmax,tstep),
  15.     numeric:=off,
  16.     readchar,
  17.     text,
  18.     local(dt,dr,tstep))
  19. polar(r_, t_, tmin_, tmax_) := polar(r,t,tmin,tmax,0,10)
  20. polar(r_, t_) := polar(r,t,0,2*pi,0,10)
  21.