diff --git a/collects/plot/extend.ss b/collects/plot/extend.ss index e47a75467a..29778c6988 100644 --- a/collects/plot/extend.ss +++ b/collects/plot/extend.ss @@ -1,8 +1,19 @@ #lang scheme (require "plot-extend.ss" + "renderer-helpers.ss" "view.ss") (provide (except-out (all-from-out "plot-extend.ss") define-plot-type) - plot-view%) + plot-view% + + + sample-size + scale-vectors + x-values + normalize-vector + normalize-vectors + make-column + xy-list + zgrid) diff --git a/collects/plot/main.ss b/collects/plot/main.ss index 58af4d5ed4..cad6eaf5e9 100644 --- a/collects/plot/main.ss +++ b/collects/plot/main.ss @@ -5,9 +5,11 @@ plot plot3d points line error-bars vector-field contour - shade surface - mix fit - derivative gradient make-vec))) + shade surface)) + (only-in "plot.ss" + mix + derivative gradient make-vec) + (only-in "fit.ss" fit-int)) (provide plot plot3d @@ -19,11 +21,11 @@ contour shade surface - (rename-out [orig:mix mix] - [orig:fit fit] - [orig:derivative derivative] - [orig:gradient gradient] - [orig:make-vec make-vec])) + (rename-out [fit-int fit]) + mix + derivative + gradient + make-vec) (define-syntax-rule (out-fit-struct) (begin diff --git a/collects/plot/plot.scrbl b/collects/plot/plot.scrbl index 2248bbc531..311b8e08eb 100644 --- a/collects/plot/plot.scrbl +++ b/collects/plot/plot.scrbl @@ -168,8 +168,8 @@ To fit a particular function to a curve: @secref["curve-fit"]. @schemeblock[ - (define fit-result - (fir fit-fun + (define fitted + (fit fit-fun '((m 1) (b 1)) data)) ] @@ -178,10 +178,10 @@ To fit a particular function to a curve: @item{View the resulting parameters; for example, @schemeblock[ - (fit-result-final-params fit-result) + (fit-result-final-params fitted) ] - will produce @schemeresultfont{((m 2) (b 3))}. + will produce @schemeresultfont{(2.0 3.0)}. } @item{For some visual feedback of the fit result, plot the function @@ -190,7 +190,7 @@ To fit a particular function to a curve: @schemeblock[ (plot (mix (points data) - (line (fit-result-function fit-result))) + (line (fit-result-function fitted))) #:y-max 15) ] } @@ -217,7 +217,7 @@ function, we could do the following: (define (dashed-line fun #:x-min [x-min -5] #:x-max [x-max 5] - #:sample [sample 100] + #:samples [samples 100] #:segments [segments 20] #:color [color 'red] #:width [width 1]) @@ -225,7 +225,7 @@ function, we could do the following: (x-lists (build-list (/ segments 2) (lambda (index) - (x-samples + (x-values (/ samples segments) (+ x-min (* 2 index dash-size)) (+ x-min (* (add1 (* 2 index)) @@ -432,12 +432,12 @@ values. The more accurate your initial guesses are, the more likely the fit is to succeed; if there are no good values for the guesses, leave them as @scheme[1].} -@defstruct[fit-result ([rms any/c] - [variance any/c] +@defstruct[fit-result ([rms real?] + [variance real?] [names (listof symbol?)] - [final-params (listof (cons/c symbol? real?))] - [std-error real?] - [std-error-percent real?] + [final-params (listof real?)] + [std-error (listof real?)] + [std-error-percent (listof real?)] [function (real? ... . -> . real?)])]{ The @scheme[params] field contains an associative list of the