I have 2 smooth functions f1 and f2. I want to solve the system of equations:f1(x1,x2) = 0f2(x1,x2) = 0I have a rough idea for the value of x1. The functions are undefined when x1 or x2 < 0. The value of x2 is known to be close to 0.I need to solve 1200 versions of this problem (for variations in f1 and f2 -- i'm not looking for 1200 roots of the same problem). For each of those problems I need to find 100 roots.What's the best way to go about this? I tried using the Newton-Raphson method but most of the time one of 2 thinig happens: 1) divergence, 2) the estimate of x2 goes negative. Since my initial guesses are known to be close to the root I'm finding, it does converge sometimes (about 1/3 of the time).What are some other numerical methods for solving this kind of problem (links would help)?
4/8/2006 11:24:38 PM
http://www4.ncsu.edu/~doster/NE400/Computing/Brent.pdfPretty much the same thing as newton[Edited on April 8, 2006 at 11:29 PM. Reason : I'm assuming you've used that before]
4/8/2006 11:28:08 PM
MATLABopen the help window and type 'fsolve'and if the loop is going to slow you can compile it.[Edited on April 8, 2006 at 11:34 PM. Reason : fsolve][Edited on April 8, 2006 at 11:36 PM. Reason : compile]
4/8/2006 11:32:51 PM
^^aahhahahahhaahahahaaahahhaah funny kevin. thanks for the laugh, but i'm solving a nonlinear system of equations (multiple degrees of freedom). that's for a single equation.^MATLAB and Maple have crossed my mind, but I don't know how to code each of them. Also, the program I'm writing is several hundred lines long and if I wanted to swith to Maple or MATLAB I'd have to recode the whole thing...[Edited on April 8, 2006 at 11:46 PM. Reason : ]
4/8/2006 11:44:21 PM
You can call matlab from c/c++ code (might be as simple as adding a library-depending on the function)by the way Matlab >>> Maple for numerical problemsIf you need a robust nonlinear equation solver it would take a while to code that yourself. Probably be very much quicker to learn how to call Matlab or just recode in matlab.matlab code is easy to pick up quickly.Here goes some links for ya.http://www.mathworks.com/support/tech-notes/1600/1622.htmlhttp://www.mathworks.com/access/helpdesk/help/toolbox/optim/The second one is to the documentation for the Optimization toolbox, that's where the function 'fsolve' is located. Click on "Alphabetical List" of the functions and search for it.[Edited on April 8, 2006 at 11:48 PM. Reason : .][Edited on April 9, 2006 at 12:00 AM. Reason : .]
4/8/2006 11:47:17 PM
yea dude, i say go with matlab over maple also
4/9/2006 3:46:57 AM
Wait, I just remembered, if you are coding in c++ just use the gsl library. Here is the specific library you want to use.http://www.gnu.org/software/gsl/manual/gsl-ref_34.html#SEC457and a link to the main pagehttp://www.gnu.org/software/gsl/If you are coding in FORTRAN look for the MINPACK Library http://www.utoronto.ca/cat/services/services_other/fortranB.htmlMatlab still might be better though--you can set options on the type of solver etc... I would just recode in matlab or learn to call matlab/add matlab library if the gsl library is not an option(e.g. doesn't work for you or you're limited to visual studio etc...)If you have any specific matlab questions I can try to help.[Edited on April 9, 2006 at 1:24 PM. Reason : MINPACK]
4/9/2006 1:20:43 PM
It's in Visual Basic. The gsl library says it uses Newtonian iterations, which is what I'm doing (though I'm sure their methods are better than I am because I don't understand any of the methods to increase the radius of convergence).I'll look into MATLAB I guess.
4/9/2006 2:27:36 PM