General approach
If {x0, y0}
is a root of a polynomial system {p1, p2}
such that there is no other root of the form {x0, y1}
, the multiplicity is given by the multiplicity of the zero x0
of the resultant
Resultant[p1, p2, y]
We can compute the multiplicity of this zero with
SparseArray[
CoefficientList[Resultant[p1, p2, y] /. x -> x0 + u, u]
]["NonzeroPositions"][[1, 1]] - 1
If a root {x0, y0}
lines up with another root {x0, y1}
, a linear transformation of the variables can always be found so that moves all the other roots off the line x = x0
. So in principle, this method can be applied to any system.
OP's example
In the OP's case, the command can be simplified a little since x0 == 0
:
SparseArray[
CoefficientList[Resultant[y^4 + 6 x^3*y + x^8, y^2 - x^3, y], x]
]["NonzeroPositions"][[1, 1]] - 1
(*
6
*)
Comparison
I assume the OP wants a method, not just the answer. (The OP's is simple enough to do, plug in x^3
for y
, in one's head after all.) We compare the NSolve
method and @belisarius's Solve
method with the Resultant
method.
My original method was to use NSolve
, which seems to work although the docs do not promise that it will, like this if we add Count
as @belisarius did:
Count[NSolve[{p1 == 0, p2 == 0}, {x, y}], {x -> 0.`, y -> 0.`}]
Generalizing @belisarius's answer, I would get something like
Count[Solve[p1 == 0 /. #, x, Reals] & /@ Solve[p2 == 0, y] // Flatten, x -> 0]
which indeed yields 6
on the OP's example.
A more difficult example
Now let's consider the system with y^2
replacing y
in the second polynomial:
p = {y^4 + 6 x^3*y + x^8, y^2 - x^3};
The two solve-based methods give different answers:
Count[NSolve[p == {0, 0}, {x, y}], {x -> 0.`, y -> 0.`}]
(* 9 *)
Count[Solve[p[[1]] == 0 /. #, x, Reals] & /@ Solve[p[[2]] == 0, y] // Flatten, x -> 0]
(* 10 *)
One solution gets counted twice in the Solve
method, I guess, because the Resultant
method yields
SparseArray[CoefficientList[Resultant[p[[1]], p[[2]], y], x]]["NonzeroPositions"][[1, 1]] - 1
(* 9 *)
Failure on repeated x0 - and the workaround
If we add some factors to the OP's system so that {x, y} = {0, 1}
is a root, all the current solutions fail to yield 6
:
p = {(y^4 + 6 x^3*y + x^8) (x^2 + (y - 1)^2), (y - x^3) (y - 1)};
Count[NSolve[p == {0, 0}, {x, y}], {x -> 0.`, y -> 0.`}]
(* 3 *)
Count[Solve[p[[1]] == 0 /. #, x, Reals] & /@ Solve[p[[2]] == 0, y] //
Flatten, x -> 0]
(* 8 *)
SparseArray[CoefficientList[Resultant[p[[1]], p[[2]], y], x]]["NonzeroPositions"][[1, 1]] - 1
(* 8 *)
Edit: Actually NSolve
gets close, literally. Numerical error leads to three of the roots being slightly off:
Count[Chop[NSolve[p == {0, 0}, {x, y}], 10^-50], {x -> 0, y -> 0}]
(* 6 *)
One can also use the Resultant
method by transforming the coordinates so that the root {0, 1}
is moved off the line x = 0
:
With[{p = p /. {x -> x + y, y -> y}},
SparseArray[CoefficientList[Resultant[p[[1]], p[[2]], y], x]]["NonzeroPositions"][[1, 1]] - 1]
(* 6 *)
Simply switching x
and y
also works in this case.
Orginal answer -- NSolve
gives the correct multiplicity in V10
NSolve
will return the multiplicity, which turns out to be 6 in this case:
NSolve[{y^4 + 6 x^3*y + x^8 == 0, y - x^3 == 0}, {x, y}, Reals]
(*
{{x -> 0., y -> 0.}, {x -> 0., y -> 0.}, {x -> 0., y -> 0.},
{x -> 0., y -> 0.}, {x -> 0., y -> 0.}, {x -> 0., y -> 0.}}
*)
(I included a solution using Eliminate
but it's not worth the space it would take up.)