2 from timeit
import default_timer
as clock
3 from sympy
import Symbol
, Add
, Mul
, Integer
, ADD
, MUL
, POW
, INTEGER
, SYMBOL
, \
4 multinomial_coefficients
26 a
= multinomial_coefficients(4, N
)
27 b
= multinomial_coefficients(4, 2*N
)
28 t_mul
= clock() - t_mul
30 print "# of terms:", len(a2
.args
)
31 print "time doing multinomial_coefficients:", t_mul
32 print "total time2:", t_tot
38 return sympy
.Add(*[csympy2sympy(x
) for x
in a
.args
])
40 return sympy
.Mul(*[csympy2sympy(x
) for x
in a
.args
])
42 return sympy
.Pow(*[csympy2sympy(x
) for x
in a
.args
])
43 elif a
.type == INTEGER
:
44 return sympy
.sympify(str(a
))
45 elif a
.type == SYMBOL
:
46 return sympy
.sympify(str(a
))
48 raise NotImplementedError("sorry")
50 #e_sympy = csympy2sympy(e)
51 #a2_sympy = doit2(e_sympy)[0]
52 #a2_csympy = csympy2sympy(a2)
53 #print "comparison with sympy:"
54 #print a2_sympy == a2_csympy