egison-3.7.8: sample/math/number/9th-root-of-unity.egi
;(map 1#(modulo (** 2 %1) 9) (between 1 6));{2 4 8 7 5 1}
(define $z (rtu 9))
(define $a11 (+ z^1 z^8))
(define $a12 (+ z^2 z^7))
(define $a13 (+ z^4 z^5))
(define $b10 (+ a11 a12 a13))
(define $b10' 0)
(define $b11 (+ a11 (* w a12) (* w^2 a13)))
(define $b12 (+ a13 (* w a11) (* w^2 a12)));(* w b11)
(define $b13 (+ a12 (* w a13) (* w^2 a11)));(* w^2 b11)
;(define $b11' (rt 3 (** b11 3)))
(define $b11' (* 3 (rt 3 w)));Calculate manually
;(** b11 3)
;=>(+ (* 18 w) (* 9 (rtu 9)^6) (* 9 (rtu 9)^6 w^2) (* 9 (rtu 9)^3) (* 9 (rtu 9)^3 w^2))
;=>(* 27 w)
(define $b14 (+ a11 (* w a13) (* w^2 a12)))
(define $b15 (+ a12 (* w a11) (* w^2 a13)));(* w b14)
(define $b16 (+ a13 (* w a12) (* w^2 a11)));(* w^2 b14)
;(define $b14' (rt 3 (** b14 3)))
(define $b14' (* 3 (rt 3 w^2)));Caluculate manually
;(** b14 3)
;=>(+ (* 18 w^2) (* 9 (rtu 9)^6) (* 9 (rtu 9)^6 w) (* 9 (rtu 9)^3) (* 9 (rtu 9)^3 w))
;=>(* 27 w^2)
(define $a11' (/ (+ b10' b11' b14') 3))
a11'
;(+ (rt 3 w) (rt 3 w^2))
(define $z1' (fst (q-f' 1 (* -1 a11') 1)))
z1'
;(/ (+ (rt 3 w) (rt 3 w^2) (sqrt (+ (rt 3 w)^2 (* 2 (rt 3 w) (rt 3 w^2)) (rt 3 w^2)^2 -4))) 2)
(/ (+ (rt 3 w)
(rt 3 w^2)
(sqrt (+ -4
(rt 3 w)^2
(rt 3 w^2)^2
(* 2 (rt 3 w) (rt 3 w^2))
)))
2)