(defun substitute-in-polynomial (plug-value &rest coefficients) (let ((sum-collector 0)) (let ((iterator (- (length coefficients) 1))) (dolist (coefficient coefficients) (+ sum-collector (* coefficient (expt plug-value iterator))) (decf iterator))) (sum-collector))) (defun polynomial-interface (&key order &key tolerance &key start &key end &rest coefficients) (if (not (= (length coefficients) (+ order 1))) (format t "Invalid number of arguments")) (do ((test-expression (< (* (substitute-in-polynomial left coefficients) (substitute-in-polynomial right coefficients)) 0)) (left start (if test-expression mid left)) (right end (if test-expression right mid))) (<= (abs (- right left)) tolerance) (format t "The root is in between ~a and ~a" left right)))