Re: Solve / NSolve take too much time or fail
- To: mathgroup at smc.vnet.net
- Subject: [mg60875] Re: [mg60847] Solve / NSolve take too much time or fail
- From: Daniel Lichtblau <danl at wolfram.com>
- Date: Sat, 1 Oct 2005 02:55:50 -0400 (EDT)
- References: <200509300757.DAA22162@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
grimey wrote: > Hello, > I'm working with Mathematica (version 5.0) for perhaps 3 month. > And now I have a problem, I try to solve an equation like this: > > cf=(a1*x (a2 + a3*x + a^2))/(b1 + b2*x - b3*x^2 + b4*x^3); > > w=(1-c1*Sqrt[1-(1-c1^2)*x/c2])^2 / (1-c1)^2; > > This is the main equation: > > Solve[Numerator[cf]-I d1 w Denominator[cf]==0,x] > > And even after hours of working I don't get any solution, whether I > take Solve or NSolve. And I gave a lot of virtual memory free for > Mathematica to work with. > > Are there any tricks to help solving difficult polynomial equations > faster (or at all)? I want to get, of course, a set of Root-functions > for x (complex), depending on a1, a2, a3, b1, b2, b3, b4, c1, c2, d1, > so I have no numerical number to start with for the FindRoot-function. > Can anyone help me? Some other equations, not always that different > from this one, could be solved more easily... > > Thank you very much! > > Thomas Geyer > (tfgeyer at yahoo.com) Here is a possibility. First clear denominators. cf = (a1*x*(a2 + a3*x + a^2))/(b1 + b2*x - b3*x^2 + b4*x^3); w = (1-c1*Sqrt[1-(1-c1^2)*x/c2])^2 / (1-c1)^2; expr = Numerator[Together[Numerator[cf]-I*d1*w*Denominator[cf]]] Now find a Groebner basis, regarding these as polynomials/algebraics in x. In[58]:= Timing[gb = GroebnerBasis[expr,x,CoefficientDomain->RationalFunctions];] Out[58]= {6.34 Second, Null} There are two elements. The first is polynomial and the second contains the radicals. Use the first to solve for x. In[59]:= Timing[soln = Solve[First[gb]==0, x];] Out[59]= {2.11 Second, Null} In[60]:= Length[soln] Out[60]= 8 In[61]:= LeafCount[soln] Out[61]= 19473 Note that for given values of the parameters some solutions may be parasites in the sense that they will not satisfy the relation in the second element of the Groebner basis. For example, we see below that one set of parameter values makes the third solution a parasite while another makes it valid. In[86]:= InputForm[N[gb[[2]] /. soln[[3]] /. Thread[vars -> Table[Random[Integer,{-100,100}],{Length[vars]}]],25]] Out[86]//InputForm= -3.43753357569104440559041428314879061`25*^17 - 2.671990829161618745064960560085962853`25*^17*I In[87]:= InputForm[N[gb[[2]] /. soln[[3]] /. Thread[vars -> Table[Random[Integer,{-100,100}],{Length[vars]}]],25]] $MaxExtraPrecision::meprec: In increasing internal precision while attempting to evaluate 2772262776875200000 + 1961701595778955520 I + <<8>> , the limit $MaxExtraPrecision = 50. was reached. Increasing the value of $MaxExtraPrecision may help resolve the uncertainty. Out[87]//InputForm= 3.4298513`-8.5605*^-65 + 9.03206`-10.1718*^-67*I Daniel Lichtblau Wolfram Research