RE: Re: solving non-algebraic exponential equations
- To: mathgroup at smc.vnet.net
- Subject: [mg38173] RE: [mg38128] Re: [mg38059] solving non-algebraic exponential equations
- From: "David Park" <djmp at earthlink.net>
- Date: Wed, 4 Dec 2002 03:25:11 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
Theodore, For more robust root finding there is a package on MathSource, RootSearch, by Ted Ersek. I claim that there can be no such thing as a perfect root finding package, and for specific applications it may be useful to look for specific transformations that put the problem in a more reasonable form. Nevertheless, Ted's package is extremely good. It will, for example, find all the roots in an interval to a specified precision. One of the problems with the standard FindRoot routine is that you can't specify an interval and say to stay withing the interval. Mathematica just quits when an approximation takes it outside the interval, instead of switching methods. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: Theodore A Sande [mailto:tasande at MIT.EDU] To: mathgroup at smc.vnet.net Dear Miss Hohberger: In reference to your question: "I am trying to solve the following equation for given values of two parameters a and b: NSolve[Exp[-Pi*a/x] + Exp[-Pi*b/x] == 1, x] This is straightforward for integer values of the parameters a and b (e.g. a=1, b=1). However, Mathematica is unable to compute the solution for non-integer values of a and b (e.g. a=1.1, b=1.1; even a=1.0, b=1.0 doesn't work). Instead, the error message "Solve::"tdep": "The equations appear to involve the variables to be solved for in an essentially non-algebraic way." is produced. Can anybody point out a way to overcome this problem and to obtain a solution?" The most expedient method to solve this non-linear algebraic equation for the variable, x, is to treat it as a 1-dimensional non-linear root extraction problem. There are a host of numerical techniques to accomplish this, e.g. the venerable Newton-Raphson technique. Mathematica surely implements a variation of this as follows: In := a = 3.22 b = 0.322 xInitial = 1.3 FindRoot[Exp[-a*Pi/x] + Exp[-b*Pi/x] == 1, {x, xInitial}] Out: {x -> 5.61282} The above values are examples of single precision real numbers. xInitial is the initial guess for the "root", or solution, of the exponentially non-linear algebraic equation. FindRoot successively iterates the wrong initial solution, xInitial, until it converges upon the true solution up to a given number of decimal point. WARNING: ( 1 ) There is probably a way to specify the number of digits, or accuracy, of your solution. ( 2 ) In general, there will be many roots, both real and complex. I am not sure how FindRoot decides which root, if many, it will present to you. Make sure the value returned is physically germane to the problem that yielded the question in the first place. ( 3 ) Try many xInitials over a wide range of real values and see if you converge to a difference root. I hope this helps. Please email me as to your results, as I now may use this in my work, too! Sincerely, Theodore Sande MIT Department of Physics