Average Error: 16.0 → 3.1
Time: 17.8s
Precision: 64
Internal Precision: 128
\[\frac{\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0} + 1.0}{2.0}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0} \le -0.9999999999999255:\\ \;\;\;\;\frac{\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \frac{\left(\frac{4.0}{\alpha} - 2.0\right) - \frac{8.0}{\alpha \cdot \alpha}}{\alpha}}{2.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(1.0 + \frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0}\right)}}{2.0}\\ \end{array}\]

Error

Bits error versus alpha

Bits error versus beta

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (- beta alpha) (+ (+ alpha beta) 2.0)) < -0.9999999999999255

    1. Initial program 60.4

      \[\frac{\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0} + 1.0}{2.0}\]
    2. Using strategy rm
    3. Applied div-sub60.4

      \[\leadsto \frac{\color{blue}{\left(\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \frac{\alpha}{\left(\alpha + \beta\right) + 2.0}\right)} + 1.0}{2.0}\]
    4. Applied associate-+l-58.6

      \[\leadsto \frac{\color{blue}{\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \left(\frac{\alpha}{\left(\alpha + \beta\right) + 2.0} - 1.0\right)}}{2.0}\]
    5. Using strategy rm
    6. Applied div-inv58.9

      \[\leadsto \frac{\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \left(\color{blue}{\alpha \cdot \frac{1}{\left(\alpha + \beta\right) + 2.0}} - 1.0\right)}{2.0}\]
    7. Taylor expanded around -inf 10.7

      \[\leadsto \frac{\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \color{blue}{\left(4.0 \cdot \frac{1}{{\alpha}^{2}} - \left(2.0 \cdot \frac{1}{\alpha} + 8.0 \cdot \frac{1}{{\alpha}^{3}}\right)\right)}}{2.0}\]
    8. Simplified10.7

      \[\leadsto \frac{\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \color{blue}{\frac{\left(\frac{4.0}{\alpha} - 2.0\right) - \frac{8.0}{\alpha \cdot \alpha}}{\alpha}}}{2.0}\]

    if -0.9999999999999255 < (/ (- beta alpha) (+ (+ alpha beta) 2.0))

    1. Initial program 0.4

      \[\frac{\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0} + 1.0}{2.0}\]
    2. Using strategy rm
    3. Applied add-exp-log0.4

      \[\leadsto \frac{\color{blue}{e^{\log \left(\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0} + 1.0\right)}}}{2.0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0} \le -0.9999999999999255:\\ \;\;\;\;\frac{\frac{\beta}{\left(\alpha + \beta\right) + 2.0} - \frac{\left(\frac{4.0}{\alpha} - 2.0\right) - \frac{8.0}{\alpha \cdot \alpha}}{\alpha}}{2.0}\\ \mathbf{else}:\\ \;\;\;\;\frac{e^{\log \left(1.0 + \frac{\beta - \alpha}{\left(\alpha + \beta\right) + 2.0}\right)}}{2.0}\\ \end{array}\]

Reproduce

herbie shell --seed 2019022 
(FPCore (alpha beta)
  :name "Octave 3.8, jcobi/1"
  :pre (and (> alpha -1) (> beta -1))
  (/ (+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0) 2.0))

Details

Time bar (total: 17.1s)Debug log

sample74.0ms

Algorithm
intervals
Results
20.0ms187×body80valid
12.0ms27×body640valid
10.0ms19×body1280valid
10.0ms256×pre80true
5.0ms15×body320valid
2.0msbody160valid

simplify68.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
67.0ms
(/ (+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0) 2.0)

prune4.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 16.3b

localize16.0ms

Local error

Found 2 expressions with local error:

2.7b
(+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0)
0.0b
(/ (- beta alpha) (+ (+ alpha beta) 2.0))

rewrite30.0ms

Algorithm
rewrite-expression-head
Rules
10×add-cube-cbrt
10×*-un-lft-identity
10×add-sqr-sqrt
times-frac
add-exp-log
add-cbrt-cube
associate-/l*
associate-/r*
associate-/l/
add-log-exp
flip-+
associate-/r/
div-sub
flip3-+
pow1
flip--
div-inv
associate-+l-
div-exp
flip3--
frac-2neg
clear-num
+-commutative
cbrt-undiv
Counts
2 → 43
Calls
2 calls:
Slowest
25.0ms
(+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0)
5.0ms
(/ (- beta alpha) (+ (+ alpha beta) 2.0))

series72.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
47.0ms
(+ (/ (- beta alpha) (+ (+ alpha beta) 2.0)) 1.0)
25.0ms
(/ (- beta alpha) (+ (+ alpha beta) 2.0))

simplify1.3s

Counts
37 → 49
Calls
37 calls:
Slowest
174.0ms
(+ (* (+ alpha beta) (+ alpha beta)) (- (* 2.0 2.0) (* (+ alpha beta) 2.0)))
141.0ms
(- (+ (* 4.0 (/ 1 (pow beta 2))) 1) (* 2.0 (/ 1 beta)))
140.0ms
(- (+ (* 4.0 (/ 1 (pow beta 2))) 1) (* 2.0 (/ 1 beta)))
121.0ms
(- (+ (* 4.0 (/ 1 (pow beta 2))) 2.0) (* 2.0 (/ 1 beta)))
120.0ms
(- (+ (* 4.0 (/ 1 (pow beta 2))) 2.0) (* 2.0 (/ 1 beta)))

prune442.0ms

Pruning

11 alts after pruning (11 fresh and 0 done)

Merged error: 15.4b

localize11.0ms

Local error

Found 3 expressions with local error:

2.7b
(- (/ alpha (+ (+ alpha beta) 2.0)) 1.0)
0.0b
(/ alpha (+ (+ alpha beta) 2.0))
0.0b
(/ beta (+ (+ alpha beta) 2.0))

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
associate-/r*
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-/r/
add-log-exp
add-exp-log
add-cbrt-cube
pow1
div-inv
flip-+
flip3-+
frac-2neg
clear-num
flip--
flip3--
sub-neg
Counts
3 → 41
Calls
3 calls:
Slowest
5.0ms
(- (/ alpha (+ (+ alpha beta) 2.0)) 1.0)
2.0ms
(/ alpha (+ (+ alpha beta) 2.0))
2.0ms
(/ beta (+ (+ alpha beta) 2.0))

series104.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
38.0ms
(- (/ alpha (+ (+ alpha beta) 2.0)) 1.0)
37.0ms
(/ beta (+ (+ alpha beta) 2.0))
30.0ms
(/ alpha (+ (+ alpha beta) 2.0))

simplify1.7s

Counts
19 → 50
Calls
19 calls:
Slowest
371.0ms
(- (* 4.0 (/ 1 (pow alpha 2))) (+ (* 2.0 (/ 1 alpha)) (* 8.0 (/ 1 (pow alpha 3)))))
320.0ms
(- (* 4.0 (/ 1 (pow alpha 2))) (+ (* 2.0 (/ 1 alpha)) (* 8.0 (/ 1 (pow alpha 3)))))
244.0ms
(- (* 0.5 alpha) (+ (* 0.25 (pow alpha 2)) (* 0.25 (* beta alpha))))
210.0ms
(- (* 0.5 beta) (+ (* 0.25 (pow beta 2)) (* 0.25 (* beta alpha))))
191.0ms
(+ (* (+ alpha beta) (+ alpha beta)) (- (* 2.0 2.0) (* (+ alpha beta) 2.0)))

prune518.0ms

Pruning

8 alts after pruning (8 fresh and 0 done)

Merged error: 4.0b

localize26.0ms

Local error

Found 4 expressions with local error:

7.1b
(- (* alpha (/ 1 (+ (+ alpha beta) 2.0))) 1.0)
0.1b
(* alpha (/ 1 (+ (+ alpha beta) 2.0)))
0.0b
(/ beta (+ (+ alpha beta) 2.0))
0.0b
(/ 1 (+ (+ alpha beta) 2.0))

rewrite16.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-/r/
associate-*r*
associate-/r*
add-exp-log
pow1
add-log-exp
add-cbrt-cube
div-inv
flip-+
flip3-+
frac-2neg
clear-num
inv-pow
flip--
pow-flip
*-commutative
un-div-inv
associate-*r/
flip3--
sub-neg
rec-exp
Counts
4 → 60
Calls
4 calls:
Slowest
5.0ms
(- (* alpha (/ 1 (+ (+ alpha beta) 2.0))) 1.0)
4.0ms
(/ 1 (+ (+ alpha beta) 2.0))
3.0ms
(/ beta (+ (+ alpha beta) 2.0))
2.0ms
(* alpha (/ 1 (+ (+ alpha beta) 2.0)))

series138.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
59.0ms
(- (* alpha (/ 1 (+ (+ alpha beta) 2.0))) 1.0)
38.0ms
(* alpha (/ 1 (+ (+ alpha beta) 2.0)))
23.0ms
(/ beta (+ (+ alpha beta) 2.0))
18.0ms
(/ 1 (+ (+ alpha beta) 2.0))

simplify1.9s

Counts
31 → 72
Calls
31 calls:
Slowest
338.0ms
(- (* 4.0 (/ 1 (pow alpha 2))) (+ (* 2.0 (/ 1 alpha)) (* 8.0 (/ 1 (pow alpha 3)))))
331.0ms
(- (* 4.0 (/ 1 (pow alpha 2))) (+ (* 2.0 (/ 1 alpha)) (* 8.0 (/ 1 (pow alpha 3)))))
247.0ms
(- (* 0.5 beta) (+ (* 0.25 (pow beta 2)) (* 0.25 (* beta alpha))))
245.0ms
(- (* 0.5 alpha) (+ (* 0.25 (pow alpha 2)) (* 0.25 (* beta alpha))))
146.0ms
(+ (* (+ alpha beta) (+ alpha beta)) (- (* 2.0 2.0) (* (+ alpha beta) 2.0)))

prune620.0ms

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 4.0b

localize61.0ms

Local error

Found 4 expressions with local error:

2.7b
(- (pow (/ alpha (+ (+ alpha beta) 2.0)) 3) (pow 1.0 3))
0.1b
(pow (/ alpha (+ (+ alpha beta) 2.0)) 3)
0.1b
(* (/ alpha (+ (+ alpha beta) 2.0)) (/ alpha (+ (+ alpha beta) 2.0)))
0.0b
(/ alpha (+ (+ alpha beta) 2.0))

rewrite40.0ms

Algorithm
rewrite-expression-head
Rules
15×add-sqr-sqrt
11×*-un-lft-identity
10×associate-/r/
10×pow1
add-cube-cbrt
add-exp-log
cube-prod
add-cbrt-cube
unpow-prod-down
add-log-exp
associate-*l*
associate-*r*
div-inv
flip-+
flip3-+
difference-of-squares
associate-/r*
rem-cube-cbrt
distribute-lft-out--
flip--
cbrt-unprod
pow-prod-up
*-commutative
associate-*r/
prod-exp
pow-exp
associate-*l/
pow-prod-down
unpow3
diff-log
flip3--
pow-plus
frac-2neg
pow-pow
sub-neg
clear-num
difference-cubes
pow-to-exp
frac-times
cube-mult
pow2
cube-div
Counts
4 → 87
Calls
4 calls:
Slowest
24.0ms
(- (pow (/ alpha (+ (+ alpha beta) 2.0)) 3) (pow 1.0 3))
8.0ms
(* (/ alpha (+ (+ alpha beta) 2.0)) (/ alpha (+ (+ alpha beta) 2.0)))
3.0ms
(/ alpha (+ (+ alpha beta) 2.0))
3.0ms
(pow (/ alpha (+ (+ alpha beta) 2.0)) 3)

series212.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
90.0ms
(- (pow (/ alpha (+ (+ alpha beta) 2.0)) 3) (pow 1.0 3))
50.0ms
(pow (/ alpha (+ (+ alpha beta) 2.0)) 3)
36.0ms
(/ alpha (+ (+ alpha beta) 2.0))
36.0ms
(* (/ alpha (+ (+ alpha beta) 2.0)) (/ alpha (+ (+ alpha beta) 2.0)))

simplify5.9s

Counts
63 → 99
Calls
63 calls:
Slowest
621.0ms
(pow (/ alpha (- (* (+ alpha beta) (+ alpha beta)) (* 2.0 2.0))) 3)
609.0ms
(pow (/ alpha (- (* (+ alpha beta) (+ alpha beta)) (* 2.0 2.0))) 3)
409.0ms
(- (* 24.0 (/ 1 (pow alpha 2))) (+ (* 6.0 (/ 1 alpha)) (* 80.0 (/ 1 (pow alpha 3)))))
357.0ms
(/ alpha (+ (pow (+ alpha beta) 3) (pow 2.0 3)))
333.0ms
(- (* 24.0 (/ 1 (pow alpha 2))) (+ (* 6.0 (/ 1 alpha)) (* 80.0 (/ 1 (pow alpha 3)))))

prune1.3s

Pruning

7 alts after pruning (7 fresh and 0 done)

Merged error: 4.0b

regimes180.0ms

Accuracy

98.7% (0.2b remaining)

Error of 3.1b against oracle of 2.9b and baseline of 15.6b

bsearch7.0ms

end0.0ms

sample2.4s

Algorithm
intervals
Results
1.1s5870×body80valid
430.0ms856×body1280valid
370.0ms725×body640valid
237.0ms8000×pre80true
128.0ms361×body320valid
32.0ms188×body160valid