(define \$quartic-formula qt-f) (define \$qt-f (lambda [\$f \$x] (match (coefficients f x) (list math-expr) {[>>>>> (qt-f' a_4 a_3 a_2 a_1 a_0)]}))) (define \$qt-f' (lambda [\$a \$b \$c \$d \$e] (match [a b c d e] [math-expr math-expr math-expr math-expr math-expr] {[[,1 ,0 \$p ,0 \$q] (let* {[[\$s1 \$s2] (q-f' 1 p q)] [[\$r1 \$r2] (q-f' 1 0 (* -1 s1))] [[\$r3 \$r4] (q-f' 1 0 (* -1 s2))]} [r1 r2 r3 r4])] [[,1 ,0 \$p \$q \$r] (let* {[\$u (3#%1 (with-symbols {u} (c-f (+ (* u (+ p u)^2) (* -4 r u) (* -1 q^2)) u)))] [[\$r1 \$r2] (q-f (+ y^2 (/ (+ p u) 2) (* (sqrt u) (- y (/ q (* 2 u))))) y)] [[\$r3 \$r4] (q-f (+ y^2 (/ (+ p u) 2) (* -1 (sqrt u) (- y (/ q (* 2 u))))) y)]} [r1 r2 r3 r4])] [[,1 _ _ _ _] (4#[(- %1 (/ b 4)) (- %2 (/ b 4)) (- %3 (/ b 4)) (- %4 (/ b 4))] (with-symbols {x y} (qt-f (substitute {[x (- y (/ b 4))]} (+ x^4 (* b x^3) (* c x^2) (* d x) e)) y)))] [[_ _ _ _ _] (qt-f' 1 (/ b a) (/ c a) (/ d a) (/ e a))]}))) (define \$w (/ (+ -1 (* i (sqrt 3))) 2)) (* (- x 1) (- x 2) (- x 3) (- x 4)) ;=>(+ x^4 (* -10 x^3) (* 35 x^2) (* -50 x) 24) (qt-f (+ x^4 (* -10 x^3) (* 35 x^2) (* -50 x) 24) x) ;=>[4 1 3 2]