show(((x + 1)^2).expand())

show(((x + 1) * (x - 1)).expand())

y = ((x-3)^7).expand(); show(y)

show(factor(y))

eq = ((x - 4) * (x - 5) * (x - 6) * 7).expand(); show(eq)

seq = solve(eq, x); show(seq)

seq[0].rhs(), seq[1].rhs(), seq[2].rhs()

show(factor(eq))

show(factor(4 * x^5 - 4 * x^4  - 13 * x^3 + x^2 - 17 * x + 5))

s = var('s')
ex = (s^3 + 4 * s^2 + 6 * s + 4) / (s^3 + 3 * s^2 + 3 * s + 1)
show(ex)

show(factor(ex))

pfex = ex.partial_fraction(); show(pfex)

show(pfex.expand())

show(pfex.simplify_rational())

expression = sin(x / (x^2 + x)) == exp((log(x) + 1)^2 - log(x)^2); show(expression)

show(expression.simplify())

show(expression.expand())

show(expression.simplify_rational())

a = var('a')
expr = (x^(a / 2) + 1)^2 * (x^(a / 2) - 1)^2 / (x^a - 1)
show(expr)

show(expr.expand())

show(expr.simplify())

show(expr.rational_simplify())

show(expr.simplify_full())
