| | |
| | | |
| | | |
| | | ; GEN-SRR |
| | | |
| | | (defmethod! gen-srr (&rest subdivisions) |
| | | |
| | | :icon 988 |
| | | :initvals '(nil) |
| | | :indoc '("subdivisions") |
| | | :numouts 2 |
| | | (let ((valuelist (mat-trans |
| | | (loop for sub in subdivisions |
| | | collect (multiple-value-list (gen-wave1 sub)))))) |
| | | |
| | | |
| | | (values (caar valuelist) |
| | | (om* (expt 0.5 (length subdivisions)) |
| | | (om+ (length subdivisions) ;(apply 'om+ (second valuelist))))) |
| | | (loop for i from 0 to (1- (length (car (second valuelist)))) |
| | | collect (reduce '+ (loop for list in (second valuelist) collect (nth i list))) |
| | | )) |
| | | ) |
| | | ) |
| | | ) |
| | | ) |
| | | |
| | | ; legacy method |
| | | |
| | |
| | | ) |
| | | ) |
| | | ) |
| | | |
| | | (defmethod! gen-srr (&rest subdivisions) |
| | | |
| | | :icon 988 |
| | | :initvals '(nil) |
| | | :indoc '("subdivisions") |
| | | :numouts 2 |
| | | (let ((valuelist (mat-trans |
| | | (loop for sub in subdivisions |
| | | collect (multiple-value-list (gen-wave1 sub :sampling-factor 2)))))) |
| | | ; (print valuelist) |
| | | |
| | | (values (caar valuelist) |
| | | (om* (expt 0.5 (length subdivisions)) |
| | | (om+ (length subdivisions) ;(apply 'om+ (second valuelist))))) |
| | | (loop for i from 0 to (1- (length (car (second valuelist)))) |
| | | collect (reduce '+ (loop for list in (second valuelist) collect (nth i list))) |
| | | )) |
| | | ) |
| | | ) |
| | | ) |
| | | ) |
| | | |
| | | |
| | | (let* ((pointlist1 (multiple-value-list (gen-wave1 subdivision1))) |
| | | (pointlist2 (multiple-value-list (gen-wave1 subdivision2))) |
| | | ) |
| | | (values (first pointlist1) |
| | | (om* 0.25 (om+ 2 (om+ (second pointlist1) (second pointlist2)))) |
| | | ) |
| | | ; polar-plot |
| | | |
| | | (defmethod! polar-plot ((srr bpf)) |
| | | (let* ((xpoints (x-points srr)) |
| | | (ypoints (y-points srr)) |
| | | (x-factor (/ 360.0 (* 2 pi))) |
| | | (polar-values (multiple-value-list (ad->xy (om* x-factor xpoints) ypoints)))) |
| | | (simple-bpf-from-list (first polar-values) (second polar-values) 'bpc (decimals srr)) |
| | | ) |
| | | ) |
| | | |
| | | (loop for i from 0 to (1- (length (car *testwave*))) |
| | | collect (reduce '+ (loop for list in *testwave* collect (nth i list))) |
| | | ) |
| | | |
| | | (loop for i from 0 to (1- (length (car *testwave*))) |
| | | collect ;(dx->x (nth i (car *testwave*)) (loop for list in (cdr *testwave*) collect (nth i list))) |
| | | (reduce '+ (loop for list in *testwave* collect (nth i list))) |
| | | ) |
| | | |
| | | (loop for list in *testwave* collect (nth 0 list)) |
| | | |
| | | *testwave* |
| | | |
| | | (nth 0 (car *testwave*)) |
| | | (dx->x |
| | | (cdr *testwave*) |
| | | |
| | | (defparameter *testwave* '((1.0 -0.98999 0.96017 -0.91113 0.84385 -0.75969 0.66032 -0.54773 0.42418 -0.29214 0.15425 -0.01328 -0.12796) (1.0 0.07074 -0.98999 -0.2108 0.96017 0.34664 -0.91113 -0.47554 0.84385 0.59492 -0.75969 -0.7024 0.66032) (1.0 -0.41615 -0.65364 0.96017 -0.1455 -0.83907 0.84385 0.13674 -0.95766 0.66032 0.40808 -0.99996 0.42418))) |
| | | |
| | | |
| | | (om+ '((1 2) (5 6))) |
| | | (om+ '(1 2) '(5 6) '(5 6)) |
| | | (om+ '((1.0 -0.98999 0.96017 -0.91113 0.84385 -0.75969 0.66032 -0.54773 0.42418 -0.29214 0.15425 -0.01328 -0.12796) (1.0 0.07074 -0.98999 -0.2108 0.96017 0.34664 -0.91113 -0.47554 0.84385 0.59492 -0.75969 -0.7024 0.66032) (1.0 -0.41615 -0.65364 0.96017 -0.1455 -0.83907 0.84385 0.13674 -0.95766 0.66032 0.40808 -0.99996 0.42418))) |
| | | (apply 'om+ '((1.0 -0.98999 0.96017 -0.91113 0.84385 -0.75969 0.66032 -0.54773 0.42418 -0.29214 0.15425 -0.01328 -0.12796) (1.0 0.07074 -0.98999 -0.2108 0.96017 0.34664 -0.91113 -0.47554 0.84385 0.59492 -0.75969 -0.7024 0.66032) (1.0 -0.41615 -0.65364 0.96017 -0.1455 -0.83907 0.84385 0.13674 -0.95766 0.66032 0.40808 -0.99996 0.42418))) |
| | | |
| | | (apply 'om+ '((1 2) (5 6))) |
| | | |
| | | (mapcar |
| | | #'(lambda (x) (om+ 2 x)) |
| | | '((1 2) (5 6))) |
| | | |
| | | |
| | | |
| | | |
| | | ; output the object or the point lists |
| | | ; optionally output cartesian or polar representation |
| | |
| | | (num-b (car b)) (den-b (cdr b))) |
| | | (< (* num-a (float den-b)) (* num-b (float den-a)))))) |
| | | |
| | | ; (loop for (a . b) in fractions collect |
| | | ; (/ a b) |
| | | ; ) |
| | | (loop for (a . b) in fractions collect |
| | | (/ a b) |
| | | ) |
| | | )) |
| | | |
| | | (defparameter *farey-seq* '(0 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1)) |
| | | |
| | | (loop for item in *farey-seq* |
| | | collect (unless (zerop item) |
| | | (/ 1 item))) |
| | | |
| | | ;; Example usage |
| | | (print (farey-sequence 5)) |
| | | (farey-sequence 5) |