This file is indexed.

/usr/share/doc/ruby-gsl/examples/roots/brent.rb is in ruby-gsl 2.1.0.3+dfsg1-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env ruby
require("gsl")
include Math

#solver = GSL::Root::FSolver.alloc(GSL::Root::FSolver::BISECTION)
#solver = GSL::Root::FSolver.alloc("falsepos")
#solver = GSL::Root::FSolver.alloc("brent")
solver = GSL::Root::FSolver.alloc(GSL::Root::FSolver::BRENT)
puts "using #{solver.name} method"

f = GSL::Function.alloc { |x, params|
  a = params[0]
  b = params[1]
  c = params[2]
  (a*x + b)*x + c
}

f.set_params(1, 0, -5)
expected = sqrt(5.0)

printf("%5s [%9s, %9s] %9s %10s %9s\n",
          "iter", "lower", "upper", "root",
          "err", "err(est)")

solver.set(f, 0.0, 5.0)
iter = 0
status = nil
while status != GSL::SUCCESS
  iter += 1
  status = solver.iterate
  r = solver.root
  xl = solver.x_lower
  xu = solver.x_upper
  status = solver.test_interval(0, 0.001)

  if status == GSL::SUCCESS
    printf("Converged:\n")
  end
  printf("%5d [%.7f, %.7f] %.7f %+.7f %.7f\n",
         iter, xl, xu, r, r - expected, xu - xl)
end

p f.fsolve(0, 5)