Average Error: 31.1 → 0.1
Time: 25.8s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.5981192504292256:\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\ \mathbf{elif}\;x \le 0.03156574465888638:\\ \;\;\;\;\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 < -1.5981192504292256

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt0.1

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

    if -1.5981192504292256 < x < 0.03156574465888638

    1. Initial program 62.7

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

      \[\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.1

      \[\leadsto \color{blue}{\left(\frac{9}{40} \cdot {x}^{2} - \frac{27}{2800} \cdot {x}^{4}\right) - \frac{1}{2}}\]

    if 0.03156574465888638 < x

    1. Initial program 0.1

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

      \[\leadsto \color{blue}{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.5981192504292256:\\ \;\;\;\;\sqrt{\frac{x - \sin x}{x - \tan x}} \cdot \sqrt{\frac{x - \sin x}{x - \tan x}}\\ \mathbf{elif}\;x \le 0.03156574465888638:\\ \;\;\;\;\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 2019005 
(FPCore (x)
  :name "sintan (problem 3.4.5)"
  (/ (- x (sin x)) (- x (tan x))))

Details

Time bar (total: 25.4s)Debug log

sample890.0ms

Algorithm
intervals

simplify30.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

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

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 31.2b

localize38.0ms

Local error

Found 3 expressions with local error:

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

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

series248.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

88.0ms
(/ (- x (sin x)) (- x (tan x)))
84.0ms
(- x (tan x))
75.0ms
(- x (sin x))

simplify1.5s

Counts
39 → 63
Calls

39 calls. Slowest were:

641.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)))))
200.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)))))
187.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))

prune612.0ms

Pruning

5 alts after pruning (5 fresh and 0 done)

Merged error: 0.0b

localize9.0ms

Local error

Found 4 expressions with local error:

1.1b
(- x (tan x))
1.1b
(- x (tan x))
1.1b
(- (/ 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))))
4.0ms
(/ (sin x) (- x (tan x)))
0.0ms
(- x (tan x))

series517.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

288.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
86.0ms
(- x (tan x))
82.0ms
(- x (tan x))
61.0ms
(/ (sin x) (- x (tan x)))

simplify2.4s

Counts
55 → 83
Calls

55 calls. Slowest were:

471.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
260.0ms
(- (* x (- x (tan x))) (* (- x (tan x)) (sin x)))
207.0ms
(+ (/ (pow (sin x) 2) (* (cos x) (pow x 2))) (+ (/ (pow (sin x) 3) (* (pow (cos x) 2) (pow x 3))) (/ (sin x) x)))

prune826.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize19.0ms

Local error

Found 3 expressions with local error:

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

rewrite11.0ms

Algorithm
rewrite-expression-head
Counts
3 → 36
Calls

3 calls. Slowest were:

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

series82.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

35.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
28.0ms
(* 27/2800 (pow x 4))
19.0ms
(* 9/40 (pow x 2))

simplify283.0ms

Counts
16 → 45
Calls

16 calls. Slowest were:

73.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (* 27/2800 (pow x 4)) 1/2)))
61.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
54.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

prune431.0ms

Pruning

5 alts after pruning (4 fresh and 1 done)

Merged error: 0.0b

localize8.0ms

Local error

Found 3 expressions with local error:

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

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
3 → 35
Calls

3 calls. Slowest were:

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

series94.0ms

Counts
3 → 9
Calls

3 calls. Slowest were:

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

simplify112.0ms

Counts
16 → 44
Calls

16 calls. Slowest were:

35.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (* 27/2800 (pow x 4))))
13.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))
11.0ms
(- (* 9/40 (pow x 2)) (* 27/2800 (pow x 4)))

prune390.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.0b

regimes100.0ms

Accuracy

99.8% (0.1b remaining)

Error of 0.1b against oracle of 0.0b and baseline of 31.1b

bsearch141.0ms

end0.0ms

sample16.5s

Algorithm
intervals