Average Error: 31.3 → 0.0
Time: 36.8s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028854011673641617 \lor \neg \left(x \le 0.03426882273840378\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.028854011673641617 or 0.03426882273840378 < x

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Initial simplification0.1

      \[\leadsto \frac{x - \sin x}{x - \tan x}\]
    3. Using strategy rm
    4. Applied div-sub0.1

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

    if -0.028854011673641617 < x < 0.03426882273840378

    1. Initial program 62.8

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Initial simplification62.8

      \[\leadsto \frac{x - \sin x}{x - \tan x}\]
    3. 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.028854011673641617 \lor \neg \left(x \le 0.03426882273840378\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 2018362 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))

Details

Time bar (total: 15.2s)Debug log

start1.1s

Algorithm
intervals

setup497.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 37.4b

localize36.0ms

Local error

Found 3 expressions with local error:

1.5b
(- x (sin x))
1.5b
(- 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))

series246.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

103.0ms
(- x (tan x))
79.0ms
(/ (- x (sin x)) (- x (tan x)))
64.0ms
(- x (sin x))

simplify1.2s

Counts
39 → 63
Calls

39 calls. Slowest were:

204.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)))))
181.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
167.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)))))

prune610.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize37.0ms

Local error

Found 3 expressions with local error:

14.0b
(- (* 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))

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

series61.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify268.0ms

Counts
16 → 45
Calls

16 calls. Slowest were:

77.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
68.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (* 27/2800 (pow x 4)) 1/2)))
43.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

prune585.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.5b
(- x (tan x))
1.5b
(- x (tan x))
1.4b
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
0.1b
(/ (sin x) (- x (tan x)))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

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

series453.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

269.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
78.0ms
(/ (sin x) (- x (tan x)))
54.0ms
(- x (tan x))
52.0ms
(- x (tan x))

simplify2.2s

Counts
55 → 83
Calls

55 calls. Slowest were:

417.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
265.0ms
(- (* x (- x (tan x))) (* (- x (tan x)) (sin x)))
191.0ms
(+ (/ (pow (sin x) 2) (* (cos x) (pow x 2))) (+ (/ (pow (sin x) 3) (* (pow (cos x) 2) (pow x 3))) (/ (sin x) x)))

prune705.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0b

localize32.0ms

Local error

Found 4 expressions with local error:

18.4b
(/ (- (pow x 3) (pow (sin x) 3)) (* (- x (tan x)) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x))))))
1.5b
(- x (tan x))
1.5b
(- (pow x 3) (pow (sin x) 3))
0.3b
(pow (sin x) 3)

rewrite50.0ms

Algorithm
rewrite-expression-head
Counts
4 → 89
Calls

4 calls. Slowest were:

36.0ms
(/ (- (pow x 3) (pow (sin x) 3)) (* (- x (tan x)) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x))))))
8.0ms
(- (pow x 3) (pow (sin x) 3))
2.0ms
(pow (sin x) 3)

series574.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

395.0ms
(/ (- (pow x 3) (pow (sin x) 3)) (* (- x (tan x)) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x))))))
79.0ms
(- x (tan x))
65.0ms
(- (pow x 3) (pow (sin x) 3))
34.0ms
(pow (sin x) 3)

simplify4.8s

Counts
69 → 101
Calls

69 calls. Slowest were:

584.0ms
(* (+ x (tan x)) (- (* x x) (+ (* (sin x) (sin x)) (* x (sin x)))))
391.0ms
(/ (* (* (- (pow x 3) (pow (sin x) 3)) (- (pow x 3) (pow (sin x) 3))) (- (pow x 3) (pow (sin x) 3))) (* (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))) (* (* (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x)))) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x))))) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x)))))))
353.0ms
(/ (* (* (- (pow x 3) (pow (sin x) 3)) (- (pow x 3) (pow (sin x) 3))) (- (pow x 3) (pow (sin x) 3))) (* (* (* (- x (tan x)) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x))))) (* (- x (tan x)) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x)))))) (* (- x (tan x)) (+ (* x x) (+ (* (sin x) (sin x)) (* x (sin x)))))))

prune1.4s

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0b

regimes75.0ms

Accuracy

100% (0.0b remaining)

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

bsearch220.0ms