home *** CD-ROM | disk | FTP | other *** search
- /* Test of getintervall2 */
- options results
-
-
- /* Plots parametric graphs, i.e. */
- /* x = f(t) */
- /* y = g(t) */
- /* t in [0,pi] */
- /* Try f(t)=sqr(t)*sin(t), */
- /* g(t)=sqr(t)*cos(t), */
- /* t in [0:10*pi] */
-
- requeststring 'prompt "y = f(t)"'
- yft = result
- if RC = 5 then exit;
-
- requeststring 'prompt "x = g(t)"'
- xgt = result
- if RC = 5 then exit;
-
- requeststring 'prompt "Start t"'
- evalstring result
- t0 = result
- if RC = 5 then exit;
-
- requeststring 'prompt "Stop t"'
- evalstring result
- t1 = result
- if RC = 5 then exit;
-
-
- requeststring 'prompt "dt = "'
- evalstring result
- dt = result
- if RC = 5 then exit;
-
-
- /* OK, MathPlot will clear the screen before every plot when there */
- /* was no REAL plot before. So we have to do some trick to get a */
- /* real plot.... */
- /* If you do not understand this: Try this script and then plot */
- /* another function or the axis. Then delete the next lines, clear */
- /* screen and do it again. The first time, you will se both */
- /* functions, the second time only the last function. */
-
- getfunc 0
- a = result
-
- setfunc 0 10000
- plot 0 normal
-
- setfunc 0 a
-
- /* End of trick.... */
-
-
- /* And here is the routine.... */
-
- evalstring yft "x=" t0
- y0 = result
-
- evalstring xgt "x=" t0
- x0 = result
-
- x = t0
-
- do while x < t1
- setconst t x
- evalstring yft
- yy = result
-
- evalstring xgt "x=" x
- xx = result
-
- line x0 y0 xx yy "pixel=off"
- x0 = xx
- y0 = yy
- x = x + dt
- end
-