mailr11342 - in /branches/bieri_gui: ./ maths_fns/pseudo_ellipse.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by michael . bieri on July 27, 2010 - 03:29:
Author: michaelbieri
Date: Tue Jul 27 03:29:07 2010
New Revision: 11342

URL: http://svn.gna.org/viewcvs/relax?rev=11342&view=rev
Log:
Merged revisions 11340-11341 via svnmerge from 
svn+ssh://michaelbieri@xxxxxxxxxxx/svn/relax/1.3

........
  r11340 | bugman | 2010-07-23 18:56:51 +1000 (Fri, 23 Jul 2010) | 3 lines
  
  Hardcoded the factorial() function using a dictionary to return support for 
Python 2.4 and 2.5.
........
  r11341 | bugman | 2010-07-23 19:20:58 +1000 (Fri, 23 Jul 2010) | 3 lines
  
  Converted the dictionary to a list in factorial() for speed.
........

Modified:
    branches/bieri_gui/   (props changed)
    branches/bieri_gui/maths_fns/pseudo_ellipse.py

Propchange: branches/bieri_gui/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jul 27 03:29:07 2010
@@ -1,1 +1,1 @@
-/1.3:1-11338
+/1.3:1-11341

Modified: branches/bieri_gui/maths_fns/pseudo_ellipse.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/maths_fns/pseudo_ellipse.py?rev=11342&r1=11341&r2=11342&view=diff
==============================================================================
--- branches/bieri_gui/maths_fns/pseudo_ellipse.py (original)
+++ branches/bieri_gui/maths_fns/pseudo_ellipse.py Tue Jul 27 03:29:07 2010
@@ -24,7 +24,64 @@
 """Module for the pseudo-elliptical functions."""
 
 # Python module import.
-from math import factorial, pi
+from math import pi
+
+
+def factorial(n):
+    """Return n!
+
+    @param n:   The number to return the factorial of.
+    @type n:    int
+    @return:    n!
+    @rtype:     int
+    """
+
+    # A list of factorials.
+    fact = [
+            1,
+            1,
+            2,
+            6,
+            24,
+            120,
+            720,
+            5040,
+            40320,
+            362880,
+            3628800,
+            39916800,
+            479001600,
+            6227020800,
+            87178291200,
+            1307674368000,
+            20922789888000,
+            355687428096000,
+            6402373705728000,
+            121645100408832000,
+            2432902008176640000,
+            51090942171709440000,
+            1124000727777607680000,
+            25852016738884976640000,
+            620448401733239439360000,
+            15511210043330985984000000,
+            403291461126605635584000000,
+            10888869450418352160768000000,
+            304888344611713860501504000000,
+            8841761993739701954543616000000,
+            265252859812191058636308480000000,
+            8222838654177922817725562880000000,
+            263130836933693530167218012160000000,
+            8683317618811886495518194401280000000,
+            295232799039604140847618609643520000000,
+            10333147966386144929666651337523200000000,
+            371993326789901217467999448150835200000000,
+            13763753091226345046315979581580902400000000,
+            523022617466601111760007224100074291200000000,
+            20397882081197443358640281739902897356800000000
+    ]
+
+    # Return the value.
+    return fact[n]
 
 
 def pec(x, y):




Related Messages


Powered by MHonArc, Updated Tue Jul 27 03:40:02 2010