Package dsc_suite :: Package tools :: Module math
[hide private]
[frames] | no frames]

Source Code for Module dsc_suite.tools.math

 1  """module math 
 2  This module implements same mathematical operations which are not provided by the standard math module. Attention: Using this module and the standard Python math module can lead to namespace problems.  
 3  """ 
 4  from __future__ import absolute_import 
 5   
 6  from math import factorial as fak 
 7  #from scipy import comb as n_over_k 
 8   
 9  """ 
10  def fak(n): 
11      if n > 1: 
12          return fak(n-1)*n 
13      else: 
14          return 1 
15  """ 
16   
17   
18  """ 
19  deprecated: use scipy.comb instead 
20  def n_over_k(n, k): 
21      return fak(n)/(fak(k)*fak(n-k)) 
22  """ 
23   
24 -def catalan_number(n):
25 """catlan_number(n) 26 Returns the Catlan Number of the n 27 """ 28 return fak(2*n)/((n+1)*fak(n)**2)
29 #return fak(2*n)/(fak(n+1)*fak(n)) 30