From: Christian Schneider on 1 Apr 2010 07:02 Dear members of the mathgroup email group, I have serious difficulties in solving the following problem in Mathematica v.7 and would very grateful if anyone could give me a helping hand with that. I want to solve a system of two nonlinear equations. Unfortunately the equations are rather bulky. I've tried to use FindRoot for this problem, but I get three error messages: General::ovfl : Overflow occurred in computation General::ovfl : Overflow occurred in computation FindRoot::nlnum : The function value {Overflow[], Overflow[]} is not a list of numbers with dimensions {2} at {sigmabare, dmu}={0.2, 4}. I think mathematica is telling me that the iterations or the starting points need to be changed. I tried to do that, but always end up with that error messages. I have a set of two equations with two variables and two parameters each, and I want to solve the two variables of the set. The variables of the two equations are: sigmabare, dmu The two parameters per equation are for equation1: epsilon1, c01 for equation2: epsilon2, c02 The complete syntax as plain text is: FindRoot[{c01*6.022*10^(23) == Abs[sigmabare/(2*(437*10^(-12))*3*(1.602*10^(-19)))]* Exp[(-(4.11641*10^(-21))*(1.65*(1/(4*(4.11641*10^(-21))* epsilon1*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^\ 3*sigmabare/3.141592654)^(1/2)) - 2.61*(1/(4*(4.11641*10^(-21))* epsilon1*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^\ 3*sigmabare/3.141592654)^(1/2))^(1/4) + 0.26*Log[ 1/(4*(4.11641*10^(-21))* epsilon1*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^\ 3*sigmabare/3.141592654)^(1/2)] + 1.95))/((4.11641*10^(-21)))]* Exp[dmu/((4.11641*10^(-21)))]/(6.022*10^(23)) /. c01 -> {0.5*10^(-5)} /. epsilon1 -> {54} , c02*6.022*10^(23) == Abs[sigmabare/(2*(437*10^(-12))*3*(1.602*10^(-19)))]* Exp[(-(4.11641*10^(-21))*(1.65*(1/(4*(4.11641*10^(-21))* epsilon2*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^3* sigmabare/3.141592654)^(1/2)) - 2.61*(1/(4*(4.11641*10^(-21))* epsilon2*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^3* sigmabare/3.141592654)^(1/2))^(1/4) + 0.26*Log[ 1/(4*(4.11641*10^(-21))* epsilon2*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^3* sigmabare/3.141592654)^(1/2)] + 1.95))/((4.11641*10^(-21)))]* Exp[dmu/((4.11641*10^(-21)))]/(6.022*10^(23))} /. c02 -> {1*10^(-5)} /. epsilon2 -> {78}, {{sigmabare, 0.2}, {dmu, 4}}] Sorry for this mess of equations. Has somebody an idea where I am going wrong and how to solve this? Thanks a lot in advance for your help, Chris
From: Alois Steindl on 2 Apr 2010 06:19 Christian Schneider schrieb: > Dear members of the mathgroup email group, > > I have serious difficulties in solving the following problem in Mathematica > v.7 and would very grateful if anyone could give me a helping hand with > that. > > I want to solve a system of two nonlinear equations. Unfortunately the > equations are rather bulky. I've tried to use FindRoot for this problem, but > I get three error messages: > > General::ovfl : Overflow occurred in computation > > General::ovfl : Overflow occurred in computation > > FindRoot::nlnum : The function value {Overflow[], Overflow[]} is not a list > of numbers with dimensions {2} at {sigmabare, dmu}={0.2, 4}. > > I think mathematica is telling me that the iterations or the starting points > need to be changed. I tried to do that, but always end up with that error > messages. > > I have a set of two equations with two variables and two parameters each, > and I want to solve the two variables of the set. > > The variables of the two equations are: sigmabare, dmu > > The two parameters per equation are > > for equation1: epsilon1, c01 > > for equation2: epsilon2, c02 > > > > The complete syntax as plain text is: > > > > FindRoot[{c01*6.022*10^(23) == > > Abs[sigmabare/(2*(437*10^(-12))*3*(1.602*10^(-19)))]* > > Exp[(-(4.11641*10^(-21))*(1.65*(1/(4*(4.11641*10^(-21))* > > epsilon1*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^\ > > 3*sigmabare/3.141592654)^(1/2)) - > > 2.61*(1/(4*(4.11641*10^(-21))* > > epsilon1*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^\ > > 3*sigmabare/3.141592654)^(1/2))^(1/4) + > > 0.26*Log[ > > 1/(4*(4.11641*10^(-21))* > > epsilon1*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^\ > > 3*sigmabare/3.141592654)^(1/2)] + 1.95))/((4.11641*10^(-21)))]* > > Exp[dmu/((4.11641*10^(-21)))]/(6.022*10^(23)) /. > > c01 -> {0.5*10^(-5)} /. epsilon1 -> {54} , > > c02*6.022*10^(23) == > > Abs[sigmabare/(2*(437*10^(-12))*3*(1.602*10^(-19)))]* > > Exp[(-(4.11641*10^(-21))*(1.65*(1/(4*(4.11641*10^(-21))* > > epsilon2*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^3* > > sigmabare/3.141592654)^(1/2)) - > > 2.61*(1/(4*(4.11641*10^(-21))* > > epsilon2*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^3* > > sigmabare/3.141592654)^(1/2))^(1/4) + 0.26*Log[ > > 1/(4*(4.11641*10^(-21))* > > epsilon2*(8.854*10^(-12)))*((1.602*10^(-19))^3*3^3* > > sigmabare/3.141592654)^(1/2)] + > > 1.95))/((4.11641*10^(-21)))]* > > Exp[dmu/((4.11641*10^(-21)))]/(6.022*10^(23))} /. > > c02 -> {1*10^(-5)} /. > > epsilon2 -> {78}, {{sigmabare, 0.2}, {dmu, 4}}] > > > > Sorry for this mess of equations. > > > > Has somebody an idea where I am going wrong and how to solve this? > > > > Thanks a lot in advance for your help, > > > > Chris > Hello, this looks really like a mess of equations! I do not want to play around with your equations, instead I want to give you some general advices: First you use several constants (like some numeric appoximation of pi and Avogadro's constant) throughout your equations without assigning them to symbols. Second you use very large and small quantities simultaneously. You surely are aware of the limits of floating point calculations? I would advice to rescale your system before trying to solve it. You should use non-dimensional quantities and scale the system, such that all expressions in the equations are of order 1; also the expected solution should be of that order. Alois
From: Peter Pein on 2 Apr 2010 06:21 On 01.04.2010 13:02, Christian Schneider wrote: > Dear members of the mathgroup email group, > > I have serious difficulties in solving the following problem in Mathematica > v.7 and would very grateful if anyone could give me a helping hand with > that. > > I want to solve a system of two nonlinear equations. Unfortunately the > equations are rather bulky. I've tried to use FindRoot for this problem, but > I get three error messages: > > General::ovfl : Overflow occurred in computation > > General::ovfl : Overflow occurred in computation > > FindRoot::nlnum : The function value {Overflow[], Overflow[]} is not a list > of numbers with dimensions {2} at {sigmabare, dmu}={0.2, 4}. .... > Has somebody an idea where I am going wrong and how to solve this? > > > > Thanks a lot in advance for your help, > > > > Chris > Hi Chris, just a remark: use "equation"/.{c01->.5/10^5,epsilon->54}, because this gives an equation, while equation/.c01->{.5/10^5}/.epsilon->{54} leaves you with a list of a list of an eqn: a==b+c/.b->{1}/.c->{Pi} a=={{1+Pi}} I replaced 3.141592654 with Pi and put the equations into a variable named eqns. Then I mapped a Log onto both sides of both equations, replaced a==b by a-b and did a FullSimplify on the result: eqns=FullSimplify[Subtract@@@Map[Log,eqns,{2}]//PowerExpand] this led to {37.0414516164153 - 2.429301260078564*^20*dmu - 5.769493817846427*sigmabare^(1/8) + 39.39787193680568*Sqrt[sigmabare] + 0.13000000000000003*Log[sigmabare] - 1.*Log[Abs[sigmabare]], 37.63899035414267 - 2.429301260078564*^20*dmu - 5.262747112219505*sigmabare^(1/8) + 27.275449802403934*Sqrt[sigmabare] + 0.13000000000000003*Log[sigmabare] - 1.*Log[Abs[sigmabare]]} for which FindRoot gives In[2]:= FindRoot[eqns,{{sigmabare,.2},{dmu,4}}] Out[2]= {sigmabare->0.00502108,dmu->1.70676*10^-19} hth, Peter
|
Pages: 1 Prev: Export a vector Next: NDSolve with rapidly time varying boundary condition |