Average Error: 31.8 → 0.0
Time: 24.0s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028234102419464398 \lor \neg \left(x \le 0.029092505273595363\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{{x}^{2} \cdot \frac{9}{40} - \frac{27}{2800} \cdot {x}^{4}}\right) - \frac{1}{2}\\ \end{array}\]

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < -0.028234102419464398 or 0.029092505273595363 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.028234102419464398 < x < 0.029092505273595363

    1. Initial program 62.8

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around 0 0.0

      \[\leadsto \color{blue}{\frac{9}{40} \cdot {x}^{2} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)}\]
    3. Using strategy rm
    4. Applied associate--r+0.0

      \[\leadsto \color{blue}{\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}}\]
    5. Using strategy rm
    6. Applied add-log-exp0.0

      \[\leadsto \color{blue}{\log \left(e^{\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}}\right)} - \frac{1}{2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.028234102419464398 \lor \neg \left(x \le 0.029092505273595363\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;\log \left(e^{{x}^{2} \cdot \frac{9}{40} - \frac{27}{2800} \cdot {x}^{4}}\right) - \frac{1}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019018 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))

Details

Time bar (total: 23.0s)Debug log

sample652.0ms

Algorithm
intervals
Results
242.0ms49×body2560valid
184.0ms74×body1280valid
60.0ms54×body640valid
36.0ms44×body320valid
9.0ms18×body80valid
8.0ms17×body160valid

simplify455.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
454.0ms
(/ (- x (sin x)) (- x (tan x)))

prune16.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 29.3b

localize23.0ms

Local error

Found 3 expressions with local error:

0.9b
(- x (sin x))
0.9b
(- x (tan x))
0.0b
(/ (- x (sin x)) (- x (tan x)))

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
11×add-cube-cbrt
11×*-un-lft-identity
11×add-sqr-sqrt
times-frac
add-exp-log
add-cbrt-cube
flip--
flip3--
add-log-exp
associate-/l*
associate-/r*
pow1
associate-/l/
associate-/r/
sub-neg
div-inv
div-exp
div-sub
frac-2neg
clear-num
cbrt-undiv
Counts
3 → 54
Calls
3 calls:
Slowest
3.0ms
(/ (- x (sin x)) (- x (tan x)))
2.0ms
(- x (sin x))
0.0ms
(- x (tan x))

series229.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
118.0ms
(/ (- x (sin x)) (- x (tan x)))
64.0ms
(- x (tan x))
47.0ms
(- x (sin x))

simplify1.2s

Counts
39 → 63
Calls
39 calls:
Slowest
195.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
181.0ms
(- (+ 1 (+ (/ (pow (sin x) 2) (* (pow (cos x) 2) (pow x 2))) (/ (sin x) (* (cos x) x)))) (+ (/ (sin x) x) (/ (pow (sin x) 2) (* (cos x) (pow x 2)))))
173.0ms
(- (+ 1 (+ (/ (pow (sin x) 2) (* (pow (cos x) 2) (pow x 2))) (/ (sin x) (* (cos x) x)))) (+ (/ (sin x) x) (/ (pow (sin x) 2) (* (cos x) (pow x 2)))))
158.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
59.0ms
(- (+ (* 1/6 (pow x 3)) (* 1/5040 (pow x 7))) (* 1/120 (pow x 5)))

prune570.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.1b

localize22.0ms

Local error

Found 3 expressions with local error:

13.3b
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
0.3b
(* 27/2800 (pow x 4))
0.2b
(* 9/40 (pow x 2))

rewrite14.0ms

Algorithm
rewrite-expression-head
Rules
associate-*r*
add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
add-cbrt-cube
pow1
*-commutative
unpow2
associate--r+
flip--
diff-log
flip3--
sub-neg
Counts
3 → 36
Calls
3 calls:
Slowest
8.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
2.0ms
(* 27/2800 (pow x 4))
2.0ms
(* 9/40 (pow x 2))

series89.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
39.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
29.0ms
(* 27/2800 (pow x 4))
21.0ms
(* 9/40 (pow x 2))

simplify267.0ms

Counts
16 → 45
Calls
16 calls:
Slowest
97.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (* 27/2800 (pow x 4)) 1/2)))
50.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
48.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
41.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
7.0ms
(* 9/40 (pow x 2))

prune438.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.1b

localize6.0ms

Local error

Found 3 expressions with local error:

13.3b
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
0.3b
(* 27/2800 (pow x 4))
0.2b
(* 9/40 (pow x 2))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
associate-*r*
add-log-exp
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-exp-log
add-cbrt-cube
pow1
*-commutative
unpow2
flip--
diff-log
flip3--
sub-neg
Counts
3 → 35
Calls
3 calls:
Slowest
3.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
1.0ms
(* 9/40 (pow x 2))
1.0ms
(* 27/2800 (pow x 4))

series82.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
50.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
17.0ms
(* 9/40 (pow x 2))
15.0ms
(* 27/2800 (pow x 4))

simplify113.0ms

Counts
16 → 44
Calls
16 calls:
Slowest
55.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (* 27/2800 (pow x 4))))
11.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
11.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
11.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
4.0ms
(* 9/40 (pow x 2))

prune373.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.1b

localize9.0ms

Local error

Found 4 expressions with local error:

13.3b
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
0.9b
(log (exp (- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))))
0.3b
(* 27/2800 (pow x 4))
0.2b
(* 9/40 (pow x 2))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
associate-*r*
add-log-exp
log-prod
pow1
log-pow
add-exp-log
add-cbrt-cube
exp-prod
*-commutative
exp-sum
sub-neg
unpow2
flip--
rem-log-exp
diff-log
exp-diff
flip3--
log-div
Counts
4 → 53
Calls
4 calls:
Slowest
5.0ms
(log (exp (- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))))
3.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
1.0ms
(* 27/2800 (pow x 4))
1.0ms
(* 9/40 (pow x 2))

series188.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
82.0ms
(log (exp (- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))))
61.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
26.0ms
(* 27/2800 (pow x 4))
19.0ms
(* 9/40 (pow x 2))

simplify395.0ms

Counts
29 → 65
Calls
29 calls:
Slowest
65.0ms
(log (sqrt (exp (- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4))))))
45.0ms
(log (* (cbrt (exp (- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4))))) (cbrt (exp (- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))))))
35.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (* 27/2800 (pow x 4))))
25.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
24.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))

prune691.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.1b

regimes139.0ms

Accuracy

100% (0.0b remaining)

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

bsearch166.0ms

end0.0ms

sample16.9s

Algorithm
intervals
Results
7.3s1696×body2560valid
5.4s2713×body1280valid
2.7s1824×body640valid
1.1s906×body320valid
227.0ms489×body160valid
92.0ms372×body80valid