4646 (init-matrix dims 1))
4747
4848(mac elt (mat pos)
49- "access the element of the matix given by co-ords listed in pos"
49+ "access the element of the matrix given by co-ords listed in pos"
5050 (if (cdr pos)
5151 `(elt (,mat ,(last pos)) ,(butlast pos))
5252 `(,mat ,(car pos))))
@@ -170,7 +170,7 @@ using gaussian elimination and returns a list of x's (N.B. not efficient for lar
170170;calculus fns
171171
172172(def deriv (f)
173- "provides differential of a function of a single vairable "
173+ "provides differential of a function of a single variable "
174174 (fn (x)
175175 (let dx (if (is x 0) 1d-9 (abs:* x 1d-9))
176176 (/ (- (f (+ x dx))
@@ -529,7 +529,7 @@ using gaussian elimination and returns a list of x's (N.B. not efficient for lar
529529;data-fitting
530530
531531(def least-squares-linear (data)
532- "data is expected in the form ((x1 y1)(x2 y2)...) returns list of co-efficients for powers of x in acsending order"
532+ "data is expected in the form ((x1 y1)(x2 y2)...) returns list of co-efficients for powers of x in ascending order"
533533 (if (< len.data 2) (err "cannot fit to less than 2 points"))
534534 (withs (xs (map car data)
535535 ys (map cadr data)
@@ -543,7 +543,7 @@ using gaussian elimination and returns a list of x's (N.B. not efficient for lar
543543 (gauss-elim A B)))
544544
545545(def least-squares-quadratic (data)
546- "data is expected in the form ((x1 y1)(x2 y2)...) returns list of co-efficients for powers of x in acsending order"
546+ "data is expected in the form ((x1 y1)(x2 y2)...) returns list of co-efficients for powers of x in ascending order"
547547 (if (< len.data 3) (err "cannot fit to less than 3 points"))
548548 (withs (xs (map car data)
549549 ys (map cadr data)
@@ -558,7 +558,7 @@ using gaussian elimination and returns a list of x's (N.B. not efficient for lar
558558 (gauss-elim A B)))
559559
560560(def least-squares-custom (data . fns)
561- "data is expected in the form ((x1 y1)(x2 y2)...), fns must each accept 1 argument, returns list of co-efficients for powers of x in acsending order"
561+ "data is expected in the form ((x1 y1)(x2 y2)...), fns must each accept 1 argument, returns list of co-efficients for powers of x in ascending order"
562562 (if (< len.data len.fns) (err "cannot fit to less points than component functions"))
563563 (withs (xs (map car data)
564564 ys (map cadr data)
0 commit comments