Average Error: 7.0 → 0.2
Time: 13.7s
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 \cdot x.im\right) \cdot 3\right) \cdot x.re - {x.im}^{3}\]

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. Simplified7.1

    \[\leadsto \color{blue}{x.im \cdot \left(\left(x.re \cdot x.re - x.im \cdot x.im\right) + x.re \cdot \left(x.re + x.re\right)\right)}\]
  3. Taylor expanded around 0 7.0

    \[\leadsto \color{blue}{3 \cdot \left(x.im \cdot {x.re}^{2}\right) - {x.im}^{3}}\]
  4. Using strategy rm
  5. Applied unpow27.0

    \[\leadsto 3 \cdot \left(x.im \cdot \color{blue}{\left(x.re \cdot x.re\right)}\right) - {x.im}^{3}\]
  6. Applied associate-*r*0.2

    \[\leadsto 3 \cdot \color{blue}{\left(\left(x.im \cdot x.re\right) \cdot x.re\right)} - {x.im}^{3}\]
  7. Using strategy rm
  8. Applied associate-*r*0.2

    \[\leadsto \color{blue}{\left(3 \cdot \left(x.im \cdot x.re\right)\right) \cdot x.re} - {x.im}^{3}\]
  9. Final simplification0.2

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

Reproduce

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

sample125.0ms

Algorithm
intervals

simplify147.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune331.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 6.5b

localize36.0ms

Local error

Found 3 expressions with local error:

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

rewrite25.0ms

Algorithm
rewrite-expression-head
Counts
3 → 53
Calls

3 calls. Slowest were:

13.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)))
2.0ms
(- (* x.re x.re) (* x.im x.im))

series87.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

47.0ms
(* x.im (+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re))))
23.0ms
(+ (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re)))
17.0ms
(- (* x.re x.re) (* x.im x.im))

simplify5.3s

Counts
38 → 62
Calls

38 calls. Slowest were:

789.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)))))
620.0ms
(- (- (* x.re x.re) (* x.im x.im)) (* x.re (+ x.re x.re)))
541.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))))

prune559.0ms

Pruning

7 alts after pruning (6 fresh and 1 done)

Merged error: 6.4b

localize37.0ms

Local error

Found 3 expressions with local error:

6.8b
(* x.im (pow x.re 2))
0.2b
(* 3 (* x.im (pow x.re 2)))
0.0b
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
3 → 33
Calls

3 calls. Slowest were:

10.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
4.0ms
(* 3 (* x.im (pow x.re 2)))
2.0ms
(* x.im (pow x.re 2))

series73.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

28.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
27.0ms
(* x.im (pow x.re 2))
19.0ms
(* 3 (* x.im (pow x.re 2)))

simplify409.0ms

Counts
14 → 42
Calls

14 calls. Slowest were:

91.0ms
(/ (exp (* 3 (* x.im (pow x.re 2)))) (exp (pow x.im 3)))
80.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
76.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

prune552.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 3 expressions with local error:

0.2b
(* 3 (* (* x.im x.re) x.re))
0.2b
(* (* x.im x.re) x.re)
0.0b
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))

rewrite23.0ms

Algorithm
rewrite-expression-head
Counts
3 → 30
Calls

3 calls. Slowest were:

11.0ms
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))
6.0ms
(* 3 (* (* x.im x.re) x.re))
4.0ms
(* (* x.im x.re) x.re)

series95.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

36.0ms
(- (* 3 (* (* x.im x.re) x.re)) (pow x.im 3))
30.0ms
(* (* x.im x.re) x.re)
30.0ms
(* 3 (* (* x.im x.re) x.re))

simplify330.0ms

Counts
10 → 39
Calls

10 calls. Slowest were:

108.0ms
(/ (exp (* 3 (* (* x.im x.re) x.re))) (exp (pow x.im 3)))
56.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
42.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

prune383.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 3 expressions with local error:

0.2b
(* 3 (* x.im x.re))
0.2b
(* (* 3 (* x.im x.re)) x.re)
0.0b
(- (* (* 3 (* x.im x.re)) x.re) (pow x.im 3))

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 30
Calls

3 calls. Slowest were:

6.0ms
(- (* (* 3 (* x.im x.re)) x.re) (pow x.im 3))
3.0ms
(* (* 3 (* x.im x.re)) x.re)
1.0ms
(* 3 (* x.im x.re))

series69.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

39.0ms
(- (* (* 3 (* x.im x.re)) x.re) (pow x.im 3))
18.0ms
(* (* 3 (* x.im x.re)) x.re)
12.0ms
(* 3 (* x.im x.re))

simplify465.0ms

Counts
10 → 39
Calls

10 calls. Slowest were:

107.0ms
(/ (exp (* (* 3 (* x.im x.re)) x.re)) (exp (pow x.im 3)))
80.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))
80.0ms
(- (* 3 (* x.im (pow x.re 2))) (pow x.im 3))

prune418.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 0b

regimes149.0ms

Accuracy

0% (0.1b remaining)

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

bsearch1.0ms

end0.0ms

sample3.2s

Algorithm
intervals