CoCalc Shared Filesteaching / math-3012b / notes / multiplying_polynomials.sagews
Author: Fidel Barrera-Cruz
Views : 6
p1=sum([x^(25*i) for i in range(4)])
p2=sum([x^(5*i) for i in range(16)])
show(p1)
show(p2)
show(expand(p1*p2))

$\displaystyle x^{75} + x^{50} + x^{25} + 1$
$\displaystyle x^{75} + x^{70} + x^{65} + x^{60} + x^{55} + x^{50} + x^{45} + x^{40} + x^{35} + x^{30} + x^{25} + x^{20} + x^{15} + x^{10} + x^{5} + 1$
$\displaystyle x^{150} + x^{145} + x^{140} + x^{135} + x^{130} + 2 \, x^{125} + 2 \, x^{120} + 2 \, x^{115} + 2 \, x^{110} + 2 \, x^{105} + 3 \, x^{100} + 3 \, x^{95} + 3 \, x^{90} + 3 \, x^{85} + 3 \, x^{80} + 4 \, x^{75} + 3 \, x^{70} + 3 \, x^{65} + 3 \, x^{60} + 3 \, x^{55} + 3 \, x^{50} + 2 \, x^{45} + 2 \, x^{40} + 2 \, x^{35} + 2 \, x^{30} + 2 \, x^{25} + x^{20} + x^{15} + x^{10} + x^{5} + 1$
cookies=sum([x^(2*i) for i in range(1,5)])
brownies=x^2+x^3+x^4+x^5
show(brownies)

$\displaystyle x^{8} + x^{6} + x^{4} + x^{2}$
$\displaystyle x^{5} + x^{4} + x^{3} + x^{2}$
$\displaystyle x^{8} + x^{7} + x^{6} + x^{5} + x^{4} + x^{3} + x^{2}$
$\displaystyle x^{21} + 2 \, x^{20} + 4 \, x^{19} + 6 \, x^{18} + 8 \, x^{17} + 10 \, x^{16} + 12 \, x^{15} + 13 \, x^{14} + 13 \, x^{13} + 12 \, x^{12} + 10 \, x^{11} + 8 \, x^{10} + 6 \, x^{9} + 4 \, x^{8} + 2 \, x^{7} + x^{6}$