I have a list of polynomial equations which I can solve using NSolve
. However, it gives me a large number of similar solutions. The solutions are largely identical except for numerical error. The solution time is also far longer than I would like. Can we find a way of not calculating nearly identical solutions?
The unknowns and the equations are (sorry for the length and Greek)
uk = {A[0], A[1], B[1], A[2], B[2], A[3], B[3]};
eqns = {\[Omega]0^2 A[0] + \[Beta] A[0]^3 + 3/2 \[Beta] A[0] A[1]^2 +
3/4 \[Beta] A[1]^2 A[2] + 3/2 \[Beta] A[0] A[2]^2 +
3/2 \[Beta] A[1] A[2] A[3] + 3/2 \[Beta] A[0] A[3]^2 +
3/2 \[Beta] A[0] B[1]^2 - 3/4 \[Beta] A[2] B[1]^2 +
3/2 \[Beta] A[1] B[1] B[2] - 3/2 \[Beta] A[3] B[1] B[2] +
3/2 \[Beta] A[0] B[2]^2 + 3/2 \[Beta] A[2] B[1] B[3] +
3/2 \[Beta] A[1] B[2] B[3] + 3/2 \[Beta] A[0] B[3]^2 ==
0, -F - \[Omega]^2 A[1] + \[Omega]0^2 A[1] +
3 \[Beta] A[0]^2 A[1] + 3/4 \[Beta] A[1]^3 +
3 \[Beta] A[0] A[1] A[2] + 3/2 \[Beta] A[1] A[2]^2 +
3/4 \[Beta] A[1]^2 A[3] + 3 \[Beta] A[0] A[2] A[3] +
3/4 \[Beta] A[2]^2 A[3] + 3/2 \[Beta] A[1] A[3]^2 +
2 \[Zeta] \[Omega] \[Omega]0 B[1] + 3/4 \[Beta] A[1] B[1]^2 -
3/4 \[Beta] A[3] B[1]^2 + 3 \[Beta] A[0] B[1] B[2] +
3/2 \[Beta] A[1] B[2]^2 - 3/4 \[Beta] A[3] B[2]^2 +
3/2 \[Beta] A[1] B[1] B[3] + 3 \[Beta] A[0] B[2] B[3] +
3/2 \[Beta] A[2] B[2] B[3] + 3/2 \[Beta] A[1] B[3]^2 ==
0, -2 \[Zeta] \[Omega] \[Omega]0 A[1] - \[Omega]^2 B[
1] + \[Omega]0^2 B[1] + 3 \[Beta] A[0]^2 B[1] +
3/4 \[Beta] A[1]^2 B[1] - 3 \[Beta] A[0] A[2] B[1] +
3/2 \[Beta] A[2]^2 B[1] - 3/2 \[Beta] A[1] A[3] B[1] +
3/2 \[Beta] A[3]^2 B[1] + 3/4 \[Beta] B[1]^3 +
3 \[Beta] A[0] A[1] B[2] - 3 \[Beta] A[0] A[3] B[2] +
3/2 \[Beta] A[2] A[3] B[2] + 3/2 \[Beta] B[1] B[2]^2 +
3/4 \[Beta] A[1]^2 B[3] + 3 \[Beta] A[0] A[2] B[3] -
3/4 \[Beta] A[2]^2 B[3] - 3/4 \[Beta] B[1]^2 B[3] +
3/4 \[Beta] B[2]^2 B[3] + 3/2 \[Beta] B[1] B[3]^2 == 0,
3/2 \[Beta] A[0] A[1]^2 - 4 \[Omega]^2 A[2] + \[Omega]0^2 A[2] +
3 \[Beta] A[0]^2 A[2] + 3/2 \[Beta] A[1]^2 A[2] +
3/4 \[Beta] A[2]^3 + 3 \[Beta] A[0] A[1] A[3] +
3/2 \[Beta] A[1] A[2] A[3] + 3/2 \[Beta] A[2] A[3]^2 -
3/2 \[Beta] A[0] B[1]^2 + 3/2 \[Beta] A[2] B[1]^2 +
4 \[Zeta] \[Omega] \[Omega]0 B[2] + 3/2 \[Beta] A[3] B[1] B[2] +
3/4 \[Beta] A[2] B[2]^2 + 3 \[Beta] A[0] B[1] B[3] -
3/2 \[Beta] A[2] B[1] B[3] + 3/2 \[Beta] A[1] B[2] B[3] +
3/2 \[Beta] A[2] B[3]^2 ==
0, -4 \[Zeta] \[Omega] \[Omega]0 A[2] +
3 \[Beta] A[0] A[1] B[1] - 3 \[Beta] A[0] A[3] B[1] +
3/2 \[Beta] A[2] A[3] B[1] -
4 \[Omega]^2 B[2] + \[Omega]0^2 B[2] + 3 \[Beta] A[0]^2 B[2] +
3/2 \[Beta] A[1]^2 B[2] + 3/4 \[Beta] A[2]^2 B[2] -
3/2 \[Beta] A[1] A[3] B[2] + 3/2 \[Beta] A[3]^2 B[2] +
3/2 \[Beta] B[1]^2 B[2] + 3/4 \[Beta] B[2]^3 +
3 \[Beta] A[0] A[1] B[3] + 3/2 \[Beta] A[1] A[2] B[3] +
3/2 \[Beta] B[1] B[2] B[3] + 3/2 \[Beta] B[2] B[3]^2 == 0,
1/4 \[Beta] A[1]^3 + 3 \[Beta] A[0] A[1] A[2] +
3/4 \[Beta] A[1] A[2]^2 - 9 \[Omega]^2 A[3] + \[Omega]0^2 A[3] +
3 \[Beta] A[0]^2 A[3] + 3/2 \[Beta] A[1]^2 A[3] +
3/2 \[Beta] A[2]^2 A[3] + 3/4 \[Beta] A[3]^3 -
3/4 \[Beta] A[1] B[1]^2 + 3/2 \[Beta] A[3] B[1]^2 -
3 \[Beta] A[0] B[1] B[2] + 3/2 \[Beta] A[2] B[1] B[2] -
3/4 \[Beta] A[1] B[2]^2 + 3/2 \[Beta] A[3] B[2]^2 +
6 \[Zeta] \[Omega] \[Omega]0 B[3] + 3/4 \[Beta] A[3] B[3]^2 ==
0, -6 \[Zeta] \[Omega] \[Omega]0 A[3] + 3/4 \[Beta] A[1]^2 B[1] +
3 \[Beta] A[0] A[2] B[1] - 3/4 \[Beta] A[2]^2 B[1] -
1/4 \[Beta] B[1]^3 + 3 \[Beta] A[0] A[1] B[2] +
3/2 \[Beta] A[1] A[2] B[2] + 3/4 \[Beta] B[1] B[2]^2 -
9 \[Omega]^2 B[3] + \[Omega]0^2 B[3] + 3 \[Beta] A[0]^2 B[3] +
3/2 \[Beta] A[1]^2 B[3] + 3/2 \[Beta] A[2]^2 B[3] +
3/4 \[Beta] A[3]^2 B[3] + 3/2 \[Beta] B[1]^2 B[3] +
3/2 \[Beta] B[2]^2 B[3] + 3/4 \[Beta] B[3]^3 == 0};
If I put in some numerical values for the coefficients and solve I get 483 solutions.
eqns1 = eqns /. {\[Omega]0 -> 2 \[Pi] 10, \[Zeta] -> 1/100, \[Beta] ->
5000, F -> 100., \[Omega] -> 2 \[Pi] 12.};
Timing[sol = NSolve[eqns1, uk, Reals];]
(* {0.171875, Null} *)
The first 49 solutions are identical except for numerical error.
Table[sol[[n]][[All, 2]] - sol[[1]][[All, 2]], {n, 49}] // Chop
(* {{0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0}} *)
Other groups of solutions are also similarly identical. If I put in alternative values for the coefficients e.g. \[Omega] -> 2 \[Pi] 14.
I get a different number of solutions. I need to calculate solutions for a range of values of Omega.
DeleteDuplicates
does not work but anyway I would like to make NSolve
work without producing duplicates. Any ideas?
NDSolve
more thanNSolve
. Thanks corrected. $\endgroup$WorkingPrecision
results in "Subsystem could not be solved". Also, takes a long time to reach that conclusion. $\endgroup$FindRoot
? $\endgroup$FindRoot
. It needs starting values so I used random ones and then I get a failure due to lack ofMachinePrecision
. $\endgroup$