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

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.6
\[\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)\]

Derivation

  1. Initial program 7.2

    \[\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  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.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  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.im\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  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.im\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.re\]
  7. Final simplification0.6

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

Reproduce

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

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

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

Details

Time bar (total: 36.6s)Debug log

sample76.0ms

Algorithm
intervals
Results
54.0ms455×body80valid

simplify170.0ms

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

prune9.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.7b

localize33.0ms

Local error

Found 2 expressions with local error:

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

rewrite36.0ms

Algorithm
rewrite-expression-head
Rules
14×associate-*r/
frac-add
add-log-exp
flip-+
flip3-+
flip--
flip3--
add-cube-cbrt
associate-*r*
*-un-lft-identity
add-sqr-sqrt
add-exp-log
add-cbrt-cube
distribute-lft-in
sum-log
associate-+r+
associate-+l+
pow1
distribute-rgt-in
associate-+l-
*-commutative
diff-log
sub-neg
+-commutative
Counts
2 → 40
Calls
2 calls:
Slowest
27.0ms
(* x.im (+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re))))
9.0ms
(+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re)))

series64.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
33.0ms
(* x.im (+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re))))
31.0ms
(+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re)))

simplify5.1s

Counts
32 → 46
Calls
32 calls:
Slowest
763.0ms
(+ (* (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))) (+ (* x.re x.re) (- (* x.re x.re) (* x.re x.re)))) (* (+ (* x.re x.re) (* x.im x.im)) (* x.re (+ (pow x.re 3) (pow x.re 3)))))
601.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.re) (- (* x.re x.re) (* x.re x.re))))
525.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.re) (- (* x.re x.re) (* x.re x.re))))
525.0ms
(- (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re)))
355.0ms
(sqrt (+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re))))

prune362.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 6.6b

localize31.0ms

Local error

Found 4 expressions with local error:

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

rewrite35.0ms

Algorithm
rewrite-expression-head
Rules
12×associate-*l/
add-log-exp
associate-*l*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
flip-+
flip3-+
add-exp-log
frac-add
add-cbrt-cube
pow1
flip--
flip3--
*-commutative
sum-log
+-commutative
difference-of-squares
Counts
4 → 53
Calls
4 calls:
Slowest
13.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
8.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
8.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
4.0ms
(+ (* x.re x.im) (* x.im x.re))

series110.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
46.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
39.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
13.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
11.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify5.5s

Counts
31 → 65
Calls
31 calls:
Slowest
2.3s
(* (exp (* (- (* x.re x.re) (* x.im x.im)) x.im)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
481.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)
364.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.im)
256.0ms
(+ (* (* (- (pow (* x.re x.re) 3) (pow (* x.im x.im) 3)) 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))))) (* (+ (* (* 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.re)))

prune490.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

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

rewrite24.0ms

Algorithm
rewrite-expression-head
Rules
42×associate-*l/
20×flip-+
20×flip3-+
16×frac-add
12×frac-times
flip--
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
sum-log
+-commutative
cbrt-unprod
prod-exp
pow-prod-down
associate-*r*
Counts
4 → 74
Calls
4 calls:
Slowest
9.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
7.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
4.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
2.0ms
(+ (* x.re x.im) (* x.im x.re))

series130.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
55.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
36.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
19.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
19.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify12.1s

Counts
67 → 86
Calls
67 calls:
Slowest
712.0ms
(+ (* (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) 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))))) (* (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im)))) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)))
636.0ms
(+ (* (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im 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))))) (* (* (- x.re x.im) (+ x.re x.im)) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)))
601.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)))))
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)))))
512.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)

prune817.0ms

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

localize29.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 x.re)))
12.8b
(cbrt (+ (* x.re x.im) (* x.im x.re)))
0.5b
(* (cbrt (+ (* x.re x.im) (* x.im x.re))) (cbrt (+ (* x.re x.im) (* x.im x.re))))

rewrite17.0ms

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

series596.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
210.0ms
(* (cbrt (+ (* x.re x.im) (* x.im x.re))) (cbrt (+ (* x.re x.im) (* x.im x.re))))
153.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
125.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
108.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))

simplify7.0s

Counts
59 → 87
Calls
59 calls:
Slowest
668.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))))))
615.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))))
532.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))))))
450.0ms
(* (+ (* x.re x.im) (* x.im x.re)) (+ (* x.re x.im) (* x.im x.re)))
433.0ms
(* (+ (* x.re x.im) (* x.im x.re)) (+ (* x.re x.im) (* x.im x.re)))

prune836.0ms

Pruning

9 alts after pruning (8 fresh and 1 done)

Merged error: 0.0b

regimes242.0ms

Accuracy

0% (0.5b remaining)

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

bsearch2.0ms

end0.0ms

sample2.9s

Algorithm
intervals
Results
2.7s14235×body80valid