Average Error: 7.0 → 0.5
Time: 29.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) - \left(\left(\sqrt[3]{x.im} \cdot \left(\sqrt[3]{2} \cdot \sqrt[3]{x.re}\right)\right) \cdot \sqrt[3]{x.re \cdot \left(x.im + x.im\right)}\right) \cdot \left(\sqrt[3]{x.re \cdot x.im + x.re \cdot x.im} \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.2
Herbie0.5
\[\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(\left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right) \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right)} \cdot x.im\]
  7. Applied associate-*l*0.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]{x.re \cdot x.im + x.im \cdot x.re} \cdot \sqrt[3]{x.re \cdot x.im + x.im \cdot x.re}\right) \cdot \left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot x.im\right)}\]
  8. Simplified0.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]{x.re \cdot \left(x.im + x.im\right)} \cdot \sqrt[3]{x.re \cdot \left(x.im + x.im\right)}\right)} \cdot \left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot x.im\right)\]
  9. Taylor expanded around inf 47.1

    \[\leadsto \left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.re\right) - \left(\sqrt[3]{x.re \cdot \left(x.im + x.im\right)} \cdot \color{blue}{\left(e^{\frac{-1}{3} \cdot \left(\log \left(\frac{1}{x.im}\right) + \log \left(\frac{1}{x.re}\right)\right)} \cdot \sqrt[3]{2}\right)}\right) \cdot \left(\sqrt[3]{x.re \cdot x.im + x.im \cdot x.re} \cdot x.im\right)\]
  10. Simplified0.5

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

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

Reproduce

herbie shell --seed 2019021 
(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: 28.7s)Debug log

sample73.0ms

Algorithm
intervals
Results
49.0ms455×body80valid

simplify235.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
235.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))

prune16.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.4b

localize45.0ms

Local error

Found 4 expressions with local error:

6.5b
(* (- (* x.re x.re) (* x.im x.im)) x.re)
0.1b
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
0.1b
(- (* (- (* 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))

rewrite37.0ms

Algorithm
rewrite-expression-head
Rules
12×associate-*l/
add-log-exp
associate-*l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
flip--
flip-+
frac-sub
add-exp-log
add-cbrt-cube
flip3--
flip3-+
pow1
*-commutative
difference-of-squares
diff-log
sub-neg
sum-log
+-commutative
Counts
4 → 54
Calls
4 calls:
Slowest
15.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
10.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
9.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
2.0ms
(+ (* x.re x.im) (* x.im x.re))

series112.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
43.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
26.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
24.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
19.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify3.8s

Counts
31 → 66
Calls
31 calls:
Slowest
538.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
403.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)
336.0ms
(* (+ (* (* x.re x.re) (* x.re x.re)) (+ (* (* x.im x.im) (* x.im x.im)) (* (* x.re x.re) (* x.im x.im)))) (- (* x.re x.im) (* x.im x.re)))
321.0ms
(* (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))) x.re)
261.0ms
(- (* (* (- (pow (* x.re x.re) 3) (pow (* x.im x.im) 3)) x.re) (+ (* (* x.re x.im) (* x.re x.im)) (- (* (* x.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))) (* (+ (* (* x.re x.re) (* x.re x.re)) (+ (* (* x.im x.im) (* x.im x.im)) (* (* x.re x.re) (* x.im x.im)))) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)))

prune581.0ms

Pruning

6 alts after pruning (6 fresh and 0 done)

Merged error: 0.1b

localize23.0ms

Local error

Found 4 expressions with local error:

0.2b
(* (+ x.re x.im) (* (- x.re x.im) x.re))
0.1b
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
0.1b
(- (* (+ 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.im x.re))

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
42×associate-*l/
19×flip-+
19×flip3-+
16×frac-sub
12×frac-times
10×flip--
10×flip3--
add-log-exp
add-cube-cbrt
add-exp-log
associate-*r/
associate-*l*
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
*-commutative
cbrt-unprod
prod-exp
pow-prod-down
associate-*r*
diff-log
sub-neg
sum-log
+-commutative
Counts
4 → 75
Calls
4 calls:
Slowest
13.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
12.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
7.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
2.0ms
(+ (* x.re x.im) (* x.im x.re))

series91.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
31.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
26.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
18.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
16.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify13.1s

Counts
67 → 87
Calls
67 calls:
Slowest
1.0s
(- (* (* (- (* 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.im x.re) (* x.im x.re)) (* (* x.re x.im) (* x.im x.re))))) (* (* (- x.re x.im) (+ x.re x.im)) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)))
553.0ms
(* (+ x.re 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)))))
524.0ms
(- (* (* (- (* x.re x.re) (* x.im x.im)) (* (- (pow x.re 3) (pow x.im 3)) x.re)) (- (* x.re x.im) (* x.im x.re))) (* (* (- x.re x.im) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im)))) (* (- (* (* x.re x.im) (* x.re x.im)) (* (* x.im x.re) (* x.im x.re))) x.im)))
491.0ms
(- (* (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) x.re)) (- (* x.re x.im) (* x.im x.re))) (* (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im)))) (* (- (* (* x.re x.im) (* x.re x.im)) (* (* x.im x.re) (* x.im x.re))) x.im)))
468.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)))

prune828.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize27.0ms

Local error

Found 4 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Rules
18×associate-*r/
18×cbrt-div
flip-+
flip3-+
pow1
add-cube-cbrt
pow1/3
*-un-lft-identity
add-sqr-sqrt
cbrt-prod
add-exp-log
add-log-exp
associate-*l*
associate-*r*
add-cbrt-cube
frac-times
pow-prod-up
associate-*l/
pow-prod-down
cbrt-unprod
*-commutative
prod-exp
pow-plus
pow2
Counts
4 → 67
Calls
4 calls:
Slowest
10.0ms
(* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im))))
1.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
1.0ms
(cbrt (* x.re (+ x.im x.im)))
1.0ms
(cbrt (* x.re (+ x.im x.im)))

series519.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
186.0ms
(* (cbrt (* x.re (+ x.im x.im))) (cbrt (* x.re (+ x.im x.im))))
130.0ms
(cbrt (* x.re (+ x.im x.im)))
109.0ms
(cbrt (* x.re (+ x.im x.im)))
95.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))

simplify3.1s

Counts
51 → 79
Calls
51 calls:
Slowest
425.0ms
(* (* x.re (+ x.im x.im)) (* x.re (+ x.im x.im)))
405.0ms
(* (* x.re (+ x.im x.im)) (* x.re (+ x.im x.im)))
271.0ms
(cbrt (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)))
222.0ms
(* (pow (cbrt 2) 2) (exp (* 1/3 (+ (* 2 (log x.im)) (* 2 (log x.re))))))
147.0ms
(* (exp (* -1/3 (+ (* 2 (log (/ -1 x.re))) (* 2 (log (/ -1 x.im)))))) (pow (cbrt 2) 2))

prune1.0s

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 4 expressions with local error:

12.8b
(cbrt (+ (* x.re x.im) (* x.im x.re)))
12.8b
(cbrt (* x.re (+ x.im x.im)))
1.0b
(cbrt 2)
0.7b
(cbrt x.re)

rewrite3.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
pow1/3
add-cbrt-cube
cbrt-div
pow1
cbrt-prod
flip-+
associate-*r/
flip3-+
Counts
4 → 40
Calls
4 calls:
Slowest
1.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
1.0ms
(cbrt (* x.re (+ x.im x.im)))
0.0ms
(cbrt 2)
0.0ms
(cbrt x.re)

series505.0ms

Counts
4 → 10
Calls
4 calls:
Slowest
293.0ms
(cbrt x.re)
112.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
100.0ms
(cbrt (* x.re (+ x.im x.im)))
0.0ms
(cbrt 2)

simplify1.0s

Counts
18 → 50
Calls
18 calls:
Slowest
271.0ms
(cbrt (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)))
150.0ms
(* (exp (* -1/3 (+ (log (/ -1 x.re)) (log (/ -1 x.im))))) (cbrt 2))
115.0ms
(* (exp (* -1/3 (+ (log (/ -1 x.re)) (log (/ -1 x.im))))) (cbrt 2))
112.0ms
(* (exp (* -1/3 (+ (log (/ 1 x.im)) (log (/ 1 x.re))))) (cbrt 2))
103.0ms
(* (exp (* -1/3 (+ (log (/ 1 x.im)) (log (/ 1 x.re))))) (cbrt 2))

prune686.0ms

Pruning

9 alts after pruning (7 fresh and 2 done)

Merged error: 0.0b

regimes108.0ms

Accuracy

0% (0.5b remaining)

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

bsearch4.0ms

end0.0ms

sample2.7s

Algorithm
intervals
Results
2.5s14295×body80valid