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. Taylor expanded around 0 0.2

    \[\leadsto \left(x.re + x.im\right) \cdot \color{blue}{\left(x.im \cdot x.re - {x.im}^{2}\right)} + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re\]
  6. Simplified0.2

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

sample72.0ms

Algorithm
intervals

simplify204.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune17.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 8.5b

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

rewrite31.0ms

Algorithm
rewrite-expression-head
Counts
4 → 55
Calls

4 calls. Slowest were:

14.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
7.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
5.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)

series138.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

60.0ms
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
36.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
27.0ms
(- (* x.re x.re) (* x.im x.im))
15.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

simplify6.0s

Counts
33 → 67
Calls

33 calls. Slowest were:

2.5s
(* (exp (* (- (* x.re x.re) (* x.im x.im)) x.im)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
505.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)
390.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)))

prune666.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.0b

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

rewrite53.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
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))
16.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
9.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

series157.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

59.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
58.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
20.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
19.0ms
(* (- x.re x.im) x.im)

simplify13.3s

Counts
70 → 88
Calls

70 calls. Slowest were:

1.0s
(+ (* (* (- (* 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)))
570.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)))))
554.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)))))

prune780.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 0b

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

rewrite41.0ms

Algorithm
rewrite-expression-head
Counts
4 → 76
Calls

4 calls. Slowest were:

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

series156.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

63.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
52.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
21.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
19.0ms
(* (- x.re x.im) x.im)

simplify12.8s

Counts
70 → 88
Calls

70 calls. Slowest were:

663.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)))
578.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)))))
567.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)))))

prune935.0ms

Pruning

8 alts after pruning (7 fresh and 1 done)

Merged error: 0b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite79.0ms

Algorithm
rewrite-expression-head
Counts
4 → 155
Calls

4 calls. Slowest were:

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

series610.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

160.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
155.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
153.0ms
(* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))))
142.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

simplify50.7s

Counts
199 → 167
Calls

199 calls. Slowest were:

864.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) (* (- (pow x.re 3) (pow x.im 3)) x.im))))
827.0ms
(* (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- x.re x.im) x.im))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im))))
717.0ms
(* (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ x.re x.im) (* (- x.re x.im) x.im)))

prune2.9s

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0b

regimes118.0ms

Accuracy

0% (0.2b remaining)

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

bsearch2.0ms

end0.0ms

sample2.9s

Algorithm
intervals