根据迭代公式写的反渐开线计算函数
//x is an RAD value
function ArcInv(x:double):double;
const
MAXError=0.00000001;
MAXCount=10000;
var
x1,x2,error:double;
num:integer;
begin
x1:=3*x;
x1:=exp(ln(x1)/3); //x=(3x)^(1/3)
error:=1; //maximum of error
num:=0; //counter of iterative
while (error>MAXError) and (num<MAXCount) do
begin
x2:=arccos(sin(x1)/(x+x1));
error:=abs(x2-x1); inc(num);
x1:=x2;
end;
Result:=x1;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:=Floattostr(arcinv(0.016516924))
end;