Average Error: 7.2 → 0.7
Time: 1.4m
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(\sqrt[3]{\left(x.re - x.im\right) \cdot x.re} \cdot \left(\sqrt[3]{\left(x.re - x.im\right) \cdot x.re} \cdot \sqrt[3]{\left(x.re - x.im\right) \cdot x.re}\right)\right) \cdot \left(x.im + x.re\right) - \left(x.re \cdot x.im + x.re \cdot x.im\right) \cdot x.im\]

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.2
Target0.2
Herbie0.7
\[\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.2

    \[\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.2

    \[\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.7

    \[\leadsto \left(x.re + x.im\right) \cdot \color{blue}{\left(\left(\sqrt[3]{\left(x.re - x.im\right) \cdot x.re} \cdot \sqrt[3]{\left(x.re - x.im\right) \cdot x.re}\right) \cdot \sqrt[3]{\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\]
  7. Final simplification0.7

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

Reproduce

herbie shell --seed 2019022 
(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: 1.4m)Debug log

sample92.0ms

Algorithm
intervals
Results
76.0ms450×body80valid

simplify227.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
226.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: 9.3b

localize44.0ms

Local error

Found 4 expressions with local error:

9.3b
(* (- (* 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))

rewrite41.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
20.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
8.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
8.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
4.0ms
(+ (* x.re x.im) (* x.im x.re))

series138.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
46.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.re)
45.0ms
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
27.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
19.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify4.1s

Counts
31 → 66
Calls
31 calls:
Slowest
516.0ms
(/ (exp (* (- (* x.re x.re) (* x.im x.im)) x.re)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
448.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.im)
363.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)))
353.0ms
(* (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))) x.re)
301.0ms
(* (- (pow (* x.re x.re) 3) (pow (* x.im x.im) 3)) x.re)

prune600.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.1b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite49.0ms

Algorithm
rewrite-expression-head
Rules
44×associate-*l/
18×flip-+
18×flip3-+
16×frac-sub
12×frac-times
11×flip--
11×flip3--
associate-*l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
associate-*r/
add-cbrt-cube
pow1
*-commutative
cbrt-unprod
prod-exp
pow-prod-down
associate-*r*
diff-log
sub-neg
Counts
4 → 77
Calls
4 calls:
Slowest
23.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))
8.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)
5.0ms
(* (- x.re x.im) x.re)

series110.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
35.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.re))
27.0ms
(- (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ (* x.re x.im) (* x.im x.re)) x.im))
27.0ms
(* (- x.re x.im) x.re)
21.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.im)

simplify14.2s

Counts
70 → 89
Calls
70 calls:
Slowest
596.0ms
(- (* (* (- (* 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)))
570.0ms
(* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.re))
568.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)))
561.0ms
(* (* (- x.re x.im) (+ x.re x.im)) (- (* x.re x.im) (* x.im x.re)))
534.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)))

prune841.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 0b

localize14.0ms

Local error

Found 4 expressions with local error:

15.9b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
15.9b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
15.9b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
0.2b
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))))

rewrite61.0ms

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

series567.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
162.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
157.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
125.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re)))
122.0ms
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.re))))

simplify50.7s

Counts
199 → 167
Calls
199 calls:
Slowest
1.1s
(* (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- x.re x.im) x.re))) (cbrt (* (+ x.re x.im) (* (- (* x.re x.re) (* x.im x.im)) x.re))))
997.0ms
(* (* (+ x.re x.im) (* (- x.re x.im) x.re)) (* (+ x.re x.im) (* (- x.re x.im) x.re)))
986.0ms
(* (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.re))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.re))))
877.0ms
(exp (* 1/3 (- (log -1) (* 3 (log (/ -1 x.re))))))
820.0ms
(exp (* 1/3 (- (log -1) (* 3 (log (/ -1 x.re))))))

prune2.7s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0b

localize29.0ms

Local error

Found 4 expressions with local error:

11.4b
(cbrt (* (- x.re x.im) x.re))
11.4b
(cbrt (* (- x.re x.im) x.re))
11.4b
(cbrt (* (- x.re x.im) x.re))
0.5b
(* (cbrt (* (- x.re x.im) x.re)) (cbrt (* (- x.re x.im) x.re)))

rewrite18.0ms

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

series1.1s

Counts
4 → 12
Calls
4 calls:
Slowest
306.0ms
(cbrt (* (- x.re x.im) x.re))
295.0ms
(cbrt (* (- x.re x.im) x.re))
277.0ms
(cbrt (* (- x.re x.im) x.re))
261.0ms
(* (cbrt (* (- x.re x.im) x.re)) (cbrt (* (- x.re x.im) x.re)))

simplify4.0s

Counts
49 → 77
Calls
49 calls:
Slowest
341.0ms
(* (cbrt (* (- (pow x.re 3) (pow x.im 3)) x.re)) (cbrt (* (- (* x.re x.re) (* x.im x.im)) x.re)))
310.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))
288.0ms
(* (cbrt (* (- (* x.re x.re) (* x.im x.im)) x.re)) (cbrt (* (- (pow x.re 3) (pow x.im 3)) x.re)))
265.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))
247.0ms
(* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 x.re)))))))

prune799.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0b

regimes140.0ms

Accuracy

0% (0.7b remaining)

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

bsearch3.0ms

end0.0ms

sample2.8s

Algorithm
intervals
Results
2.6s14391×body80valid