Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SylvesterMatrix[poly1_, poly2_, var_] := With[{coeffs1 = Reverse[CoefficientList[poly1, var]], coeffs2 = Reverse[CoefficientList[poly2, var]], l1, l2},
- l1 = Length[coeffs1]; l2 = Length[coeffs2];
- Join[If[l2 - 2 > 0, NestList[RotateRight, PadRight[coeffs1, l1 + l2 - 2], l2 - 2], {}],
- If[l1 - 2 > 0, NestList[RotateRight, PadRight[coeffs2, l1 + l2 - 2], l1 - 2], {}]]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement