# Equation solution using minimization

Posted 8 years ago
3867 Views
|
2 Replies
|
1 Total Likes
|
 I have an equation F[x,y]=0. I need to plot y as a function of x. Due to the properties of the function F[x,y], it is impossible to just use ContourPlot for this problem. Also, FindRoot (I don't know why) doesn't work in this situation.However, NMinimize[...,Method -> "NelderMead"] works well. I need to find all yi for every xi starting from some point {x0,y0} which I know a priori. I can do it step by step by hand and it takes a lot of time, but due to my low knowledge in Mathematica to date I can't automotize this process. So, please, could anyone help me to to write such a code in Mathematica: put starting point {x0,y0}. for i from 1 to N do xi=x{i-1}+deltaX, NMinimize[{F[xi, yi] y{i-1}-deltaY < yi < y{i-1}+deltaY}, {yi}, Method -> "NelderMead"](*so, for every xi we find yi and look for y{i+1} in the vicinity of yi; deltaX is just a step, deltaY is a small constant (much less then y_i)*) Plot the points {yi,xi}. For example, two steps of this algorithm:{x0,y0}=(0,0)x_1=0+0.05NMinimize[{F[x1, y1] 0-0.1 < yi < 0+0.1}, {yi}, Method -> "NelderMead"]we get y_1=0.05.x_2=0.05+0.05NMinimize[{F[x2, y2] 0.05-0.1 < yi < 0.05+0.1}, {yi}, Method -> "NelderMead"]we get y_1=0.75.... Attachments:
2 Replies
Sort By:
Posted 8 years ago
 Dear Daniel, thank you for your response! Firstly, the most interesting area for me is 0inb, b is finite and when b->inf a is finite. These solutions are described by other equations which are simply solved in Mathematica (using ContourPlot).But I can't solve this equation using ContourPlot (in some cases ContourPlot gives a solution, but it is wrong). Also, when I use FindRoot I receive very strange (sometimes even unphysical) solutions. As I know after looking through literature, it is possible to find solutions by Nelder-Mead minimization procedure "While no exact solution exists for the dispersion relations... in the real frequency domain...To obtain the complex wave vectors, numerical solution of ... was accomplished through implementation of a two-dimensional unconstrained Nelder-Mead minimization algorithm". In that article authors have considered absorptive media, but I firstly would like to consider non absorptive media, that's why I expect real-valued zeros.
Posted 8 years ago
 It seems to be effectively impossible to evaluate in those ranges without either huge error (at machine precision) or else internal overflows. I think this is from negative radicals giving imaginaries making trigs into hyperbolics. Behaves better for Abs[y]>3. Those ranges do not likely have roots though. Is there some reason to expect real-valued zeros?