; example - opens a data file, selects some data and performs some calculus!
; the data is approx a 3rd order polynomial c1=poly(c0)
; open data file into FILE 0
open data1 0 0
; need extra columns (0-5)
setcols 5
; set some titles
title c2 numeric
title c3 analytic
title c4 manual
; now select some data
; first try every other point
pick every 2
; no, bad idea
unpick
pick c1>0
; removes all points with c1 negative, confirm this
compress
; eliminate first 2 rows, using this method
series c2 1 1 1
pick c2>2
compress
; note - this method requires a temp. column
; Now the calculus - we will differentiate c1 vs c0 using several methods
; 1. numeric, output to c2
numdiff c0 c1 c2
; 2. analytic - assumes a 3rd order polynomial relationship c0-c1
;   so forms equation, differentiates and outputs to c3
diff c0 c1 c3 3
print
;compare 1 & 2
chisq c1 c2
; 3. manual, although the method is the same as 2.
polyfit c0 c1 3
; parameters now in m0 to m3
; differentiate
c4=m1+2*m2*c0+3*m3*c0^2
; save the final file
saveas ram:file2

