Re: Re: minmum of a function

*To*: mathgroup at smc.vnet.net*Subject*: [mg75223] Re: [mg75126] Re: minmum of a function*From*: skruege at gwdg.de*Date*: Sat, 21 Apr 2007 23:05:37 -0400 (EDT)*References*: <f014ar$8qr$1@smc.vnet.net>

Hi Jean-Marc, Thank for your help. I think (Head /@ t1)[[All,1]] is exactly what I need. Probably I could simplify my definitions of function even before. In fact, I defined amp := fmax/f5 with fmax := FindMaximum[Sum[Integrate[f1[x], {x, i, i + a}], {i, 0, 2}], {p, 0}] whereas f1[x_] := c + (Cos[Pi*x + p])^2 and f5 := Integrate[f4[x], {x, 0, 2 + a}] whereas f4[x_] := c + (Cos[Pi*x + pmax])^2 and pmax := p /. fmax[[2]]. With (Head /@ t1)[[All,1]] I'm now able to create a list amp[a] and to plot it. Before your help, I managed to get the list by using 'Block' like f6 := Block[{a = 0.1}, amp], but it isn't elegant at all. Regards, Sven > Hi Sven, > > (Head /@ t1)[[All,1]] > > will do it. > > Now the question is: Are you sure that the format of the list t1 is > really the one you want? As defined (or returned by amp[a]), t1 is a > list of expressions with _head_ of the form {aNumber, {anotherNumber * > aRule}}. Therefore, the elements that Part sees by default are 0.1, 0.2, > etc. > > In[1]:= > t1 = {{0.270697, {0.909768*(p -> -0.15708)}}[0.1], > {0.270697, {0.837837*(p -> -0.314159)}}[0.2], > {0.653976, {0.782008*(p -> -0.471239)}}[0.3]}; > > In[2]:= > t1[[1]] > > Out[2]= > {0.270697, {0.909768*(p -> -0.15708)}}[0.1] > > In[3]:= > Head[t1[[1]]] > > Out[3]= > {0.270697, {0.909768*(p -> -0.15708)}} > > In[4]:= > Head[t1[[1]]][[1]] > > Out[4]= > 0.270697 > > In[5]:= > (Head /@ t1)[[All,1]] > > Out[5]= > {0.270697, 0.270697, 0.653976} > > You may prefer to check your function amp[] and fix it so it will return > its results as a list of values. > > Regards, > Jean-Marc > >