# Systems of equations

As I stated in this question I am trying to find the roots of a set of equations. I followed the instructions that the answer gave me and Mathematica gave me the solutions.

1- However whenever I try to calculate it gives me this error: NMaximize::nosat: Obtained solution does not satisfy the following constraints within Tolerance -> 0.001... Thus, I am wondering that may there be a chance this error is making the solutions wrong.

2-Moreover, what would be the input if I tried to calculate the roots for the maximum value of absolute value of q?

• I suggest that you put these your questions as comments or edits to your original question, where they actually belong. – Alexei Boulbitch Nov 26 '14 at 15:44
• @AlexeiBoulbitch I did that but I got a suggestion which says that I should post a new question. – Starior Nov 26 '14 at 16:34

I did the following. Subtract one side from the other to get expressions from equations, square each and sum. I want to use that sum of squares as my constraint equation.

--- edit ---

The somewhat lengthy equations may be found here. There also were variants here and here, but I used that first (I believe I did not get very good results with the others).

Anyway, to start out, define eqns = ... where ... denotes the list of equations (they were not in an explicit Mathematica List so one musty edit anyway). The rest proceeds as below.

--- end edit ---

polys = Apply[Subtract, eqns, 1];
sos = polys.polys;
vars = Variables[polys];


Now numerically maximize q. The setting below seem to work well but what I tried was by no means exhaustive. I did not even check whether the post process setting was useful.

{max, vals} =
NMaximize[{q, sos == 0}, vars, MaxIterations -> 2500,
Method -> {"DifferentialEvolution",
"PostProcess" -> "InteriorPoint"}]

(* Out= {249.612839472, {q -> 10.0776784587,
q -> 249.612839472, q -> 1.2374159599*10^-11,
q -> 2.63182261366*10^-11, q -> 3.92474408986*10^-11,
q -> 5.59153450658*10^-11, q -> 3.26994887506*10^-11,
q -> -7.23283009989, q -> -2.33832951438*10^-11,
q -> -4.44339637424*10^-11, q -> -4.86272772623*10^-11,
q -> -5.045240705*10^-11, q -> -4.72526447498*10^-11}} *)


Test quality of result by checking residuals.

polys /. vals

(* Out= {0., 0.0000353733578184, 0.0000211878856078,
-4.78962640216*10^-7, -0.0000328136205994, -0.0000674022441487,
-0.000388164292971, -0.0000813888584545, -0.0000606146825248,
-0.0000387691273644, -0.0000236987141351, -0.0000166052409085} *)


To my surprise, nay, amazement, we have a very good approximate solution. Given the scaling of the inputs I was really not expecting that we could make all of the residuals that small.

Whether this is actually a useful result remains to be seen. The overdetermined system, with it's funny scaling, does not strike me as a great starting point for getting a good outcome in, say, an experimental science scenario.

• Thanks for your answer. I would be pleased if you could post the full code here. Did you subtract every equation from another one manually or did you just write all the equations and pasted the code you gave above? – Starior Nov 27 '14 at 19:05
• I added an edit to show where I obtained them and what I did. I am not going to add the equations to my post for two reasons. One is that they are long and there is really no good reason to repeat them. The other, more important in my view, is that it was really your responsibility to put them into your question, and in a form immediately suitable for use in Mathematica. having to edit to put in curly braces and/or commas was not something I should have had to do. Re: forming polynomials from equations, that is done in the first line of my code. It was not manual. – Daniel Lichtblau Nov 27 '14 at 19:49
• To my defense, I have already added the equations in my linked question so I feel that there is no need to repeat and add them again. I also got a suggestion from the user, belisarius, to rearrange the equations in that form so I rearranged them in that form. I am kinda a newbie to Mathematica so I apologize if I made a mistake. Thanks for your edit and answer again by the way. – Starior Nov 27 '14 at 23:06

looking at the solutions generated from @belisarius solution: https://mathematica.stackexchange.com/a/64155/22547

 Transpose[{ eq[[All, 1]], eq[[All, 2]]} /. sol] // MatrixForm
` the answer to question 1 is yes the solution is very wrong.

(I am puzzled belisarius he evidently didn't see that error, all I did was copy your equations and plug in to his expression )

Do you have some reason to believe a solution exists? I tried some other approaches and came up empty.

• I changed something in input. Can you check again if there is a solution for that? Here is the link: pastebin.com/UVeBn4hw – Starior Nov 26 '14 at 16:39