Re: Help to remove equivalent (redundant) solutions from FindRoot[]

*To*: mathgroup at smc.vnet.net*Subject*: [mg91502] Re: Help to remove equivalent (redundant) solutions from FindRoot[]*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Sun, 24 Aug 2008 07:06:20 -0400 (EDT)*Organization*: The Open University, Milton Keynes, UK*References*: <g8o84u$l68$1@smc.vnet.net>

Modeler wrote: > Even if I don't get all the zeros, at this stage if would be very useful to know how to remove redundant solutions from the output. In this phase I am playing around to see what kind of problems I encounter. If I use test functions which I know to have a small number of extrema, then a plot might help ellucidate whether I am missing some of them. Oh, I see. Sorry, I misunderstood what you were doing. > Of course, ideally one would like to have some kind of 2D extension of Ersek's RootSearch package which allows one to find the roots of an equation in a given 1D interval, so if you happen to know something similar, please let me know. Although there exist many open source and/or free for non-commercial use multidimensional root finders written in other programming languages (C/C++, FORTRAN, ...), I am not aware of any written in Mathematica. Note that, thanks to MathLink, you can interface many of these solvers to Mathematica. It might be a solution to explore... Regards, -- Jean-Marc >> Modeler wrote: >> >>> Assume I have the following code to find extrema of the >>> function interpolating Sin[x]Cos[y] in the square [0,2Pi]x[0,2Pi]: >>> >>> f[x_, y_] := Sin[x ] Cos[y] >>> >>> data = Flatten[ >>> Table[{{x, y}, f[x, y]}, {x, 0, 2 Pi}, {y, 0, >>> 2 Pi}], 1] >>> >>> g = Interpolation[data, InterpolationOrder -> 4] >>> >>> grad = D[g[x, y], {{x, y}, 1}] >>> >>> Table[FindRoot[grad, {{x, x0, 0, 2 Pi}, {y, y0, 0, 2 Pi}}], {x0, 0, >>> 2 Pi}, {y0, 0, 2 Pi}] >>> >>> This will yield a list of the extrema, some of them are equivalent, but since the starting point of the algorithm is different every time one will get numerical errors that leads to tiny differences in the final values. Therefore, some entries of this list which ought to be equivalent are treated like distinct elements. Union[] or subsequent use of N[] with a given precision and Union[] won't help me get rid of the redundant elements. Any ideas how to bypass this problem? >> I am afraid you have misunderstood my original post: I provided the >> above code to illustrate, first how to find the zeros of the derivatives >> of an interpolating function, second to emphasize some of the >> difficulties do to a thorough search of the zeros. >> >> So the grid give you some of the zeros, many redundant, yet it does not >> give you all the zeros. >> >> Regards, >> -- Jean-Marc >> >> >> >

**Re: A curious result?**

**Integration takes more time:**

**Re: Help to remove equivalent (redundant) solutions from FindRoot[]**

**Re: Help to remove equivalent (redundant) solutions from FindRoot[]**