Average Error: 15.1 → 0.4
Time: 6.9s
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.1
Target0.4
Herbie0.4
\[\tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right)\]

Derivation

  1. Initial program 15.1

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

    \[\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 2019008 
(FPCore (N)
  :name "2atan (example 3.5)"

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

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

Details

Time bar (total: 5.9s)Debug log

sample72.0ms

Algorithm
intervals

simplify8.0ms

Counts
1 → 1
Calls

1 calls. Slowest were:

8.0ms
(- (atan (+ N 1)) (atan N))

prune9.0ms

Pruning

1 alts after pruning (1 fresh and 0 done)

Merged error: 14.1b

localize22.0ms

Local error

Found 2 expressions with local error:

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

rewrite9.0ms

Algorithm
rewrite-expression-head
Counts
2 → 22
Calls

2 calls. Slowest were:

7.0ms
(- (atan (+ N 1)) (atan N))
1.0ms
(atan (+ N 1))

series15.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

12.0ms
(- (atan (+ N 1)) (atan N))
3.0ms
(atan (+ N 1))

simplify132.0ms

Counts
12 → 28
Calls

12 calls. Slowest were:

36.0ms
(+ 1 (* (+ N 1) N))
31.0ms
(- (+ N 1) N)
15.0ms
(/ (exp (atan (+ N 1))) (exp (atan N)))

prune198.0ms

Pruning

2 alts after pruning (1 fresh and 1 done)

Merged error: 0.1b

localize8.0ms

Local error

Found 2 expressions with local error:

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

rewrite3.0ms

Algorithm
rewrite-expression-head
Counts
2 → 20
Calls

2 calls. Slowest were:

2.0ms
(* (+ N 1) N)
0.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

series23.0ms

Counts
2 → 6
Calls

2 calls. Slowest were:

20.0ms
(* (+ N 1) N)
3.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify136.0ms

Counts
10 → 26
Calls

10 calls. Slowest were:

70.0ms
(* (- (* N N) (* 1 1)) N)
15.0ms
(* (+ (pow N 3) (pow 1 3)) N)
13.0ms
(atan2 1 (+ N (+ (pow N 2) 1)))

prune179.0ms

Pruning

5 alts after pruning (3 fresh and 2 done)

Merged error: 0.1b

localize6.0ms

Local error

Found 4 expressions with local error:

14.2b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
14.2b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
0.6b
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
0.1b
(atan2 1 (+ 1 (* (+ N 1) N)))

rewrite6.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

5.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))

series39.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

16.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
12.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
5.0ms
(* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
4.0ms
(atan2 1 (+ 1 (* (+ N 1) N)))

simplify836.0ms

Counts
42 → 73
Calls

42 calls. Slowest were:

42.0ms
(+ (log (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (log (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))
38.0ms
(* (atan2 1 (+ 1 (* (+ N 1) N))) (atan2 1 (+ 1 (* (+ N 1) N))))
38.0ms
(sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))

prune574.0ms

Pruning

6 alts after pruning (4 fresh and 2 done)

Merged error: 0.1b

localize12.0ms

Local error

Found 4 expressions with local error:

14.2b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
14.2b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
14.2b
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
0.6b
(* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))

rewrite17.0ms

Algorithm
rewrite-expression-head
Counts
4 → 61
Calls

4 calls. Slowest were:

14.0ms
(* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
1.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))

series43.0ms

Counts
4 → 12
Calls

4 calls. Slowest were:

14.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
13.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
13.0ms
(sqrt (atan2 1 (+ 1 (* (+ N 1) N))))
3.0ms
(* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))

simplify1.2s

Counts
42 → 73
Calls

42 calls. Slowest were:

118.0ms
(* (* (* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))) (* (* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))
94.0ms
(* (* (* (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))) (* (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))) (* (* (sqrt (atan2 1 (+ 1 (* (+ N 1) N)))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))) (sqrt (atan2 1 (+ 1 (* (+ N 1) N))))))
45.0ms
(sqrt (* (cbrt (atan2 1 (+ 1 (* (+ N 1) N)))) (cbrt (atan2 1 (+ 1 (* (+ N 1) N))))))

prune622.0ms

Pruning

8 alts after pruning (5 fresh and 3 done)

Merged error: 0.1b

regimes93.0ms

Accuracy

0% (0.0b remaining)

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

bsearch1.0ms

end0.0ms

sample1.7s

Algorithm
intervals