MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Capture values that Min(imize)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg117699] Re: Capture values that Min(imize)
  • From: Heike Gramberg <heike.gramberg at gmail.com>
  • Date: Wed, 30 Mar 2011 04:09:28 -0500 (EST)

I don't know if this is slicker, but what about

Table[{f, cList[[Ordering[Abs[err[f, #]] & /@ cList, 1]]]}, {f, Range[15, 30]}]

Heike

On 29 Mar 2011, at 12:50, 1.156 wrote:

> Hi, I finally found a way to get a list of c values from cList which
> minimize the err at each freq, f as below:
>
> L=14.95;cList={2.2, 3.2, 6.9, 7.9};
>
> err[f_,c_]:=(f-1/(2Pi Sqrt[L c*10^-6]))/f
>
> Table[{f,Select[cList,(Abs[err[f,#]]==Min[Abs[err[f,#]]&/@cList])&]},{f,15,30}]
>
> This works but looks horrible. Surely there's a slicker way to Minimize
> on a list and retain the value that achieved the minimum. I did try to
> stuff Reap/Sow in various places but everything I did threw error
> messages. Thanks for any pointers, Rob
>
>


  • Prev by Date: Standard evaluation sequence and Trace
  • Next by Date: Re: LUDecomposition
  • Previous by thread: Capture values that Min(imize)
  • Next by thread: Re: Capture values that Min(imize)