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

    1. Initial program 0.0

      \[\frac{x - \sin x}{x - \tan x}\]

    if -0.02835376382194105 < x < 0.029570961685677147

    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.02835376382194105 \lor \neg \left(x \le 0.029570961685677147\right):\\ \;\;\;\;\frac{x - \sin x}{x - \tan x}\\ \mathbf{else}:\\ \;\;\;\;{x}^{2} \cdot \frac{9}{40} - \left(\frac{27}{2800} \cdot {x}^{4} + \frac{1}{2}\right)\\ \end{array}\]

Reproduce

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

Details

Time bar (total: 41.2s)Debug log

sample744.0ms

Algorithm
intervals
Results
317.0ms50×body2560valid
227.0ms85×body1280valid
113.0ms66×body640valid
56.0ms28×body320valid
16.0ms19×body160valid
4.0msbody80valid

simplify55.0ms

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

prune17.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 31.5b

localize43.0ms

Local error

Found 3 expressions with local error:

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

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

series327.0ms

Counts
3 → 9
Calls
3 calls:
Slowest
154.0ms
(/ (- x (sin x)) (- x (tan x)))
104.0ms
(- x (tan x))
68.0ms
(- x (sin x))

simplify1.7s

Counts
39 → 63
Calls
39 calls:
Slowest
283.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)))))
282.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)))))
254.0ms
(/ (* (* (- x (sin x)) (- x (sin x))) (- x (sin x))) (* (* (- x (tan x)) (- x (tan x))) (- x (tan x))))
183.0ms
(- (+ (* 1/3 (pow x 3)) (+ (* 2/15 (pow x 5)) (* 17/315 (pow x 7)))))
99.0ms
(- (+ (* 1/6 (pow x 3)) (* 1/5040 (pow x 7))) (* 1/120 (pow x 5)))

prune956.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.0b

localize49.0ms

Local error

Found 3 expressions with local error:

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

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

series105.0ms

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

simplify463.0ms

Counts
16 → 45
Calls
16 calls:
Slowest
147.0ms
(/ (exp (* 9/40 (pow x 2))) (exp (+ (* 27/2800 (pow x 4)) 1/2)))
89.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
89.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
87.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
8.0ms
(* 9/40 (pow x 2))

prune667.0ms

Pruning

3 alts after pruning (1 fresh and 2 done)

Merged error: 0.0b

localize30.0ms

Local error

Found 4 expressions with local error:

15.3b
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
15.3b
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
15.3b
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
15.0b
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

rewrite38.0ms

Algorithm
rewrite-expression-head
Rules
cbrt-prod
add-cube-cbrt
*-un-lft-identity
add-sqr-sqrt
add-log-exp
cbrt-div
flip--
add-exp-log
add-cbrt-cube
flip3--
pow1
pow1/3
associate--r+
diff-log
sub-neg
Counts
4 → 52
Calls
4 calls:
Slowest
11.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))
9.0ms
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
9.0ms
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
9.0ms
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))

series734.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
238.0ms
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
225.0ms
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
218.0ms
(cbrt (- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2)))
53.0ms
(- (* 9/40 (pow x 2)) (+ (* 27/2800 (pow x 4)) 1/2))

simplify6.2s

Counts
28 → 64
Calls
28 calls:
Slowest
465.0ms
(- (pow -1/2 1/3) (+ (* 3/20 (* (pow x 2) (pow -1/2 1/3))) (* 9/560 (* (pow x 4) (pow -1/2 1/3)))))
416.0ms
(- (pow -1/2 1/3) (+ (* 3/20 (* (pow x 2) (pow -1/2 1/3))) (* 9/560 (* (pow x 4) (pow -1/2 1/3)))))
397.0ms
(- (exp (* 1/3 (- (log -27/2800) (* 4 (log (/ 1 x)))))) (+ (* 70/9 (/ (exp (* 1/3 (- (log -27/2800) (* 4 (log (/ 1 x)))))) (pow x 2))) (* 3500/81 (/ (exp (* 1/3 (- (log -27/2800) (* 4 (log (/ 1 x)))))) (pow x 4)))))
366.0ms
(cbrt (- (pow (* 9/40 (pow x 2)) 3) (pow (+ (* 27/2800 (pow x 4)) 1/2) 3)))
353.0ms
(- (pow -1/2 1/3) (+ (* 3/20 (* (pow x 2) (pow -1/2 1/3))) (* 9/560 (* (pow x 4) (pow -1/2 1/3)))))

prune1.2s

Pruning

3 alts after pruning (0 fresh and 3 done)

Merged error: 0.0b

regimes140.0ms

Accuracy

100% (0.0b remaining)

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

bsearch349.0ms

end0.0ms

sample27.4s

Algorithm
intervals
Results
10.8s1567×body2560valid
10.2s2758×body1280valid
4.0s1925×body640valid
1.6s940×body320valid
584.0ms474×body160valid
173.0ms336×body80valid