{{{id=1|
x, a0, a1, a2 = var('x, a0, a1, a2')
solve([a2*x^2 + a1*x + a0 == 0],x)
///
}}}
{{{id=2|
x, a0, a1, a2, a3 = var('x, a0, a1, a2, a3')
solve([a3*x^3+a2*x^2+a1*x^1+a0 ==0],x)
///
}}}
{{{id=4|
f(x)=(x^2+x-3)/(x+3)
f.partial_fraction()
///
}}}
{{{id=5|
S = RR['x']
f=x^5+4*x^4-3*x^2-2*x+1
g=x^3+3*x^2-4
def poldiv(f,g):
if f.degree(x) < g.degree(x):
return f
else:
m=f.degree(x)
n=g.degree(x)
return f-g*f.coefficient(x^m)/g.coefficient(x^n)*x^(m-n)
///
}}}
{{{id=10|
expand(poldiv(f,g))
///
}}}
{{{id=8|
K=[(f,0)]
m=f.degree(x)
n=g.degree(x)
h=f
while m >= n:
K.append((expand(poldiv(h,g)),expand(h.coefficient(x^m)/g.coefficient(x^n)*x^(m-n))))
h=expand(poldiv(h,g))
print h
m=m-1
///
x^4 + x^2 - 2*x + 1
-3*x^3 + x^2 + 2*x + 1
10*x^2 + 2*x - 11
}}}
{{{id=9|
K
///
}}}
{{{id=16|
h=f/g
h.partial_fraction()
///
}}}
{{{id=17|
///
}}}