/usr/share/radiance/root.cal is in radiance-materials 4R1+20120125-1.1.
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 | { RCSid $Id: root.cal,v 1.3 2011/10/11 15:40:54 greg Exp $ }
{
root.cal - calculate zeroes of functions using Newton's method.
2/3/88
}
FTINY : 1e-9;
root(f, x0) = root2(f, x0, x0-f(x0)/lim(f1(f,x0)), nit);
root2(f, x0, x1, i) = if(i,
if(err-abs(x1-x0),
x1,
root2(f,x1,x1-f(x1)/lim(f1(f,x1)),i-1)),
0);
abs(x) = if(x, x, -x);
lim(x) = if(x, max(x,err), -max(-x,err));
max(a,b) = if(a-b, a, b);
f1(f,x) = (f(x+FTINY)-f(x-FTINY))/(2*FTINY); { numerical derivative }
err = 1e-5;
nit = 100;
|