SimWe仿真论坛's Archiver

COMSOL 2008年会圆满结束!

ztyt110 发表于 2007-3-23 19:27

maple中 双阶乘函数--double facorial

在mathmatica中直接可以用!!表示双阶乘double facorial,而在maple中好像没有
编写一个,需要的可以,直接用


> ii:=proc(n) local i,a;iquo(n,2,'r'): if n=0 then a:=1; #把0!!定义成1,iquo函数是把n除以2的余给r
> elif r=0 then a:=1; for i from 0 to (n-2)/2 do
>      a:=a*(2*(i+1));od;
> else a:=1;for i from 0 to (n-1)/2 do
>      a:=a*(2*i+1);od;fi;
> end;




这样以后调用可以直接下面的方式。
> ii(2);

页: [1]
 

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.