home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / calculat / sm30a.zip / GAMMA.(X) < prev    next >
Text File  |  1993-11-14  |  1KB  |  32 lines

  1. # gamma.(x)
  2. # gamma(n) is the gamma function Γ(n), 
  3. # gamma(n)=inte(t^(n-1)*e^(-t), t from 0 to inf). 
  4. # gamma(n)=(n-1)!.
  5.  
  6. # gamma(n,x) is the incomplete gamma function, gamma(n,x)=
  7. # inte(t^n*e^(-t), t,0,x), d(gamma(n,x),x)=x^n*e^(-x).
  8. # gamma(n,0)=0, gamma(n,inf)=gamma(n+1)=n!.
  9. # gamma(n,x) is similar to gamma(n), but its power term is t^n, instead 
  10. # of t^(n-1). 
  11. # See also: ei, gamma, li.
  12.  
  13. # d(gamma(n_,x_),x_):= x^n*e^-x
  14. # d(gamma(x_) ,x_) := gamma(x)*polygamma(x)
  15.  
  16. gamma(1/2) := sqrt(pi)
  17. gamma(1) := 1
  18. gamma(2) := 1
  19. gamma(inf) := inf
  20. #gamma(n_) := if(n>1, if(isinteger(n), (n-1)!, (n-1)*gamma(n-1)))
  21. gamma(n_) := if( n>1 and isinteger(n), (n-1)! )
  22. gamma(x_) := if( x>0 and numeric==on, sqrt(2*pi)*x^(x-0.5)*e^(-x)*(1+1/12/x) )
  23.  
  24. gamma(n_,0):=0
  25. gamma(n_,inf):=gamma(n+1)
  26. gamma(-1,x_) := ei(-x)
  27. gamma(0,x_) := -e^-x
  28. gamma(-0.5,x_) := sqrt(pi)*erf(sqrt(x))
  29. gamma(-1/2,x_) := sqrt(pi)*erf(sqrt(x))
  30. #gamma(n_,x_) := if(n >= 1, n*gamma(n-1,x)-x^n*e^-x,
  31.     if(n < -1, (gamma(n+1,x)-x^(n+1)*e^-x)/(n+1)) )
  32.