网站建设| 数据库类| 图形图象| 程序设计| 现代办公| 操作系统| 考试认证| 网络技术| 软件工程| 电脑相关| 文学作品
网站开发| 网页制作| 操作系统| 图象图形| 考试认证| 数据库类| 程序设计| 硬件技术| 现代办公| 网络技术| 笑话频道
 
您的位置: 电脑书库首页-> 电脑文摘-> 程序设计-> Delphi/Pascal-> Delphi数学运算函数

Delphi数学运算函数
作者:佚名 来源:InterNet 加入时间:2004-11-25
相关文章 相关书籍:

Delphi数学运算函数
作者:lyboy99
e-mail:lyboy99@sina.com  
url: http://hnh.126.com
给大家提供几个常用函数,希望可以对你有帮助.
用下面的函数可以轻松,设计个强大的科学计算机器.

 

function rnd(arg1:double):double;
Begin
    result := Random * int(arg1);
end;

function arcsinh(arg1:double):double;
begin
       result:=Ln(arg1+sqrt(1+power(arg1,2)));
end;

function arccosh(arg1:double):double;
begin
       result :=Ln(arg1+sqrt(power(arg1,2)-1));
end;

function arctanh(arg1:double):double;
begin
       result :=Ln((1+arg1)/(1-arg1))/2;
end;

function arcsech(arg1:double):double;
begin
       result :=Ln((1/arg1)+sqrt(power((1/arg1),2)-1));
end;

function arccosech(arg1:double):double;
begin
       result :=Ln((1/arg1)+sqrt(1+power((1/arg1),2)));
end;

function arccoth(arg1:double):double;
begin
       result :=Ln((1+(1/arg1))/(1-(1/arg1)))/2;
end;

function degarcsin(arg1:double):double;
begin
       result :=arcsin(DegToRad(arg1));
end;

function arcsec(arg1:double):double;
begin
    result  := arccos(1/arg1);
end;

function degarcsec(arg1:double):double;
begin
    result := RadToDeg(arccos(1/arg1));
end;

function arccosec(arg1:double):double;
begin
    result  := arcsin(1/arg1);
end;

function degarccosec(arg1:double):double;
begin
    result  := RadToDeg(arcsin(1/arg1));
end;

function degarccos(arg1:double):double;
begin
       result :=arccos(DegToRad(arg1));
end;

function arccot(arg1:double):double;
begin
    result  := arctan(1/arg1);
end;

function degarccot(arg1:double):double;
begin
    result  := RadToDeg(arctan(1/arg1));
end;


function cosech(arg1:double):double;
begin
    result  := 2/(exp(arg1)-exp(-arg1));
end;


function sech(arg1:double):double;
begin
    result  := 2/(exp(arg1)+exp(-arg1));
end;

 

function tanh(arg1:double):double;
begin
    result  := (exp(arg1)-exp(arg1))/(exp(arg1)+exp(-arg1));
end;


function coth(arg1:double):double;
begin
    result := (exp(arg1)+exp(arg1))/(exp(arg1)-exp(-arg1));
end;

function degarctan(arg1:double):double;
begin
    result:= RadToDeg(arctan(arg1));
end;

function arg(arg1,arg2:double):double;
begin
    if arg1 < 0 then
      result := arctan(arg2/arg1)+Pi
    else
      if arg1>0 then
        result  := arctan(arg2/arg1)
      else
        if arg2 > 0 then
          result  := 0.5 * Pi
        else
          result := -0.5 * Pi;
end;

function sinh(arg1:double):double;
begin
    result := (exp(arg1)-exp(-arg1))*0.5;
end;

function cosh(arg1:double):double;
begin
    result  := (exp(arg1)+exp(-arg1))*0.5;
end;


function cot(arg1:double):double;
begin
      if Abs(arg1)>0.000000001 then result  := cotan(arg1) else result :=100000;
end;

function cotrad(arg1:double):double;
begin
    result := cotan(DegToRad(arg1));
end;


function sec(arg1:double):double;
begin
    result := 1/cos(arg1);
end;

function cosec(arg1:double):double;
begin
   if Abs(arg1)>0.000000001 then result:= 1/sin(arg1) else result:=1000000;
end;


function tanrad(arg1:double):double;
begin
    result  := tan(DegToRad(arg1));
end;

function sinrad(arg1:double):double;
begin
    result  := sin(DegToRad(arg1));
end;

function cosrad(arg1:double):double;
begin
    result := cos(DegToRad(arg1));
end;


function cosecrad(arg1:double):double;
begin
    result  := 1/sin(DegToRad(arg1));
end;


function secrad(arg1:double):double;
begin
    result:= 1/cos(DegToRad(arg1));
end;


function blanc(arg1:double):double;
Var
   temp,res:extended;
   count:integer;
begin
  Begin
  res:=0;
   for count := 0 to 49 do
   begin
     arg1:=arg1-int(arg1-(Ord(arg1<0)));
     if (arg1)<0.5 then temp:=(arg1) else temp:=(1-arg1);
     res:=res+ temp/(power(2,count));
     arg1:=2*arg1;
   end;
  end;
  result:=res;
end;

function min(arg1,arg2:double):double;
begin
    if arg1 < arg2 then
      result  := arg1
    else
      result := arg2;
end;

function max(arg1,arg2:double):double;
begin
    if arg1 < arg2 then
      result  := arg2
    else
      result  := arg1;
end;

function heaviside(arg1:double):double;
begin
    if arg1 < 0 then
      result := 0
    else
      result  := 1;
end;

function sign(arg1:double):double;
begin
    if arg1 < 0 then
      result := -1
    else
      if arg1 > 0 then
        result := 1.0
      else
        result := 0.0;
end;

function zero(arg1:double):double;
begin
    if arg1 = 0.0 then
      result := 0.0
    else
      result:= 1.0;
end;


function ceil(arg1:double):double;
begin
    if frac(arg1) > 0 then
      result:= int(arg1 + 1)
    else
      result:= int(arg1);
end;

function floor(arg1:double):double;
begin
    if frac(arg1) < 0 then
      result:= int(arg1 - 1)
    else
      result:= int(arg1);
end;

 


function radius(arg1,arg2:double):double;
begin
    result:= sqrt(sqr(arg1)+sqr(arg2));
end;



[文章录入员:fightter]

相关文章 相关书籍:
本站推荐内容

近期主机类热搜关键词:
美国服务器 美国服务器租用 海外服务器租用 国外服务器租用

Delphi/Pascal
C/C++/VC
C++Builder
Basic/VB类
Delphi/Pascal
Java编程
FORTRAN
其它
电脑教程阅读排行
·DELPHI下的多线程程序设计(...
·Delphi与Excel的亲密接...
·Delphi实现串口通信的常用的...
·Delphi中初始化.Ini文件...
·Delphi中用于读写(I/O)...
·谈谈Delphi中的类和对象
·Delphi编译错误中文手册
·Delphi中关于TApplic...
·OPENGL图形程序设计
·SQL的基本操作