Average Error: 15.5 → 0.4
Time: 11.5s
Precision: 64
Internal Precision: 128
\[\tan^{-1} \left(N + 1\right) - \tan^{-1} N\]
\[\tan^{-1}_* \frac{1}{\left(N + 1\right) \cdot N + 1}\]

Error

Bits error versus N

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.5
Target0.4
Herbie0.4
\[\tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right)\]

Derivation

  1. Initial program 15.5

    \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N\]
  2. Using strategy rm
  3. Applied diff-atan14.5

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}}\]
  4. Simplified0.4

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{1 + \left(N + 1\right) \cdot N}\]
  5. Final simplification0.4

    \[\leadsto \tan^{-1}_* \frac{1}{\left(N + 1\right) \cdot N + 1}\]

Reproduce

herbie shell --seed 323378853 
(FPCore (N)
  :name "2atan (example 3.5)"

  :herbie-target
  (atan (/ 1 (+ 1 (* N (+ N 1)))))

  (- (atan (+ N 1)) (atan N)))

Details

Time bar (total: 10.2s)Debug log

sample82.0ms

Algorithm
intervals
Results
44.0ms90×body1280valid
13.0ms131×body80valid
9.0ms23×body640valid
4.0ms12×body320valid

simplify9.0ms

Counts
1 → 1
Calls
1 calls:
Slowest
9.0ms
(- (atan (+ N 1)) (atan N))

prune11.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 15.9b

localize29.0ms

Local error

Found 2 expressions with local error:

0.6b
(- (atan (+ N 1)) (atan N))
0.0b
(atan (+ N 1))

rewrite10.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
*-un-lft-identity
add-sqr-sqrt
add-cube-cbrt
add-exp-log
add-cbrt-cube
pow1
difference-of-squares
distribute-lft-out--
flip--
diff-atan
diff-log
flip3--
sub-neg
Counts
2 → 22
Calls
2 calls:
Slowest
8.0ms
(- (atan (+ N 1)) (atan N))
1.0ms
(atan (+ N 1))

series17.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
13.0ms
(- (atan (+ N 1)) (atan N))
3.0ms
(atan (+ N 1))

simplify160.0ms

Counts
12 → 28
Calls
12 calls:
Slowest
40.0ms
(+ 1 (* (+ N 1) N))
29.0ms
(- (+ N 1) N)
28.0ms
(/ (exp (atan (+ N 1))) (exp (atan N)))
10.0ms
(- (sqrt (atan (+ N 1))) (sqrt (atan N)))
9.0ms
(- (atan (+ N 1)) (atan N))

prune731.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.5b

localize22.0ms

Local error

Found 2 expressions with local error:

0.5b
(atan2 1 (+ 1 (* (+ N 1) N)))
0.0b
(* (+ N 1) N)

rewrite7.0ms

Algorithm
rewrite-expression-head
Rules
add-cube-cbrt
associate-*l*
*-un-lft-identity
add-sqr-sqrt
add-log-exp
add-exp-log
associate-*l/
add-cbrt-cube
pow1
flip-+
*-commutative
flip3-+
Counts
2 → 20
Calls
2 calls:
Slowest
6.0ms
(* (+ N 1) N)
0.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

series44.0ms

Counts
2 → 6
Calls
2 calls:
Slowest
38.0ms
(* (+ N 1) N)
5.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify278.0ms

Counts
10 → 26
Calls
10 calls:
Slowest
135.0ms
(* (- (* N N) (* 1 1)) N)
30.0ms
(* (+ (pow N 3) (pow 1 3)) N)
28.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))
28.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))
27.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

prune342.0ms

Pruning

7 alts after pruning (5 fresh and 2 done)

Merged error: 0.4b

localize37.0ms

Local error

Found 4 expressions with local error:

14.8b
(cbrt (* (+ N 1) N))
14.8b
(cbrt (* (+ N 1) N))
14.8b
(cbrt (* (+ N 1) N))
0.5b
(atan2 1 (+ 1 (* (* (cbrt (* (+ N 1) N)) (cbrt (* (+ N 1) N))) (cbrt (* (+ N 1) N)))))

rewrite12.0ms

Algorithm
rewrite-expression-head
Rules
associate-*l/
cbrt-div
add-log-exp
add-cube-cbrt
add-exp-log
add-cbrt-cube
*-un-lft-identity
pow1
add-sqr-sqrt
flip-+
pow1/3
flip3-+
cbrt-prod
Counts
4 → 40
Calls
4 calls:
Slowest
4.0ms
(cbrt (* (+ N 1) N))
4.0ms
(cbrt (* (+ N 1) N))
3.0ms
(cbrt (* (+ N 1) N))
0.0ms
(atan2 1 (+ 1 (* (* (cbrt (* (+ N 1) N)) (cbrt (* (+ N 1) N))) (cbrt (* (+ N 1) N)))))

series254.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
83.0ms
(cbrt (* (+ N 1) N))
82.0ms
(cbrt (* (+ N 1) N))
79.0ms
(cbrt (* (+ N 1) N))
10.0ms
(atan2 1 (+ 1 (* (* (cbrt (* (+ N 1) N)) (cbrt (* (+ N 1) N))) (cbrt (* (+ N 1) N)))))

simplify1.7s

Counts
21 → 52
Calls
21 calls:
Slowest
238.0ms
(- (+ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) N))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (pow N 2))))
234.0ms
(- (+ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) N))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (pow N 2))))
233.0ms
(- (+ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) N))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (pow N 2))))
140.0ms
(cbrt (* (- (* N N) (* 1 1)) N))
139.0ms
(cbrt (* (- (* N N) (* 1 1)) N))

prune884.0ms

Pruning

9 alts after pruning (6 fresh and 3 done)

Merged error: 0.4b

localize52.0ms

Local error

Found 4 expressions with local error:

14.8b
(cbrt (* (+ N 1) N))
14.8b
(cbrt (* (+ N 1) N))
0.6b
(cbrt N)
0.5b
(atan2 1 (+ 1 (* (* (cbrt (* (+ N 1) N)) (* (cbrt (+ N 1)) (cbrt N))) (cbrt (* (+ N 1) N)))))

rewrite9.0ms

Algorithm
rewrite-expression-head
Rules
add-log-exp
add-cube-cbrt
add-exp-log
associate-*l/
add-cbrt-cube
*-un-lft-identity
cbrt-div
pow1
add-sqr-sqrt
pow1/3
flip-+
flip3-+
cbrt-prod
Counts
4 → 37
Calls
4 calls:
Slowest
4.0ms
(cbrt (* (+ N 1) N))
3.0ms
(cbrt (* (+ N 1) N))
0.0ms
(cbrt N)
0.0ms
(atan2 1 (+ 1 (* (* (cbrt (* (+ N 1) N)) (* (cbrt (+ N 1)) (cbrt N))) (cbrt (* (+ N 1) N)))))

series611.0ms

Counts
4 → 12
Calls
4 calls:
Slowest
436.0ms
(cbrt N)
84.0ms
(cbrt (* (+ N 1) N))
81.0ms
(cbrt (* (+ N 1) N))
10.0ms
(atan2 1 (+ 1 (* (* (cbrt (* (+ N 1) N)) (* (cbrt (+ N 1)) (cbrt N))) (cbrt (* (+ N 1) N)))))

simplify1.2s

Counts
18 → 49
Calls
18 calls:
Slowest
237.0ms
(- (+ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) N))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (pow N 2))))
237.0ms
(- (+ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (* 1/3 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) N))) (* 1/9 (/ (* (cbrt -1) (exp (* 1/3 (- (log -1) (* 2 (log (/ -1 N))))))) (pow N 2))))
140.0ms
(cbrt (* (- (* N N) (* 1 1)) N))
140.0ms
(cbrt (* (- (* N N) (* 1 1)) N))
75.0ms
(- (+ (* 1/3 (pow (/ 1 N) 1/3)) (pow (/ 1 N) -2/3)) (* 1/9 (pow (/ 1 (pow N 4)) 1/3)))

prune936.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 0.4b

regimes173.0ms

Accuracy

0% (0.0b remaining)

Error of 0.4b against oracle of 0.4b and baseline of 0.4b

bsearch2.0ms

end0.0ms

sample2.6s

Algorithm
intervals
Results
1.6s2960×body1280valid
501.0ms3969×body80valid
241.0ms609×body640valid
101.0ms331×body320valid
28.0ms131×body160valid