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

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied div-sub0.0

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

    if -0.030550029170950743 < x < 0.028494513597882708

    1. Initial program 62.7

      \[\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. Recombined 2 regimes into one program.
  4. Final simplification0.0

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

Reproduce

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

Details

Time bar (total: 28.2s)Debug log

sample771.0ms

Algorithm
intervals

simplify32.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

32.0ms
(/ (- x (sin x)) (- x (tan x)))

prune12.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.7b

localize35.0ms

Local error

Found 3 expressions with local error:

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

rewrite13.0ms

Algorithm
rewrite-expression-head
Counts
3 → 54
Calls

3 calls. Slowest were:

6.0ms
(/ (- x (sin x)) (- x (tan x)))
3.0ms
(- x (sin x))
1.0ms
(- x (tan x))

series601.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

404.0ms
(- x (sin x))
132.0ms
(/ (- x (sin x)) (- x (tan x)))
66.0ms
(- x (tan x))

simplify1.3s

Counts
39 → 63
Calls

39 calls. Slowest were:

221.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)))))
221.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
161.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)))))

prune585.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize36.0ms

Local error

Found 3 expressions with local error:

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

rewrite14.0ms

Algorithm
rewrite-expression-head
Counts
3 → 36
Calls

3 calls. Slowest were:

9.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
2.0ms
(* 9/40 (pow x 2))
2.0ms
(* 27/2800 (pow x 4))

series63.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

30.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
21.0ms
(* 27/2800 (pow x 4))
11.0ms
(* 9/40 (pow x 2))

simplify346.0ms

Counts
16 → 45
Calls

16 calls. Slowest were:

80.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
79.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))

prune370.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize17.0ms

Local error

Found 4 expressions with local error:

1.8b
(- x (tan x))
1.8b
(- x (tan x))
1.7b
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
0.1b
(/ (sin x) (- x (tan x)))

rewrite22.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

12.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
6.0ms
(/ (sin x) (- x (tan x)))
1.0ms
(- x (tan x))

series526.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

280.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
84.0ms
(/ (sin x) (- x (tan x)))
82.0ms
(- x (tan x))
79.0ms
(- x (tan x))

simplify2.3s

Counts
55 → 83
Calls

55 calls. Slowest were:

411.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
303.0ms
(- (* x (- x (tan x))) (* (- x (tan x)) (sin x)))
207.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)))))

prune704.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize37.0ms

Local error

Found 4 expressions with local error:

14.1b
(/ (/ (sin x) (cos x)) (* x x))
2.2b
(- (/ (sin x) (cos x)) (sin x))
0.1b
(/ (sin x) (cos x))
0.1b
(/ (sin x) (cos x))

rewrite29.0ms

Algorithm
rewrite-expression-head
Counts
4 → 113
Calls

4 calls. Slowest were:

10.0ms
(- (/ (sin x) (cos x)) (sin x))
6.0ms
(/ (sin x) (cos x))
6.0ms
(/ (/ (sin x) (cos x)) (* x x))

series157.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

72.0ms
(- (/ (sin x) (cos x)) (sin x))
34.0ms
(/ (sin x) (cos x))
29.0ms
(/ (/ (sin x) (cos x)) (* x x))
22.0ms
(/ (sin x) (cos x))

simplify1.9s

Counts
111 → 125
Calls

111 calls. Slowest were:

602.0ms
(/ (* (* (/ (sin x) (cos x)) (/ (sin x) (cos x))) (/ (sin x) (cos x))) (* (* (* x x) (* x x)) (* x x)))
147.0ms
(- (- (log (sin x)) (log (cos x))) (log (* x x)))
115.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (cos x) (cos x)) (cos x)))

prune1.5s

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes49.0ms

Accuracy

100% (0.0b remaining)

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

bsearch147.0ms

end0.0ms

sample16.7s

Algorithm
intervals