Average Error: 31.0 → 0.0
Time: 26.7s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.028503704682151434:\\ \;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\ \mathbf{elif}\;x \le 0.028176034411070774:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \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 3 regimes
  2. if x < -0.028503704682151434

    1. Initial program 0.1

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-cbrt-cube41.5

      \[\leadsto \frac{x - \sin x}{\color{blue}{\sqrt[3]{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}}\]
    4. Applied add-cbrt-cube41.3

      \[\leadsto \frac{\color{blue}{\sqrt[3]{\left(\left(x - \sin x\right) \cdot \left(x - \sin x\right)\right) \cdot \left(x - \sin x\right)}}}{\sqrt[3]{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}\]
    5. Applied cbrt-undiv41.3

      \[\leadsto \color{blue}{\sqrt[3]{\frac{\left(\left(x - \sin x\right) \cdot \left(x - \sin x\right)\right) \cdot \left(x - \sin x\right)}{\left(\left(x - \tan x\right) \cdot \left(x - \tan x\right)\right) \cdot \left(x - \tan x\right)}}}\]
    6. Simplified0.1

      \[\leadsto \sqrt[3]{\color{blue}{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}}\]

    if -0.028503704682151434 < x < 0.028176034411070774

    1. Initial program 62.6

      \[\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}}\]

    if 0.028176034411070774 < 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}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -0.028503704682151434:\\ \;\;\;\;\sqrt[3]{{\left(\frac{x - \sin x}{x - \tan x}\right)}^{3}}\\ \mathbf{elif}\;x \le 0.028176034411070774:\\ \;\;\;\;\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 26.2s)Debug log

sample728.0ms

Algorithm
intervals

simplify17.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune7.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 31.4b

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

series625.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

422.0ms
(- x (sin x))
120.0ms
(/ (- x (sin x)) (- x (tan x)))
82.0ms
(- x (tan x))

simplify1.2s

Counts
39 → 63
Calls

39 calls. Slowest were:

238.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)))))
184.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
162.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)))))

prune618.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0.0b

localize38.0ms

Local error

Found 4 expressions with local error:

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

rewrite19.0ms

Algorithm
rewrite-expression-head
Counts
4 → 46
Calls

4 calls. Slowest were:

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

series128.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

59.0ms
(+ (* 27/2800 (pow x 4)) 1/2)
28.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
25.0ms
(* 9/40 (pow x 2))
16.0ms
(* 27/2800 (pow x 4))

simplify322.0ms

Counts
19 → 58
Calls

19 calls. Slowest were:

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

prune572.0ms

Pruning

4 alts after pruning (4 fresh and 0 done)

Merged error: 0.0b

localize12.0ms

Local error

Found 3 expressions with local error:

18.3b
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
0.5b
(* 27/2800 (pow x 4))
0.1b
(* 9/40 (pow x 2))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
3 → 35
Calls

3 calls. Slowest were:

6.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
2.0ms
(* 9/40 (pow x 2))
2.0ms
(* 27/2800 (pow x 4))

series81.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

50.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
19.0ms
(* 27/2800 (pow x 4))
12.0ms
(* 9/40 (pow x 2))

simplify156.0ms

Counts
16 → 44
Calls

16 calls. Slowest were:

34.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (* 27/2800 (pow x 4))))
26.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
25.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))

prune496.0ms

Pruning

4 alts after pruning (3 fresh and 1 done)

Merged error: 0.0b

localize17.0ms

Local error

Found 4 expressions with local error:

1.5b
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
1.5b
(- x (tan x))
1.5b
(- x (tan x))
0.1b
(/ (sin x) (- x (tan x)))

rewrite12.0ms

Algorithm
rewrite-expression-head
Counts
4 → 71
Calls

4 calls. Slowest were:

7.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
3.0ms
(/ (sin x) (- x (tan x)))
0.0ms
(- x (tan x))

series552.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

333.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
78.0ms
(/ (sin x) (- x (tan x)))
78.0ms
(- x (tan x))
64.0ms
(- x (tan x))

simplify2.4s

Counts
55 → 83
Calls

55 calls. Slowest were:

349.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
338.0ms
(- (* x (- x (tan x))) (* (- x (tan x)) (sin x)))
214.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

4 alts after pruning (2 fresh and 2 done)

Merged error: 0.0b

regimes104.0ms

Accuracy

100% (0.0b remaining)

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

bsearch123.0ms

end0.0ms

sample17.2s

Algorithm
intervals