19 lines
619 B
Text
19 lines
619 B
Text
> p := randpoly( x ); # pick a random polynomial in x
|
|
5 4 3 2
|
|
p := -56 - 7 x + 22 x - 55 x - 94 x + 87 x
|
|
|
|
> rem( p, x^2 + 2, x, 'q' ); # remainder
|
|
220 + 169 x
|
|
|
|
> q; # quotient
|
|
3 2
|
|
-7 x + 22 x - 41 x - 138
|
|
|
|
> quo( p, x^2 + 2, x, 'r' ); # quotient
|
|
3 2
|
|
-7 x + 22 x - 41 x - 138
|
|
|
|
> r; # remainder
|
|
220 + 169 x
|
|
> expand( (x^2+2)*q + r - p ); # check
|
|
0
|