Re: Re: max/min of functions
- To: mathgroup at smc.vnet.net
- Subject: [mg27672] Re: [mg27634] Re: [mg27581] max/min of functions
- From: "Mark Harder" <harderm at ucs.orst.edu>
- Date: Sat, 10 Mar 2001 00:50:08 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
oops! I left out the most important results of this method: the reporting of which are minima, and which are maxima. The relevant text should read > Except for the plot this returns >Out[209]= {x -> 0., x -> 2.} >Out[211]= {-6., 6.} >"minima @ {2.} >"maxima @ {0.} -mark harder -----Original Message----- From: Mark Harder <harderm at ucs.orst.edu> To: mathgroup at smc.vnet.net Subject: [mg27672] [mg27634] Re: [mg27581] max/min of functions > There have been many other solutions, but here is my 2 cents anyway. >Pick an interesting symbolic expression, one with more than one extremum, >say x^3 - 3 x^2 + 1 , and execute the following, which solves the equation >f'(x)=0, then Selects those solutions that have f''(x)<=0 (maxima) and >f''>=0 (minima): > >g = x^3 - 3 x^2 + 1; >Plot[g, {x, -1, 3}] >Mrules = Flatten[Solve[D[g, x] == 0., x] ] >xVals = Map[Replace[x, #] &, Mrules]; >(D[g, {x, 2}] /. x -> #) & /@ xVals >Print["minima @ ", Select[xVals, (D[g, {x, 2}] /. x -> #) >= 0. &] ]; >Print["maxima @ ", Select[xVals, (D[g, {x, 2}] /. x -> #) <= 0. &] ]; > > Except for the plot this returns >Out[209]= {x -> 0., x -> 2.} >Out[211]= {-6., 6.} > > In the event that g(x)=x^3, there are 2 extrema, both =0. and they are >both minima & maxima, because g''(x)=0 at x=0. When the function is Sin[x], >the Solve[] function only generates one solution, but it tells you that >there may be more solutions. > >-mark harder > > >-----Original Message----- >From: MathBuff <math_buff at REMOVECAPSyahoo.com> To: mathgroup at smc.vnet.net >To: mathgroup at smc.vnet.net >Subject: [mg27672] [mg27634] [mg27581] max/min of functions > > >>After consulting several books and online reference I cannot figure out how >>to find the maximum and or minimum values of functions. It seems there >must >>be a built in command for this type of thing, but I'll be damned if I can >>find it. (yes I can do this on a calculator, but I should be able to do it >>in mathematica!) >> >>here is an example: >>f(x)=x^2 - 7x -49 >> >>Also, is there a built in function that will report the vertex in the form >>x,y ? >> >>thanks! >> >>Ed >>(please respond to math_buff at yahoo.com as well as to this newsgroup) >>