Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using the Alekseyev suggestion I was able to write a python function that solves the problem.

def common_factor(expr_list):
numerators, denominators = zip(*map(lambda expr: (expr.numerator(),expr.denominator()),expr_list))
return gcd(numerators)/gcd(denominators)
click to hide/show revision 2
No.2 Revision

Using the Alekseyev suggestion I was able to write a simple python function that solves the problem.

def common_factor(expr_list):
numerators, denominators = zip(*map(lambda expr: (expr.numerator(),expr.denominator()),expr_list))
zip(*[expr.numerator_denominator() for expr in expr_list])
return gcd(numerators)/gcd(denominators)
click to hide/show revision 3
No.3 Revision

Using the Alekseyev suggestion I was able to write a simple python function that solves the problem.

def common_factor(expr_list): numerators, denominators = zip(*[expr.numerator_denominator() for expr in expr_list]) return gcd(numerators)/gcd(denominators)

gcd(numerators)/gcd(denominators)

click to hide/show revision 4
No.4 Revision

Using the Alekseyev suggestion I was able to write a simple python function that solves the problem.

def common_factor(expr_list): numerators, denominators = zip(*[expr.numerator_denominator() for expr in expr_list]) return gcd(numerators)/gcd(denominators)

click to hide/show revision 5
No.5 Revision

Using the @Max Alekseyev suggestion I was able to write a simple python function that solves the problem.

def common_factor(expr_list):
    numerators, denominators = zip(*[expr.numerator_denominator() for expr in expr_list])
    return gcd(numerators)/gcd(denominators)