Re: minimum of a function
- To: mathgroup at smc.vnet.net
- Subject: [mg75051] Re: minimum of a function
- From: "ahallam at iastate.edu" <ahallam at iastate.edu>
- Date: Sun, 15 Apr 2007 05:13:13 -0400 (EDT)
- References: <evpoqm$6cp$1@smc.vnet.net>
On Apr 14, 12:28 am, Sven Krueger <Sven-Philip.Krue... at phys.uni- goettingen.de> wrote: > Hi > > I also have a question concerning a mathematica problem: > > I search the minimum of a function > fmin := FindMinimum[f[x], {x, 0}] > Evaluate[fmin] > > I get out for example > {2.4, {x -> 0.2}} > > Is it possible to use the result x=0.2 afterwards? > I would like to fix x after getting out the value of x at different > results of fmin. > > Thank you for your help > > Sven Kr=FCger Try this. You can pull elements from the list. Clear[x, f, F, fmin]; f[x_] := x^4 + 4*x^3 - 50*x^2 + 84*x; f[x] Plot[f[x], {x, -8, 5}, AxesLabel -> {"x", "f[x]"}, PlotStyle -> {RGBColor[0.1, 0.3, 0.8], Thickness[0.007]}, AxesStyle -> {RGBColor[0.1, 0, 0.1], Thickness[0.01]}, ImageSize -> 600]; fmin = FindMinimum[f[x], {x, -1}]; Evaluate[fmin] Print["This is the value of x at which f reaches a minimum"]; fminstar = fmin[[2,1,2]] (*This selects a portion of the answer*) (*This uses Solve*) xstar = Solve[D[f[x], x] == 0, x]; xstar Print["This is the first critical value of f[x]"]; xstar1 = xstar[[1,1,2]] Print["This is the second critical value of f[x]"]; xstar1 = xstar[[2,1,2]] Print["This is the third critical value of f[x]"]; xstar1 = xstar[[3,1,2]]