Re: Problems with FindRoot
- To: mathgroup at smc.vnet.net
- Subject: [mg66269] Re: [mg66235] Problems with FindRoot
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Sat, 6 May 2006 01:54:55 -0400 (EDT)
- Reply-to: hanlonr at cox.net
- Sender: owner-wri-mathgroup at wolfram.com
This is very slow but avoids needing a starting value. V[x_,y_]=123/10/x^3+ 12*Sqrt[2]*Exp[-4*Pi*y]*Pi^2*Sqrt[y]/x- 10*Exp[-2*Pi*y]*Pi*y/x^2; eqns1= Simplify[Numerator[Together[D[V[x,y],#]]]==0]&/@ {x,y}; soln1=Reduce[eqns1,{x,y},Reals]//ToRules//N {x -> 4.455323832084928*^10, y -> 4.17018856320026} g[x_,y_,z_]=123/10/x^3+ 12*Sqrt[2]*Exp[-4*Pi*y]*Pi^2*Sqrt[y]/x- 10*Exp[-2*Pi*y]*Pi*y/x^2+z^2; eqns2= Simplify[Numerator[Together[D[g[x,y,z],#]]]==0]&/@ {x,y,z}; soln2=Reduce[eqns2,{x,y,z},Reals]//ToRules//N {x -> 4.455323832084928*^10, y -> 4.17018856320026, z -> 0.} Bob Hanlon ---- kerim.suruliz at gmail.com wrote: > Hi all, > > I'm trying to find minima of the function > > V[x, y] = 12.3/x^3 + 12*Sqrt[2]*Exp[-4*Pi*y]*Pi^2*Sqrt[y]/x - > 10*Exp[-2*Pi*y]*Pi*y/x^2 > > using FindRoot. The numerical coefficients are such that there is a > minimum for exponentially large x, but Mathematica has trouble finding > it - presumably because the derivatives of V are extremely small in > that region. I tried playing with MaxAccuracy, WorkingPrecision and > PrecisionGoal, but without > any success. Now, I know analytically where the minimum is so I look > for it near there: > > soln = FindRoot[{D[V[x, y], x] == 0, D[V[x, y], y] == 0}, {x, 3*10^10}, > {y, 4.10}, MaxIterations -> 10000] > > and Mathematica finds it, > {{x -> 4.4553238320849495`*^10, y -> 4.170188563200261`}. > Even tiny perturbations about this point result in Mathematica failing > to give the solution, though. Also, I need to solve a more complicated > problem with three variables, > but as soon as I add another one, even trivially, as in > > g[x, y, z] = 12.3/x^3 + 12*Sqrt[2]*Exp[-4*Pi*y]*Pi^2*Sqrt[y]/x - > 10*Exp[-2*Pi*y]*Pi*y/x^2 + z^2 > > (just added z^2 to V[x,y]), minimisation via > > soln = FindRoot[{D[g[x, y, z], x] == 0, D[g[x, y, z], y] == 0, D[g[x, > y, z], z] == 0}, {x, 3*10^10}, {y, 4.10}, {z, 0.4}, MaxIterations -> > 10000] > > fails! The output is: > {x -> 3.`*^10, y -> 4.1`, z -> 0.`} > > Note that the initial condition used for x and y is the same as in the > 2D case. > I'm using Mathematica 5. The function FindMinimum didn't seem to > improve on the situation. > Any advice on how to solve these equations/find minima of > V[x,y]/g[x,y,z] reliably would be much > appreciated. > > Cheers, > > Kerim >