7 (C25) nutmeg_plot_fun
(f,-
2,2);
8 Loading raw file
'max.raw
' ... done.
12 Date
: Sun Oct
29 17:51:15 1989
15 This is a sample news file
, and will be printed
16 whenever spice or nutmeg is started.
22 (D25) #/rascal
/public
/tmp
/spice3c1
/max.raw
25 ;; The left button if held down while moving between two points,
26 ;; will print the difference.
29 (defun print-date (&optional
(stream *standard-output
*)
30 (time (get-universal-time)))
31 (multiple-value-bind (sec min hr day mon yr wkday
)
32 (decode-universal-time time
)
33 (format stream
"~a ~a ~a ~d:~2,'0d:~2,'0d ~a"
34 (nth wkday
'( "Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun"))
35 (nth (1- mon
) '("Jan" "Feb" "Mar" "Apr" "May" "Jun"
36 "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"))
40 (defun plot-points (variables pts
&optional
(st *standard-output
* )
41 &uax
(npoints (length (elt pts
0))))
42 (format st
"~%Title: Maxima plot")
43 (format st
"~%Date: ~a" (print-date nil
))
44 (format st
"~%Plotname: ourplot")
45 (format st
"~%Flags: real")
46 (format st
"~%No. Variables: ~a ~%No. Points: ~a" (length variables
) npoints
)
47 (format st
"~%Variables:")
48 (sloop for i from
0 for v in variables
49 do
(format st
"~%~a ~a ~a" i v v
))
50 (format st
"~%Values:")
51 (sloop for j below npoints
52 do
(format st
"~%~d " j
)
53 (cond ((arrayp (car pts
))
55 do
(princ (float (aref v j
)) st
)
59 (defun $nutmeg_plot_fun
(f min max
&aux file
)
60 (let ((x (make-array $plotnum
))
61 (y (make-array $plotnum
)))
62 (translate-function f
)
63 (sloop for i below $plotnum
64 with del
= (/ (- max min
) (float $plotnum
))
66 (setf (aref x i
) (+ min
(* i del
)))
67 (setf (aref y i
) (funcall f
(aref x i
))))
68 (with-open-file(st "max.raw" :direction
:output
)
69 (plot-points '(x y
) (list x y
) st
)
70 (setq file
(truename st
)))
71 (system "nutmeg max.raw")
75 (defun $nutmeg_plot
(vars vals
)
77 (sloop for v in
(cdr vals
)
78 collect
(cond ((listp v
) (coerce v
'vector
))
80 (plot-points (cdr variables
) (cdr pts
)))