AW: Re: NSolve freezes on two polynomial equations
- To: mathgroup at smc.vnet.net
- Subject: [mg48394] AW: [mg48379] Re: [mg48332] NSolve freezes on two polynomial equations
- From: Matthias.Bode at oppenheim.de
- Date: Fri, 28 May 2004 00:50:21 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Gentlemen: I made my Mathematica Solve the "innocent looking system of 2 quadratic equations". It worked with Mathematica 4.2, Windows XP, Dell Latitude D 600, 512 MB: In[11]:= (ClearAll[x, y]; )* (eqs = {(37.5*(-0.005707305713190276 + 12.52471957392599*I + x)* (4.672373972379857 + 12.52471957392599*I + x))/ ((100. + 939.3539680444492*I)*x + 37.5*x^2 - 487.5* (0.4594268481272286 + 8.967155112255348*I + y)* (1.1815987928984124 + 16.08228403559663*I + y)) == -0.03653043382891893, (-487.5*(-1.0444224854481148 + 12.524719573925989*I + y)* (0.6854481264737559 + 12.524719573925989*I + y))/ ((100. + 939.3539680444492*I)*x + 37.5*x^2 - 487.5* (0.4594268481272286 + 8.967155112255348*I + y)* (1.1815987928984124 + 16.08228403559663*I + y)) == -0.8852848076704578}; )* (sol = Solve[eqs, {x, y}]; Print[sol]; ) From In[11]:= {{x -> -4.756099422616801 - 12.524719573971973*I, y -> 0.24947810152228808 - 12.524719573922921*I}, {x -> -4.647002719987395 - 12.52471957397541*I, y -> -0.8044685244186461 - 12.524719573929334*I}, {x -> 0.0729009975315758 - 12.550214172446713*I, y -> -0.28483107133237673 - 12.771014333465603*I}, {x -> 0.07290099753245932 - 12.49922497531001*I, y -> -0.2848310713460754 - 12.278424814386105*I}} I plugged in the results; equation II: In[13]:= (-487.5*(-1.0444224854481148 + 12.524719573925989*I + y)* (0.6854481264737559 + 12.524719573925989*I + y))/ ((100. + 939.3539680444492*I)*x + 37.5*x^2 - 487.5*(0.4594268481272286 + 8.967155112255348*I + y)* (1.1815987928984124 + 16.08228403559663*I + y)) + 0.8852848076704578 /. {{x -> -4.756099422616801 - 12.524719573971973*I, y -> 0.24947810152228808 - 12.524719573922921*I}, {x -> -4.647002719987395 - 12.52471957397541*I, y -> -0.8044685244186461 - 12.524719573929334*I}, {x -> 0.0729009975315758 - 12.550214172446713*I, y -> -0.28483107133237673 - 12.771014333465603*I}, {x -> 0.07290099753245932 - 12.49922497531001*I, y -> -0.2848310713460754 - 12.278424814386105*I}} Out[13]= {2.7965885163183657*^-10 - 1.80979573072997*^-11*I, -9.459135696943122*^-10 + 6.363585730395986*^-11*I, 3.1304736580750614*^-10 + 9.781465722569389*^-11*I, 2.970678147917738*^-10 - 1.3786237375214977*^-10*I} The result is fine but it took some time: 1470 s. Best regards, Matthias Bode Sal. Oppenheim jr. & Cie. KGaA Untermainanlage 1 D-60329 Frankfurt am Main GERMANY Tel.: +49(0)69 71 34 53 80 Mobile: +49(0)172 6 74 95 77 Fax: +49(0)69 71 34 95 380 E-mail: matthias.bode at oppenheim.de Internet: http://www.oppenheim.de -----Ursprüngliche Nachricht----- Von: Daniel Lichtblau [mailto:danl at wolfram.com] Gesendet: Mittwoch, 26. Mai 2004 08:42 An: mathgroup at smc.vnet.net Betreff: [mg48379] Re: [mg48332] NSolve freezes on two polynomial equations Carlos Felippa wrote: > This innocent looking system of 2 quadratic equations (extracted with > InputForm from the guts of a large code) freezes Mathematica 4.2 on my > Mac. Same if NSolve is replaced by Solve. I wonder why, and how to > fix it. Thanks. > > ClearAll[x,y]; > eqs= > {(37.5*(-0.005707305713190276 + 12.52471957392599*I + > x)*(4.672373972379857 + 12.52471957392599*I + > x))/((100. + 939.3539680444492*I)*x + > 37.5*x^2 - 487.5*(0.4594268481272286 + 8.967155112255348*I + > y)*(1.1815987928984124 + 16.08228403559663*I + > y)) == -0.03653043382891893, > (-487.5*(-1.0444224854481148 + 12.524719573925989*I + > y)*(0.6854481264737559 + 12.524719573925989*I + > y))/((100. + 939.3539680444492*I)*x + > 37.5*x^2 - 487.5*(0.4594268481272286 + 8.967155112255348*I + > y)*(1.1815987928984124 + 16.08228403559663*I + > y)) == -0.8852848076704578}; > sol=NSolve[eqs,{x,y}]; Print[sol]; > I believe this is a bug in NSolve handling of rational functions (I need to look into this further). A work around would be to remove them with Numerator[Together[...]]. exprs = { (37.5*(-0.005707305713190276 + 12.52471957392599*I + x)* (4.672373972379857 + 12.52471957392599*I + x))/ ((100. + 939.3539680444492*I)*x + 37.5*x^2 - 487.5*(0.4594268481272286 + 8.967155112255348*I + y)* (1.1815987928984124 + 16.08228403559663*I + y)) + -0.03653043382891893, (-487.5*(-1.0444224854481148 + 12.524719573925989*I + y)* (0.6854481264737559 + 12.524719573925989*I + y))/ ((100. + 939.3539680444492*I)*x + 37.5*x^2 - 487.5*(0.4594268481272286 + 8.967155112255348*I + y)* (1.1815987928984124 + 16.08228403559663*I + y)) + 0.8852848076704578}; Out[24]//InputForm= {0.04*Second, {{x -> -4.585064233464287 - 12.524719573926033*I, y -> 0.20980857814216422 - 12.524719573926097*I}, {x -> -4.700243789960978 - 12.524719573926033*I, y -> -0.8168089849056585 - 12.524719573925948*I}, {x -> -0.06353162442403039 - 12.49422903643516*I, y -> -0.29523493134015644 - 12.79648760504943*I}, {x -> -0.0635316244240563 - 12.555210111416677*I, y -> -0.29523493134014506 - 12.25295154280242*I}}} Daniel Lichtblau Wolfram Research