Average Error: 31.8 → 0.0
Time: 24.1s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.024178796645617315 \lor \neg \left(x \le 0.0282092826919728\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;{x}^{2} \cdot \frac{9}{40} - \left(\frac{1}{2} + \log \left(e^{\frac{27}{2800} \cdot {x}^{4}}\right)\right)\\ \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.024178796645617315 or 0.0282092826919728 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Taylor expanded around inf 0.1

      \[\leadsto \frac{\color{blue}{x - \sin x}}{x - \tan x}\]

    if -0.024178796645617315 < x < 0.0282092826919728

    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 add-log-exp0.0

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

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

Reproduce

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

Details

Time bar (total: 23.2s)Debug log

sample659.0ms

Algorithm
intervals

simplify26.0ms

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

prune6.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 32.9b

localize17.0ms

Local error

Found 3 expressions with local error:

1.6b
(- x (tan x))
1.4b
(- x (sin 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 (tan x))
0.0ms
(- x (sin x))

series587.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
455.0ms
(- x (tan x))
85.0ms
(/ (- x (sin x)) (- x (tan x)))
48.0ms
(- x (sin x))

simplify1.2s

Counts
39 → 63
Calls
39 calls:
Slowest
213.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
208.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)))))
191.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)))))
117.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
52.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

prune545.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize39.0ms

Local error

Found 3 expressions with local error:

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

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
9.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))

series80.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
34.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
27.0ms
(* 27/2800 (pow x 4))
19.0ms
(* 9/40 (pow x 2))

simplify315.0ms

Counts
16 → 45
Calls
16 calls:
Slowest
117.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (* 27/2800 (pow x 4)) 1/2)))
67.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
58.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))

prune416.0ms

Pruning

2 alts after pruning (2 fresh and 0 done)

Merged error: 0.0b

localize23.0ms

Local error

Found 4 expressions with local error:

13.3b
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
0.6b
(log (exp (* 27/2800 (pow x 4))))
0.4b
(* 9/40 (pow x 2))
0.1b
(* 27/2800 (pow x 4))

rewrite22.0ms

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

series96.0ms

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

simplify313.0ms

Counts
23 → 61
Calls
23 calls:
Slowest
105.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (log (exp (* 27/2800 (pow x 4)))) 1/2)))
58.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
57.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
49.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
5.0ms
(log (* (cbrt (exp (* 27/2800 (pow x 4)))) (cbrt (exp (* 27/2800 (pow x 4))))))

prune661.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0.0b

localize15.0ms

Local error

Found 4 expressions with local error:

13.3b
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
13.3b
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
13.3b
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
0.6b
(log (exp (* 27/2800 (pow x 4))))

rewrite42.0ms

Algorithm
rewrite-expression-head
Rules
10×add-log-exp
add-cube-cbrt
*-un-lft-identity
pow1
add-sqr-sqrt
add-exp-log
add-cbrt-cube
associate--r+
flip--
diff-log
flip3--
sub-neg
log-prod
log-pow
rem-log-exp
exp-prod
Counts
4 → 52
Calls
4 calls:
Slowest
14.0ms
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
12.0ms
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
11.0ms
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
3.0ms
(log (exp (* 27/2800 (pow x 4))))

series101.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
31.0ms
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
26.0ms
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))
23.0ms
(log (exp (* 27/2800 (pow x 4))))
20.0ms
(- (* 9/40 (pow x 2)) (+ (log (exp (* 27/2800 (pow x 4)))) 1/2))

simplify876.0ms

Counts
19 → 64
Calls
19 calls:
Slowest
111.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (log (exp (* 27/2800 (pow x 4)))) 1/2)))
99.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (log (exp (* 27/2800 (pow x 4)))) 1/2)))
99.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (log (exp (* 27/2800 (pow x 4)))) 1/2)))
81.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
77.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

prune580.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

regimes68.0ms

Accuracy

100% (0.0b remaining)

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

bsearch174.0ms

end0.0ms

sample16.3s

Algorithm
intervals