Average Error: 30.7 → 0.0
Time: 42.4s
Precision: 64
Internal Precision: 128
\[\frac{x - \sin x}{x - \tan x}\]
\[\begin{array}{l} \mathbf{if}\;x \le -0.026318664286226652 \lor \neg \left(x \le 0.02873017490672516\right):\\ \;\;\;\;\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \left(\sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}} \cdot \sqrt[3]{\frac{x}{x - \tan x} - \frac{\sin x}{x - \tan x}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{9}{40} \cdot {x}^{2} - \left(\frac{1}{2} + {x}^{4} \cdot \frac{27}{2800}\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.026318664286226652 or 0.02873017490672516 < 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}}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt0.1

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

    if -0.026318664286226652 < x < 0.02873017490672516

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

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

Reproduce

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

Details

Time bar (total: 41.5s)Debug log

sample885.0ms

Algorithm
intervals
Results
58×432.0ms(body real 2560)
82×239.0ms(body real 1280)
62×123.0ms(body real 640)
35×50.0ms(body real 320)
12×11.0ms(body real 160)
256×8.0ms(pre true 80)
5.0ms(body real 80)

simplify19.0ms

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

prune15.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 33.9b

localize86.0ms

Local error

Found 3 expressions with local error:

0.9b
(- x (sin x))
0.8b
(- x (tan x))
0.0b
(/ (- x (sin x)) (- x (tan x)))

rewrite13.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
9.0ms
(/ (- x (sin x)) (- x (tan x)))
1.0ms
(- x (sin x))
1.0ms
(- x (tan x))

series431.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
212.0ms
(/ (- x (sin x)) (- x (tan x)))
144.0ms
(- x (tan x))
75.0ms
(- x (sin x))

simplify2.0s

Counts
39 → 63
Calls
39 calls:
Slowest
339.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)))))
298.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
285.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)))))
249.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
124.0ms
(- (+ (* 1/6 (pow x 3)) (* 1/5040 (pow x 7))) (* 1/120 (pow x 5)))

prune976.0ms

Pruning

3 alts after pruning (3 fresh and 0 done)

Merged error: 0b

localize50.0ms

Local error

Found 3 expressions with local error:

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

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

series134.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
58.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
44.0ms
(* 27/2800 (pow x 4))
32.0ms
(* 9/40 (pow x 2))

simplify526.0ms

Counts
16 → 45
Calls
16 calls:
Slowest
174.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (* 27/2800 (pow x 4)) 1/2)))
122.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
90.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
86.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
11.0ms
(* 9/40 (pow x 2))

prune822.0ms

Pruning

3 alts after pruning (2 fresh and 1 done)

Merged error: 0b

localize31.0ms

Local error

Found 4 expressions with local error:

0.8b
(- x (tan x))
0.8b
(- x (tan x))
0.5b
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
0.1b
(/ (sin x) (- x (tan x)))

rewrite37.0ms

Algorithm
rewrite-expression-head
Rules
17×add-sqr-sqrt
14×*-un-lft-identity
12×add-cube-cbrt
10×times-frac
add-log-exp
flip--
associate-/r/
add-exp-log
add-cbrt-cube
flip3--
pow1
associate-/l*
div-inv
distribute-rgt-out--
sub-neg
associate-/r*
difference-of-squares
sub-div
distribute-lft-out--
frac-sub
div-exp
diff-log
frac-2neg
clear-num
cbrt-undiv
Counts
4 → 71
Calls
4 calls:
Slowest
21.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
11.0ms
(/ (sin x) (- x (tan x)))
2.0ms
(- x (tan x))
1.0ms
(- x (tan x))

series1.0s

Counts
4 → 12
Calls
4 calls:
Slowest
576.0ms
(- (/ x (- x (tan x))) (/ (sin x) (- x (tan x))))
161.0ms
(- x (tan x))
141.0ms
(- x (tan x))
131.0ms
(/ (sin x) (- x (tan x)))

simplify3.6s

Counts
55 → 83
Calls
55 calls:
Slowest
565.0ms
(/ (* (* (sin x) (sin x)) (sin x)) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
438.0ms
(- (* x (- x (tan x))) (* (- x (tan x)) (sin x)))
337.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)))))
320.0ms
(+ (/ (pow (sin x) 2) (* (cos x) (pow x 2))) (+ (/ (pow (sin x) 3) (* (pow (cos x) 2) (pow x 3))) (/ (sin x) x)))
320.0ms
(+ (/ (pow (sin x) 2) (* (cos x) (pow x 2))) (+ (/ (pow (sin x) 3) (* (pow (cos x) 2) (pow x 3))) (/ (sin x) x)))

prune1.3s

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0b

localize28.0ms

Local error

Found 4 expressions with local error:

0.8b
(- x (tan x))
0.8b
(- x (tan x))
0.8b
(- x (tan x))
0.8b
(- x (tan x))

rewrite5.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
flip--
add-cube-cbrt
add-exp-log
add-cbrt-cube
flip3--
*-un-lft-identity
sub-neg
pow1
add-sqr-sqrt
Counts
4 → 44
Calls
4 calls:
Slowest
1.0ms
(- x (tan x))
1.0ms
(- x (tan x))
1.0ms
(- x (tan x))
1.0ms
(- x (tan x))

series405.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
103.0ms
(- x (tan x))
102.0ms
(- x (tan x))
102.0ms
(- x (tan x))
99.0ms
(- x (tan x))

simplify861.0ms

Counts
12 → 56
Calls
12 calls:
Slowest
215.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
209.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
185.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
183.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
11.0ms
(- x (/ (sin x) (cos x)))

prune1.1s

Pruning

2 alts after pruning (0 fresh and 2 done)

Merged error: 0b

regimes60.0ms

Accuracy

100% (0.0b remaining)

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

bsearch345.0ms

end0.0ms

sample26.6s

Algorithm
intervals
Results
1575×10.2s(body real 2560)
2694×9.6s(body real 1280)
1871×4.3s(body real 640)
989×1.5s(body real 320)
493×447.0ms(body real 160)
8000×272.0ms(pre true 80)
378×181.0ms(body real 80)