Hi,
I agree that there is a numerical part involved, but I suppose that one has to be very careful with this.
If you run
dist = MCNumber = 1000; Table[
Atemp = RandomReal[] - 0.5; Btemp = RandomReal[] - 0.5;
Ctemp = RandomReal[] - 0.5; Dtemp = RandomReal[] - 0.5;
Etemp = RandomReal[] - 0.5;
Norm[Sort[
Table[N[Roots[
Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0 /. {Aa -> Atemp,
Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp, Ee -> Etemp}, x]][[i,
2]], {i, 1,
Length[N[
Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee ==
0 /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Temp}, x]]]}]] -
Sort[Table[
N[Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0,
x] /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Etemp}][[i, 2]], {i, 1,
Length[N[
Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0,
x] /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Etemp}]]}]]], {k, 1, MCNumber}];
you get a list of distanced between the two solutions. In fact, most of them are, as expected, quite close to zero, but there are some large deviations as well:
Sort[dist][[-150 ;;]]
{0.447706, 0.468712, 0.478374, 0.51479, 0.536065, 0.537396, 0.543305, \
0.660131, 0.689731, 0.807025, 0.809497, 0.873262, 0.915736, 0.942873, \
1.0216, 1.06628, 1.07255, 1.07922, 1.07954, 1.08418, 1.13938, \
1.14699, 1.16781, 1.17355, 1.18269, 1.1934, 1.19466, 1.21008, \
1.25215, 1.27071, 1.28718, 1.29177, 1.3206, 1.32214, 1.33523, \
1.35991, 1.36773, 1.37844, 1.40719, 1.40724, 1.40763, 1.41086, \
1.43494, 1.4613, 1.46464, 1.47223, 1.47275, 1.47728, 1.49559, \
1.52547, 1.53006, 1.53025, 1.53896, 1.55807, 1.58614, 1.59941, \
1.63932, 1.64731, 1.65441, 1.65704, 1.6784, 1.68514, 1.71468, \
1.73314, 1.74677, 1.76276, 1.77466, 1.84156, 1.85621, 1.87894, \
1.88623, 1.90572, 1.92754, 1.94024, 1.94376, 1.96933, 1.98945, \
2.03146, 2.05536, 2.09187, 2.09309, 2.14448, 2.18454, 2.18603, \
2.19656, 2.20124, 2.22276, 2.24433, 2.24465, 2.2963, 2.37969, \
2.41349, 2.42688, 2.47719, 2.4975, 2.51811, 2.53008, 2.5723, 2.59401, \
2.63813, 2.644, 2.65012, 2.65131, 2.69886, 2.7626, 2.78525, 2.80045, \
2.81197, 2.87692, 2.90851, 2.93173, 2.94927, 3.04928, 3.073, 3.08039, \
3.11489, 3.15659, 3.16508, 3.20288, 3.21572, 3.21919, 3.23016, \
3.24037, 3.24488, 3.30734, 3.3232, 3.32944, 3.33474, 3.40173, \
3.41504, 3.41817, 3.48765, 3.52086, 3.54337, 3.58852, 3.599, 3.61942, \
3.77933, 3.97308, 4.13652, 4.1701, 4.28506, 4.57054, 4.66001, \
4.68233, 4.72912, 6.57014, 6.70144, 7.60674, 15.8699}
Of course, these might be numerical problems, but it is important to note that in many cases the solutions are off by quite a bit. If we look at the rather complicated formula for one of the solutions of the quartic
Solve[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0, x][[3]]
{x->1/2 \[Sqrt](Bb^2/(4 Aa^2)+(1/(3 Power[2, (3)^-1] Aa))((Sqrt[(-72 Aa Cc Ee+27 Aa Dd^2+27 Bb^2 Ee-9 Bb Cc Dd+2 Cc^3)^2-4 (12 Aa Ee-3 Bb Dd+Cc^2)^3]-72 Aa Cc Ee+27 Aa Dd^2+27 Bb^2 Ee-9 Bb Cc Dd+2 Cc^3)^(1/3))+(Power[2, (3)^-1] (12 Aa Ee-3 Bb Dd+Cc^2))/(3 Aa (Sqrt[(-72 Aa Cc Ee+27 Aa Dd^2+27 Bb^2 Ee-9 Bb Cc Dd+2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3 Aa))-Bb/(4 Aa)}
it becomes quite clear that sometimes we divide by terms that might be very close to zero, which might give large errors. But I think there is something else - which is my fault. Playing with this I found ar problem in my approach. The sort command does not do what I wanted it to do...
MCNumber = 1000; results = {}; Do[
Atemp = RandomReal[] - 0.5; Btemp = RandomReal[] - 0.5;
Ctemp = RandomReal[] - 0.5; Dtemp = RandomReal[] - 0.5;
Etemp = RandomReal[] - 0.5;
normpol =
Norm[Sort[
Table[N[Roots[
Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0 /. {Aa -> Atemp,
Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp, Ee -> Etemp},
x]][[i, 2]], {i, 1,
Length[N[
Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee ==
0 /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Temp}, x]]]}]] -
Sort[Table[
N[Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0,
x] /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Etemp}][[i, 2]], {i, 1,
Length[N[
Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0,
x] /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Etemp}]]}]]];
If[normpol > 1,
AppendTo[results, {Atemp, Btemp, Ctemp, Dtemp, Etemp}]], {k, 1,
MCNumber}];
Then you execute:
{Atemp, Btemp, Ctemp, Dtemp, Etemp} = results[[3]];
{Sort[Table[
N[Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0 /. {Aa -> Atemp,
Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp, Ee -> Etemp}, x]][[i,
2]], {i, 1,
Length[N[
Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0 /. {Aa -> Atemp,
Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp, Ee -> Temp}, x]]]}]],
Sort[Table[
N[Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0,
x] /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Etemp}][[i, 2]], {i, 1,
Length[N[
Roots[Aa x^4 + Bb x^3 + Cc x^2 + Dd x + Ee == 0,
x] /. {Aa -> Atemp, Bb -> Btemp, Cc -> Ctemp, Dd -> Dtemp,
Ee -> Etemp}]]}]]}
That gives:
{{-0.75599 - 0.773082 I, -0.75599 + 0.773082 I, 0.208992, 0.882124},
{-0.75599 + 0.773082 I, -0.75599 - 0.773082 I, 0.208992 - 5.55112*10^-17 I, 0.882124 + 0. I}}
so the first and the second solutions are exchanged. That leads to a large deviation in the norm. I suppose that this is why there were so many large deviations.
Cheers,
Marco