Average Error: 7.0 → 0.2
Time: 1.6m
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) + x.re \cdot \left(x.re \cdot x.im + x.re \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.2
\[\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.0

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

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

    \[\leadsto \left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right) + x.re \cdot \left(x.re \cdot x.im + x.re \cdot x.im\right)\]

Reproduce

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

start89.0ms

Algorithm
intervals

setup152.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 8.6b

localize27.0ms

Local error

Found 4 expressions with local error:

8.6b
(* (- (* 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.2b
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
0.0b
(+ (* x.re x.im) (* x.im x.re))

rewrite20.0ms

Algorithm
rewrite-expression-head
Counts
4 → 53
Calls

4 calls. Slowest were:

6.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
4.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
4.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

series128.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

54.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
48.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
14.0ms
(+ (* x.re x.im) (* x.im x.re))
12.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

simplify6.4s

Counts
31 → 65
Calls

31 calls. Slowest were:

2.7s
(* (exp (* (- (* x.re x.re) (* x.im x.im)) x.im)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
494.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)
441.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)))

prune647.0ms

Pruning

9 alts after pruning (9 fresh and 0 done)

Merged error: 0.1b

localize13.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.2b
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
0.0b
(+ (* x.re x.im) (* x.im x.re))

rewrite39.0ms

Algorithm
rewrite-expression-head
Counts
4 → 74
Calls

4 calls. Slowest were:

21.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
8.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
6.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

series123.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

42.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
39.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
22.0ms
(+ (* x.re x.im) (* x.im x.re))
19.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

simplify13.3s

Counts
67 → 86
Calls

67 calls. Slowest were:

624.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)))))
598.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)))
590.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)))))

prune1.4s

Pruning

11 alts after pruning (10 fresh and 1 done)

Merged error: 0b

localize28.0ms

Local error

Found 4 expressions with local error:

11.8b
(cbrt (+ (* x.re x.im) (* x.im x.re)))
11.8b
(cbrt (+ (* x.re x.im) (* x.im x.re)))
11.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))))

rewrite24.0ms

Algorithm
rewrite-expression-head
Counts
4 → 75
Calls

4 calls. Slowest were:

15.0ms
(* (cbrt (+ (* x.re x.im) (* x.im x.re))) (cbrt (+ (* x.re x.im) (* x.im x.re))))
2.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
2.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))

series568.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

182.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)))
126.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))
107.0ms
(cbrt (+ (* x.re x.im) (* x.im x.re)))

simplify7.9s

Counts
59 → 87
Calls

59 calls. Slowest were:

811.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))))))
712.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))))))
704.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))))

prune1.1s

Pruning

11 alts after pruning (9 fresh and 2 done)

Merged error: 0b

localize24.0ms

Local error

Found 4 expressions with local error:

13.8b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
13.8b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
13.8b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
0.3b
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))))

rewrite57.0ms

Algorithm
rewrite-expression-head
Counts
4 → 155
Calls

4 calls. Slowest were:

29.0ms
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))))
5.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
5.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

series557.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

147.0ms
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))))
143.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
134.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
133.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

simplify53.7s

Counts
199 → 167
Calls

199 calls. Slowest were:

867.0ms
(* (cbrt (* (+ x.re x.im) (* (- (* x.re x.re) (* x.im x.im)) x.im))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (pow x.re 3) (pow x.im 3)) x.im))))
775.0ms
(* (cbrt (* (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im))) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im))))) (cbrt (+ (* x.re x.re) (- (* x.im x.im) (* x.re x.im)))))
728.0ms
(* (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))))

prune2.9s

Pruning

11 alts after pruning (8 fresh and 3 done)

Merged error: 0b

regimes126.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms