Average Error: 7.0 → 0.6
Time: 37.7s
Precision: 64
Internal Precision: 128
\[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
\[\left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right) - \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \left(\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}\right)\]

Error

Bits error versus x.re

Bits error versus x.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.0
Target0.3
Herbie0.6
\[\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)\]

Derivation

  1. Initial program 7.0

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  2. Using strategy rm
  3. Applied difference-of-squares7.0

    \[\leadsto \color{blue}{\left(\left(x.re + x.im\right) \cdot \left(x.re - x.im\right)\right)} \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  4. Applied associate-*l*0.2

    \[\leadsto \color{blue}{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right)} - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im\]
  5. Using strategy rm
  6. Applied add-cube-cbrt0.6

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right) - \color{blue}{\left(\sqrt[3]{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im}\right) \cdot \sqrt[3]{\left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im}}\]
  7. Final simplification0.6

    \[\leadsto \left(\left(x.re - x.im\right) \cdot x.re\right) \cdot \left(x.im + x.re\right) - \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \left(\sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im} \cdot \sqrt[3]{\left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im}\right)\]

Reproduce

herbie shell --seed 2018360 
(FPCore (x.re x.im)
  :name "math.cube on complex, real part"

  :herbie-target
  (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im))))

  (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))

Details

Time bar (total: 33.4s)Debug log

start83.0ms

Algorithm
intervals

setup250.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 8.8b

localize45.0ms

Local error

Found 4 expressions with local error:

8.8b
(* (- (* x.re x.re) (* x.im x.im)) x.re)
0.2b
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
0.2b
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
0.0b
(+ (* x.re x.im) (* x.im x.re))

rewrite21.0ms

Algorithm
rewrite-expression-head
Counts
4 → 54
Calls

4 calls. Slowest were:

9.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
5.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
4.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series108.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

38.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
30.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
28.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
12.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify3.8s

Counts
31 → 66
Calls

31 calls. Slowest were:

521.0ms
(* (+ (* x.re x.re) (* x.im x.im)) (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re)))))
385.0ms
(* (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))) x.re)
302.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))

prune803.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.1b

localize17.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (+ x.re x.im) (* (- x.re x.im) x.re))
0.2b
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
0.2b
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
0.0b
(* (- x.re x.im) x.re)

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 77
Calls

4 calls. Slowest were:

15.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
10.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
9.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

series122.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

40.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
39.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
22.0ms
(* (- x.re x.im) x.re)
21.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

simplify13.7s

Counts
70 → 89
Calls

70 calls. Slowest were:

816.0ms
(* (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ x.re x.im)) (- (* x.re x.im) (* x.im x.re)))
522.0ms
(- (* (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.re)) (- (* x.re x.im) (* x.im x.re))) (* (* (- x.re x.im) (+ x.re x.im)) (* (- (* (* x.re x.im) (* x.re x.im)) (* (* x.im x.re) (* x.im x.re))) x.im)))
460.0ms
(* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im))))

prune1.1s

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0b

localize27.0ms

Local error

Found 4 expressions with local error:

22.5b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
22.5b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
22.5b
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
0.4b
(* (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)) (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)))

rewrite38.0ms

Algorithm
rewrite-expression-head
Counts
4 → 65
Calls

4 calls. Slowest were:

22.0ms
(* (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)) (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
5.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
5.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))

series673.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

199.0ms
(* (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)) (cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
173.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
170.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))
131.0ms
(cbrt (* (+ (* x.re x.im) (* x.im x.re)) x.im))

simplify8.1s

Counts
49 → 77
Calls

49 calls. Slowest were:

758.0ms
(* (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))) (cbrt (- (* x.re x.im) (* x.im x.re))))
751.0ms
(* (cbrt (- (* x.re x.im) (* x.im x.re))) (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))))
580.0ms
(* (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))) (cbrt (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))))

prune961.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0b

localize15.0ms

Local error

Found 4 expressions with local error:

0.6b
(cbrt (+ x.re x.im))
0.6b
(cbrt (+ x.re x.im))
0.6b
(cbrt (+ x.re x.im))
0.5b
(* (cbrt (+ x.re x.im)) (cbrt (+ x.re x.im)))

rewrite8.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

5.0ms
(* (cbrt (+ x.re x.im)) (cbrt (+ x.re x.im)))
1.0ms
(cbrt (+ x.re x.im))
1.0ms
(cbrt (+ x.re x.im))

series657.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

177.0ms
(* (cbrt (+ x.re x.im)) (cbrt (+ x.re x.im)))
171.0ms
(cbrt (+ x.re x.im))
167.0ms
(cbrt (+ x.re x.im))
142.0ms
(cbrt (+ x.re x.im))

simplify1.6s

Counts
59 → 87
Calls

59 calls. Slowest were:

172.0ms
(- (+ (* 1/3 (* (pow (/ 1 (pow x.im 2)) 1/3) x.re)) (pow x.im 1/3)) (* 1/9 (* (pow (/ 1 (pow x.im 5)) 1/3) (pow x.re 2))))
156.0ms
(- (+ (* 1/3 (* (pow (/ 1 (pow x.im 2)) 1/3) x.re)) (pow x.im 1/3)) (* 1/9 (* (pow (/ 1 (pow x.im 5)) 1/3) (pow x.re 2))))
147.0ms
(- (+ (pow x.im 2/3) (* 2/3 (* (pow (/ 1 x.im) 1/3) x.re))) (* 1/9 (* (pow (/ 1 (pow x.im 4)) 1/3) (pow x.re 2))))

prune1.2s

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 0b

regimes147.0ms

Accuracy

0% (0.5b remaining)

Error of 0.6b against oracle of 0.0b and baseline of 0.6b

bsearch4.0ms