Re: Finding the Local Minima of a somewhat complicated function

*To*: mathgroup at smc.vnet.net*Subject*: [mg116059] Re: Finding the Local Minima of a somewhat complicated function*From*: Dana DeLouis <dana.del at gmail.com>*Date*: Mon, 31 Jan 2011 03:24:06 -0500 (EST)

Hi. Just a thought. I might suggest rationalizing the 0.695, and replacing your large value with a constant (say k) After simplify, I get... fun2 = -(1/(200 k))(100 (5 a (2+k y)+4 (-832+y (166+k (-391+166 y))))+139 a (2 k y ArcTanh[1-2 y]+Log[k]-k Log[1-y])) NMinimize[{fun2/.k->10000000000,0<y<1,0<a<300},{a,y}] {-310.7,{a->300.,y->0.9458}} > function is indeterminate at y=0 and at y=1. Hmmm. Just for g-wizz.... Limit[fun2,y->0]//Expand 1664/k-(5 a)/k-(139 a Log[k])/(200 k) > I see that for most (but not all) values of a, Mathematica does > not find a local minimum. Why is this so? A plot shows that the equation becomes more linear as the value of =91a gets smaller. Let=92s look at the extreme... Limit[fun2,{a->0}]//Expand {1664/k+782 y-(332 y)/k-332 y^2} As =91a gets smaller, this becomes a polynomial, and the graph is =93almost=94 a straight line on the interval 0<y<1. Hense, there is no minimum. About =93Where=94 does it break down ? Find a Minimum when the derivative is zero wrt y. cp=D[fun2,y]/.k->10000000000 //FullSimplify 1954999999917/2500000000-(5 a)/2-664 y-139/100 a ArcTanh[1-2 y] ContourPlot[cp==0,{a,0,300},{y,0,1},GridLines->Automatic] <graph here> We see that it breaks down numerically below about a< 150. Side Note: We just note that between about 160-190, there are two solutions of y that return a derivative of zero. = = = = = = = = = = HTH : >) Dana DeLouis On Jan 28, 6:14 am, Andrew DeYoung <adeyo... at andrew.cmu.edu> wrote: > Hi, > > I have a function that consists of two variables, y and a. I would > like to find the local minimum of the function in y for various > constant values of a. > > For example, the list of a values is given by: > > atable = Range[100, 300, 5]; > > For each a value in atable, I want to find the local minimum of the > function in y. My function is "fun," and I use code like the > following: > > fun=(1000-5*a)/10000000000+332*(y/10000000000+(1-y)*(1/5000000000+y)) > +(1/2)*y*(1000-5*a+1000*(-1/10))+0.695*a*(-(Log[10000000000]/ > 10000000000)+(1-y)*Log[1-y]+y*Log[y]); > > startPoint = 10^(-20); > endPoint = 1-10^(-20); > minData = Table[FindMinimum[fun /. a -> j, {y, startPoint, = endPoint}], > {j, atable}] > > Above, I use startPoint=10^(-20) and endPoint=1-10^(-20) because = the > function is indeterminate at y=0 and at y=1. When I run the above > code, I see that for most (but not all) values of a, Mathematica does > not find a local minimum. Why is this so? > > Of course, it could be that the function does not have a local minimum > at those values of a where Mathematica does not find one. But, if I > plot fun at a=300, for example, the plot shows that there is a local > minimum at something like y=0.945: > > Plot[fun /. a -> 300, {y, 0, 1}] > > But if I ask Mathematica to find that local minimum... > > FindMinimum[fun /. a -> 300, {y, startPoint, endPoint}] > > ...Mathematica will not find it. > > Can you please help me understand why I am having trouble finding the > local minima? > > Many thanks in advance, > > Andrew DeYoung > Carnegie Mellon University

**Re: Mathematica 8 Home Edition**

**Re: Finding the Local Minima of a somewhat complicated function**

**CellContext - Not ready for primetime use (opinion).**