分享
 
 
 

Delphi下常用数学运算函数

王朝delphi·作者佚名  2006-01-08
窄屏简体版  字體: |||超大  

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;

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有