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

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

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

    \[\leadsto \color{blue}{\left(\sqrt[3]{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)} \cdot \sqrt[3]{\left(x.re + x.im\right) \cdot \left(\left(x.re - x.im\right) \cdot x.im\right)}\right) \cdot \sqrt[3]{\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\]
  7. Using strategy rm
  8. Applied add-cbrt-cube0.7

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

    \[\leadsto \left(\sqrt[3]{\left(\sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)} \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}\right) \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}} \cdot \sqrt[3]{\left(\left(x.re - x.im\right) \cdot x.im\right) \cdot \left(x.im + x.re\right)}\right) \cdot \sqrt[3]{\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 2019022 
(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: 6.0m)Debug log

sample94.0ms

Algorithm
intervals
Results
79.0ms440×body80valid

simplify572.0ms

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

localize43.0ms

Local error

Found 4 expressions with local error:

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

rewrite33.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
12.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)
7.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)
4.0ms
(+ (* x.re x.im) (* x.im x.re))

series136.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
55.0ms
(* (- (* x.re x.re) (* x.im x.im)) x.im)
49.0ms
(+ (* (- (* x.re x.re) (* x.im 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)
11.0ms
(+ (* x.re x.im) (* x.im x.re))

simplify5.5s

Counts
31 → 65
Calls
31 calls:
Slowest
2.2s
(* (exp (* (- (* x.re x.re) (* x.im x.im)) x.im)) (exp (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
431.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)
383.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)))
308.0ms
(+ (* (* (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* 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.re) (* x.im x.im)) (* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)))
306.0ms
(* (- (* (* x.re x.re) (* x.re x.re)) (* (* x.im x.im) (* x.im x.im))) x.im)

prune664.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 0.1b

localize12.0ms

Local error

Found 4 expressions with local error:

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

rewrite31.0ms

Algorithm
rewrite-expression-head
Rules
44×associate-*l/
19×flip-+
19×flip3-+
16×frac-add
12×frac-times
10×flip--
10×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*
sum-log
+-commutative
Counts
4 → 76
Calls
4 calls:
Slowest
13.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))
5.0ms
(* (- x.re x.im) x.im)
4.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

series165.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
59.0ms
(* (+ x.re x.im) (* (- x.re x.im) x.im))
56.0ms
(+ (* (+ x.re x.im) (* (- x.re x.im) x.im)) (* (+ (* x.re x.im) (* x.im x.re)) x.re))
31.0ms
(* (- x.re x.im) x.im)
18.0ms
(* (+ (* x.re x.im) (* x.im x.re)) x.re)

simplify12.0s

Counts
70 → 88
Calls
70 calls:
Slowest
566.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)))
500.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)))
477.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)))))
472.0ms
(+ (* (* (- (* x.re x.re) (* x.im x.im)) (* (- (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.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)))
437.0ms
(* (+ (pow (* x.re x.im) 3) (pow (* x.im x.re) 3)) x.re)

prune826.0ms

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

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

rewrite222.0ms

Algorithm
rewrite-expression-head
Rules
2200×frac-times
2120×associate-*l/
1968×cbrt-div
738×flip--
738×flip-+
738×flip3--
738×flip3-+
572×associate-*r/
18×pow1
add-exp-log
pow1/3
pow-prod-up
add-cube-cbrt
pow-prod-down
add-cbrt-cube
pow-plus
*-un-lft-identity
add-sqr-sqrt
add-log-exp
associate-*r*
cbrt-prod
cbrt-unprod
prod-exp
pow2
*-commutative
pow3
associate-*l*
Counts
4 → 807
Calls
4 calls:
Slowest
114.0ms
(* (* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (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)))
4.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

series890.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
517.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
169.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
165.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
39.0ms
(* (* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))))

simplify3.7m

Counts
1431 → 819
Calls
1431 calls:
Slowest
969.0ms
(* (* (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.im))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.im)))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im))))
835.0ms
(* (* (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) x.im))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (pow x.re 3) (pow x.im 3)) x.im)))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) x.im))))
750.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))))) (cbrt (- x.re x.im)))
689.0ms
(* (* (cbrt (+ (* 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))) (+ (* x.re x.re) (+ (* x.im x.im) (* x.re x.im)))))) (cbrt (* (- x.re x.im) (+ x.re x.im))))
625.0ms
(* (* (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im)))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.im))))

prune12.2s

Pruning

10 alts after pruning (10 fresh and 0 done)

Merged error: 0.0b

localize14.0ms

Local error

Found 4 expressions with local error:

14.8b
(cbrt (* (* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))))
14.8b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
14.8b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
14.8b
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

rewrite130.0ms

Algorithm
rewrite-expression-head
Rules
2696×cbrt-div
2200×frac-times
2120×associate-*l/
738×flip--
738×flip-+
738×flip3--
738×flip3-+
572×associate-*r/
add-log-exp
add-cube-cbrt
add-exp-log
pow1/3
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
cbrt-prod
rem-cbrt-cube
pow3
Counts
4 → 789
Calls
4 calls:
Slowest
51.0ms
(cbrt (* (* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (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)))
4.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
4.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

series416.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
116.0ms
(cbrt (* (* (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))))
101.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
100.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))
99.0ms
(cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))

simplify1.5m

Counts
769 → 801
Calls
769 calls:
Slowest
561.0ms
(cbrt (* (* (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)))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- x.re x.im) x.im)))))
554.0ms
(cbrt (* (* (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) x.im))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (pow x.re 3) (pow x.im 3)) x.im)))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.im)))))
524.0ms
(cbrt (* (* (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- (* x.re x.re) (* x.im x.im)) x.im)))) (cbrt (* (+ (pow x.re 3) (pow x.im 3)) (* (- (* x.re x.re) (* x.im x.im)) x.im)))))
479.0ms
(cbrt (* (* (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- x.re x.im) x.im))) (cbrt (* (+ x.re x.im) (* (- x.re x.im) x.im)))) (cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- x.re x.im) x.im)))))
451.0ms
(cbrt (* (- (* x.re x.re) (* x.im x.im)) (* (- x.re x.im) x.im)))

prune14.7s

Pruning

10 alts after pruning (9 fresh and 1 done)

Merged error: 0.0b

regimes90.0ms

Accuracy

0% (0.7b remaining)

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

bsearch2.0ms

end0.0ms

sample1.7s

Algorithm
intervals
Results
1.5s14459×body80valid