Re: Numerical solution of quadratic equations set.
- To: mathgroup at smc.vnet.net
- Subject: [mg58242] Re: [mg58229] Numerical solution of quadratic equations set.
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Fri, 24 Jun 2005 02:50:02 -0400 (EDT)
- References: <200506230934.FAA16416@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Stepan Yakovenko wrote: > Dear MathGroup experts! > > I've got a system of quadratic equations with many (57) > variables. Number of equations is less (38), so there may > be an infinite set of solutions. Also I've got an > aproximate solution that gives a good discrepancy. I want > Mathematica to find some solution or/and improve the > existing one. I'm interested in real (not complex) > solutions. > > Here's what I've tried with no result: > > NSolve[eq == 0, var] - gives no solutions. > FindInstance[eq==0,var,Reals] - gives no solutions. > FindRoot[] says that there's not enough equations (yes, > there isn't, but I'm interested only in one solution). > > I guess there are some options, I've no idea of, that make > these functions work fine. Or may be I'm doing something > wrong? > > I'd be very thankful if you spend some minutes on my > problem if you've got experience in using Mathematica > built-in solvers. > > And, of course the equations and the approximate solution > (just CopyPaste them). > > eq/.sol says that the solution is good. > > eq={x1^2+x2^2+x3^2-1,x4^2+x5^2+x6^2-1,x7^2+x8^2+x9^2-1,x1*x4+x2*x5+x3*x6, > x1*x7+x2*x8+x3*x9, > x4*x7+x5*x8+ > x6*x9,(1*x1^1*x5^1*x9^1)+(1*x2^1*x6^1*x7^1)+(1*x3^1*x4^1*x8^1)-(1* > x3^1*x5^1*x7^1)-(1*x2^1*x4^1*x9^1)-(1*x1^1*x6^1* > x8^1)-(1),-174.0768153453*x1+77.1294448808052*x2-197.092581590381* > x3+x10-x37,-174.0768153453*x4+77.1294448808052*x5-197.092581590381* > x6+x11-x38,-174.0768153453*x7+77.1294448808052*x8-197.092581590381* > x9+x12-x39,-0.777572718750928*x2+0.628793024018468*x3- > x40,-0.777572718750928*x5+0.628793024018468*x6- > x41,-0.777572718750928*x8+0.628793024018468*x9-x42, > 185.9231846547*x1+77.1294448808052*x2-197.092581590381*x3+x10-x43, > 185.9231846547*x4+77.1294448808052*x5-197.092581590381*x6+x11-x44, > 185.9231846547*x7+77.1294448808052*x8-197.092581590381*x9+x12-x45,-x1- > x46,-x4-x47,-x7-x48,-x49+x37+x55*x40,-x50+x38+x55*x41,-x51+x39+ > x55*x42,-x52-28.6516272343591+0.0316394681497087* > x56,-x53-270.675972456571+0.99269490646048* > x56,-x54+47.0508868216556+0.116429234913844*x56, > x49*x40-x52*x40+x50*x41-x53*x41+x51*x42-x54*x42, > 0.0316394681497087*x49-0.0316394681497087*x52+0.99269490646048* > x50-0.99269490646048*x53+0.116429234913844*x51-0.116429234913844* > x54,100*x49^2-200*x49*x52+100*x52^2+100*x50^2-200*x50*x53+100* > x53^2+100*x51^2-200*x51*x54+100* > x54^2,-x43-18.5269974264523+0.927403345664447* > x57,-x44+46.9863976107822-0.0725966543355525* > x57,-x45+84.3082419940857+0.366950623694352*x57, > x46+0.927403345664447,x47-0.0725966543355525,x48+0.366950623694352, > x25+0.0318722982698898*x26+20.0245619057308, > x27+0.117286020262742*x26-78.7973944118342, > x32-0.0782794828969912*x31-45.5361138326056, > x33+0.395675328765874*x31-91.6389177918417}; > > sol={x1 -> 0.927403345664447`, x2 -> 0.0725966543355521`, > x3 -> -0.36695062369435`, x4 -> -0.0725966543355525`, > x5 -> 0.997265609073176`, x6 -> 0.0138213870212883`, > x7 -> 0.366950623694352`, x8 -> 0.0138213870212883`, > x9 -> \ > 0.930137736591272`, x10 -> 64.98983200206`, x11 -> > -39.8454462776897`, x12 -> \ > 330.443047358837`, x13 -> 1, x14 -> 0, x15 -> 0, x16 -> 0, > x17 -> 1, x18 -> > 0, x19 -> 0, x20 -> 0, x21 -> 1, x22 -> 0, x23 -> 0, > x24 -> 0, x25 -> -11.3974965771025`, x26 -> > -270.675972456571`, > x27 -> 110.543902002013`, x28 -> 0.0316394681497087`, > x29 -> \ > 0.99269490646048`, x30 -> 0.116429234913844`, x31 -> > -18.5269974264523`, x32 \ > -> 44.085830054429`, x33 -> 98.9695935895978`, x34 -> > 0.927403345664447`, > x35 -> -0.0725966543355525`, x36 -> > 0.366950623694352`, x37 -> \ > -18.5270035625587`, x38 -> > 46.9863980911134`, x39 -> 84.3082395661798`, x40 -> > -0.28718517022215`, > x41 -> -0.766755739222584`, x42 -> > 0.574116986661867`, x43 -> > 315.338200876642`, x44 -> 20.8516025303145`, x45 -> > 216.410464096147`, x46 \ > -> -0.927403345664447`, x47 -> 0.0725966543355525`, x48 -> > \ > -0.366950623694352`, x49 -> -18.5270035625586`, x50 -> > 46.9863980911134`, x51 \ > -> 84.3082395661798`, x52 -> -18.5269974264523`, x53 -> > 46.9863976107822`, x54 -> 84.3082419940857`, x55 -> > 3.3546139097961`*^-14, x56 -> 320, x57 -> > 359.999993383562`}; > > var = Table[ToExpression["x" <> ToString[i]], {i, 1, 57}]; > > > ----------------------------------------------------------- > http://auto.ngs.ru - × ÐÒÏÄÁÖÅ ÂÏÌÅÅ 1200 Á×ÔÏ Generally speaking one might do this with FindMinimum. Use the sum of squares to minimize. Take as start value the solution you already have. eqsq = eq.eq {min,vals} = FindMinimum[eqsq, Evaluate[Apply[Sequence, Transpose[{var,var/.sol}]]], WorkingPrecision->100, PrecisionGoal->100, AccuracyGoal->100] But this will not do much good in your case, because the original system has coefficients that are only specified to machine precision. Hence you cannot hope to get a solution with very small residual. Had you, say, exact coefficients, then the method indicated above is a viable way to do what is called "root polishing". Daniel Lichtblau Wolfram Research
- References:
- Numerical solution of quadratic equations set.
- From: "Stepan Yakovenko" <yakovenko-mg@ngs.ru>
- Numerical solution of quadratic equations set.