
[Sponsors] 
February 4, 2009, 09:26 
Could someone suggest simple (nonlinear) solver

#1 
Guest
Posts: n/a

Hi Guys, I'm trying to solve a single equation (of one variable) which is nonlinear. It's quite a nasty equation containing a log(x) and an exp(1/x) term as well as some polynomial terms.
Could someone please suggest a numerical scheme I could use to solve such an equation? I want something that will calculate the answer very quickly. Basically I'm trying to avoid an iterative procedure and have managed to write all my equations in terms of one unknown  this final equation is nonlinear and once I've solved it I can solve all the others. If the solution of the nonlinear eqn takes longer than the iterative procedure then the whole thing will be rather pointless. I'd be very grateful for any help you guys could provide. Bren 

February 4, 2009, 13:01 
Re: Could someone suggest simple (nonlinear) solve

#2 
Guest
Posts: n/a

As far as I am aware, there is no general "noniterative" solver for nonlinear equations. You may be able to find a solution technique for a particular equation, but that's what makes nonlinear equations so tough  there are no general methods for coming up with exact solutions. Unless the equation presents itself in a form that allows an exact solution I don't think you'll find a noniterative numerical technique. The only idea that comes to mind right off the bat is to see if you can implement a variable transformation that would result in an equation form that can be readily solved in an exact sense, i.e. one that would turn the existing equation into a simple polynomial form for which the roots are known.
A NewtonRaphson iterative solver is not particularly slow, unless you have an equation with a set of badly placed roots or you have no idea what to use as a starting guess. 

February 4, 2009, 14:51 
Re: Could someone suggest simple (nonlinear) solve

#3 
Guest
Posts: n/a

Bren, I'd like to point out that division, roots, and all the transcendental functions are implemented using iterative methods (the first two usually use Newton's method). Ignoring these iterations, it is not possible to find the roots of a general fifth (or higher) degree polynomial without iteration. In practice, the polynomial rootfinding problem is often transformed into an eigenvalue problem, but this does not work for nonpolynomial functions. Due to this duality, there is no noniterative eigenvalue procedure.
Also, it's not necessarily beneficial to eliminate as many variables as possible. That is, it's possible that the behavior of the function becomes more nasty as you eliminate variables. If you want to speed up your solver, the initial guess is where you can gain the most time. Depending on the number of independent parameters, you might benefit from a small lookup table. Or perhaps there is a heuristic to get close, or the root of the last set of equations is close because of spatial correlation. 

February 4, 2009, 16:38 
Re: Could someone suggest simple (nonlinear) solve

#4 
Guest
Posts: n/a

Bren, I have used maxima (an open source programme that is available on most linux distributions) to solve such equations, try it


February 4, 2009, 22:36 
Re: Could someone suggest simple (nonlinear) solve

#5 
Guest
Posts: n/a

many people have already commented that it might not be possible to find direct solution to your problem.
If i were you I would be trying to look of a equation whose direct solution is available and solution closely resembles the equation you have in your hand. I would use this initial guess with iterative procedure and quickly come out of it. Anyway this is only a suggestion actual implementation may even not be possible though. So consider this just as a suggestion. My 2 cents (in this recession). 

February 5, 2009, 05:24 
Many thanks

#6 
Guest
Posts: n/a

Thank you very much everyone  your responses have been very helpful.
I think I will give the NewtonRaphson method a whirl as I've had some luck with it in the past. I have to be able to code up the method myself (using fortran) so, unfortunately, using commercially available software isn't an option. Many thanks, Bren 

February 5, 2009, 14:31 
Re: Many thanks

#7 
Guest
Posts: n/a

Bren,
You don't necessarily have to start from scratch with your code! There are plenty of sources of free public domain code numerical routines around (www.netlib.org takes a bit of getting used to but has good Fortran / C codes, most (but not all) of which are public domain). A web search will find many other sources (of mixed quality of course, like anything on the internet, so be careful and test, test, test....). Certainly look at the advice in the "Numerical Recipes" books too (in most libraries have copies or free access to the older editions is available on line at http://www.nr.com/oldverswitcher.html ). They should be a good starting point.... What language will you be using? If you're lucky someone might know of a code in your language! Regards, Andy2o 

February 5, 2009, 22:23 
Re: Could someone suggest simple (nonlinear) solve

#8 
Guest
Posts: n/a

It's dead easy. Write an Excel spreadsheet, & iterate into solution.
Be careful to approach the solution carefully by hand until the changes slow, then turn on automatic iteration. Have fun. mw... Momentum waves <www.adthermtech.com/wordpress3> 

February 6, 2009, 22:02 
Re: due correction

#9 
Guest
Posts: n/a

Bren On planet Earth, poeple know that the Linux OS and all the projects related to it are free open source codes including maxima (wxmaxima with the gui), you have your reasons to start from scratch, I do not enter here, but please do not tell us that "maxima" is a commercial code, there is even a windows installer. Good Luck to all living on Orion


February 8, 2009, 18:36 
Re: due correction

#10 
Guest
Posts: n/a

I didn't mean to suggest that maxima was a commercial code Ahmed. I appologise for not being clear enough  I need to adapt an existing fortran code to include a nonlinear solver. That is why I need to code the method myself rather than rely on software produced by someone else, whether it be commercial or open source. I thought that my position was clear in my post: "able to code up the method myself" was a strong hint.
Here on Orion it's considered good manners to respond to a polite statement (such as my "Many Thanks" post) with a polite response, being a sarcastic tool is actually considered quite rude here! You should visit some time  though I would advise that you adopt a less hostile attitude. Bren 

March 7, 2009, 07:36 
Re: Could someone suggest simple (nonlinear) solve

#11 
Guest
Posts: n/a

try matlab or maple


Thread Tools  
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Creating New Solver: For particleladen compressible jets  sankarv  OpenFOAM Running, Solving & CFD  17  December 3, 2014 20:41 
OpenCL linear solver for OpenFoam 1.7 (alpha) will come out very soon  qinmaple  OpenFOAM Announcements from Other Sources  4  August 10, 2012 11:00 
SIMPLE on unsteady solver?  impecca  OpenFOAM Running, Solving & CFD  2  May 5, 2010 12:28 
Is there any nonlinear solver package at Windows?  leaf  Main CFD Forum  0  July 10, 2006 23:45 
public domain f77 separable nonlinear least squares solver wanted  Sergei Chernyshenko  Main CFD Forum  10  January 28, 2000 14:56 