packages feed

egison-3.7.8: sample/math/number/7th-root-of-unity-2.egi

;(gen-cyclic-group (map 1#(modulo (* %1 3) 7) (between 1 6)))
;{{3 6 2 5 1 4} {2 4 6 1 3 5} {6 5 4 3 2 1} {4 1 5 2 6 3} {5 3 1 6 4 2} {1 2 3 4 5 6}}

(define $z (rtu 7))

(define $a11 (+ z   z^2 z^4))
(define $a12 (+ z^6 z^5 z^3))

(define $b10 (+ a11 a12));-1

(define $b10' b10)

(define $b11 (- a11 a12))
(define $b12 (- a12 a11))

(define $b11' (sqrt (** b11 2)))

(define $a11' (/ (+ b10' b11') 2));(/ (+ -1 (* i (sqrt 7))) 2)
(define $a12' (/ (- b10' b11') 2));(/ (+ -1 (* -1 i (sqrt 7))) 2)


(define $a21 (+ z   (* w z^2) (* w^2 z^4)))
(define $a22 (+ z^6 (* w z^5) (* w^2 z^3)))

(define $b20 (+ a21 a22))
(define $b21 (- a21 a22))
(define $b22 (- a22 a21))

(define $b20' (rt 3 (** b20 3)))
;(define $b21' (rt 3 (** b21 3)))
;(** b21 3)
;(+ (* 8 (rtu 7)) (* 8 (rtu 7)^2) (* -5 (rtu 7)^3) (* 5 (rtu 7)^4) (* -8 (rtu 7)^5) (* -8 (rtu 7)^6) (* 3 (rtu 7) w) (* 3 (rtu 7)^2 w) (* -3 (rtu 7)^5 w) (* -3 (rtu 7)^6 w) (* 3 (rtu 7)^3 w^2) (* -3 (rtu 7)^4 w^2))
(define $b21' (rt 3 (+ (* 5 a11') (* -5 a12') (* w^2 -3 a11') (* w^2 3 a12'))));Calculate manually

(define $a21' (/ (+ b20' b21') 2))
(define $a22' (/ (- b20' b21') 2))


(define $a31 (+ z   (* w^2 z^2) (* w z^4)))
(define $a32 (+ z^6 (* w^2 z^5) (* w z^3)))

(define $b30 (+ a31 a32))
(define $b31 (- a31 a32))
(define $b32 (- a32 a31))

(define $b30' (rt 3 (** b30 3)))
;(define $b31' (rt 3 (** b31 3)))
;(** b31 3)
;(+ (* 5 (rtu 7)) (* 8 (rtu 7)^2) (* -5 (rtu 7)^3) (* 5 (rtu 7)^4) (* -8 (rtu 7)^5) (* -5 (rtu 7)^6) (* -3 (rtu 7) w) (* 3 (rtu 7)^3 w) (* -3 (rtu 7)^4 w) (* 3 (rtu 7)^6 w) (* 3 (rtu 7)^2 w^2) (* -3 (rtu 7)^5 w^2))
(define $b31' (rt 3 (+ (* 5 a11') (* -5 a12') (* w -3 a11') (* w 3 a12'))));Calculate manually

(define $a31' (/ (+ b30' b31') 2))
(define $a32' (/ (- b30' b31') 2))

(define $z1' (/ (+ a11' a21' a31') 3))
(define $z6' (/ (+ a12' a22' a32') 3))

z1'
;(/ (+ -1 (* i (sqrt 7)) (rt 3 (+ 14 (* 21 w))) (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w^2))) (rt 3 (+ -7 (* -21 w))) (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w)))) 6)

(/ (+ -1
      (rt 3 (+ 14 (* 21 w)))
      (rt 3 (+ -7 (* -21 w)))
      (* i (sqrt 7))
      (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w)))
      (rt 3 (+ (* 5 i (sqrt 7)) (* -3 i (sqrt 7) w^2)))
      )
   6)