Python | sympy.factor() method Last Updated : 12 Jun, 2019 Comments Improve Suggest changes Like Article Like Report With the help of sympy.factor() method, we can find the factors of mathematical expressions in the form of variables by using sympy.factor() method. Syntax : sympy.factor(expression) Return : Return factor of mathematical expression. Example #1 : In this example we can see that by using sympy.factor() method, we can find the factors of mathematical expression with variables. Here we use symbols() method also to declare a variable as symbol. Python3 1=1 # import sympy from sympy import expand, symbols, factor x, y = symbols('x y') gfg_exp = x + y exp = sympy.expand(gfg_exp**2) # Use sympy.factor() method fact = factor(exp) print(fact) Output : (x + y)**2 Example #2 : Python3 1=1 # import sympy from sympy import expand, symbols, factor x, y, z = symbols('x y z') gfg_exp = x + y + z exp = sympy.expand(gfg_exp**2) # Use sympy.factor() method fact = factor(exp) print(fact) Output : (x + y + z)**2 Comment More infoAdvertise with us Next Article Python | sympy.factor() method J Jitender_1998 Follow Improve Article Tags : Python SymPy Practice Tags : python Similar Reads Python | sympy.factorint() method With the help of sympy.factorint() method, we can find the factors and their corresponding multiplicities of a given integer. For input less than 2, factorint() behaves as follows: factorint(1) - returns the empty factorization {}. factorint(0) - returns {0:1}. factorint(-n) - adds -1:1 to the facto 1 min read Python | sympy.factorial() method With the help of sympy.factorial(), we can find the factorial of any number by using sympy.factorial() method. Syntax : sympy.factorial() Return : Return factorial of a number. Example #1 : In this example we can see that by using sympy.factorial(), we are able to find the factorial of number that i 1 min read Python | sympy.cofactors() method With the help of sympy.cofactors() method, we can find the cofactors of two numbers that is passed as a parameter in the sympy.cofactors() method. Syntax : sympy.cofactors(var1, var2) Return : Return tuple of cofactors. Example #1 : In this example we can see that by using sympy.cofactors() method, 1 min read Python | sympy.factorial2() method With the help of sympy.factorial2() method, we can find the Double factorial. Double factorial of a number is given by - n!! = \begin{cases} 1 & n = 0 \\ n(n-2)(n-4) \cdots 1 & n\ \text{positive odd} \\ n(n-2)(n-4) \cdots 2 & n\ \text{positive even} \\ (n+2)!!/(n+2) & n\ \text{negati 1 min read Python | sympy.core() method With the help of sympy.core() method, we can calculate the core_t(n) of a positive integer n. core(n, t) calculates the t-th power free part of n. If nâs prime factorization is : n = \prod_{i=1}^\omega p_i^{m_i} then core_t(n) = \prod_{i=1}^\omega p_i^{m_i \mod t} Syntax: core(n, t=2) Parameter: n - 1 min read Like