home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / e / e032 / 3.ddi / FILES / DISCRETE.PAK / COMBINA2.M < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.3 KB  |  62 lines

  1.  
  2. (* :Title: Combinatorial Simplification *)
  3.  
  4. (* :Author: Roman Maeder *)
  5.  
  6. (* :Summary: combinatorial simplifications useful for summation *)
  7.  
  8. (* :Context: DiscreteMath`CombinatorialSimplification` *)
  9.  
  10. (* :Package Version: 1.1 *)
  11.  
  12. (* :Copyright: Copyright 1988, Wolfram Research Inc. *)
  13.  
  14. (* :History: *)
  15.  
  16. (* :Keywords: *)
  17.  
  18. (* :Source: none *)
  19.  
  20. (* :Warning: redefines Factorial, Binomial, and Product. *)
  21.  
  22. (* :Mathematica Version: 2.0 *)
  23.  
  24. (* :Limitation:  *)
  25.  
  26. (* :Discussion: *)
  27.  
  28.  
  29. BeginPackage["DiscreteMath`CombinatorialSimplification`"]
  30.  
  31. Begin["Private`"]
  32.  
  33. protection = Unprotect[Factorial, Binomial, Product]
  34.  
  35. Factorial/:
  36.   (n_)!/(m_)! := Product[i, {i, m+1, n}]    /; n - m > 0 && IntegerQ[n-m]
  37. Factorial/:
  38.   (n_)!/(m_)! := 1/Product[i, {i, n+1, m}]    /; m - n > 0 && IntegerQ[m-n]
  39.  
  40. Binomial/:
  41.   Binomial[n_, k_]/Binomial[n_, k1_] := (n-k+1)/k /; k1 == k-1
  42. Binomial/:
  43.   Binomial[n_, k1_]/Binomial[n_, k_] := k/(n-k+1) /; k1 == k-1
  44.  
  45. Product/:
  46.   Product[t_, {x_, a_, n_, 1}]/Product[t_, {x_, a_, n1_, 1}] :=
  47.     (t /. x-> n)                    /; n1 == n-1
  48. Product/:
  49.   Product[t_, {x_, a_, n1_, 1}]/Product[t_, {x_, a_, n_, 1}] :=
  50.     1/(t /. x-> n)                    /; n1 == n-1
  51.  
  52. Factorial/:
  53.   (k_)! k1_ := (k1)!        /; k1 - k == 1
  54.  
  55. Protect[Evaluate[protection]]
  56.  
  57. End[]
  58.  
  59. EndPackage[]
  60.  
  61. Null
  62.