MathGroup Archive 2009

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

Search the Archive

Re: evaluating functions within Findminimum

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100151] Re: evaluating functions within Findminimum
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Tue, 26 May 2009 05:11:17 -0400 (EDT)
  • Organization: Uni Leipzig
  • References: <gvdr8e$743$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de

Hi,

write a function, i.e.,

myfunction[l1_?NumericQ,l2_?NumericQ,l3_?NumericQ,ps1_?NumericQ,ps2_?NumericQ,ps3_?NumericQ]:= 
...

and

FindMinimum[myfunction[l1,l2,l3,ps1,ps2,ps3],
  Evaluate[Sequence @@ startval]]

Regards
   Jens

Alberto Maydeu wrote:
> Greetings to all,
> 
> I'm using 
> 
> FindMinimum[Evaluate[e . Inverse[NormalAcov[sigma]]. e], Evaluate[Sequence @@ startval]]
> 
> NormalAcov[sigma] is a symbolic function. FindMinimum evaluates Inverse[NormalAcov[sigma]] symbolically then plugs in the numeric starting values and proceeds. This is obviously very slow for large problems. 
> 
> How can I get FindMinimum to first plug in the numeric starting values and perform Inverse[NormalAcov[sigma]] numerically as opposed to symbolically?
> 
> In case my question is unclear, here's a toy example
> 
> sigma = {{l1^2 + ps1, l1* l2, l1*l3}, {l1* l2, l2^2 + ps2, l2 l3}, {l1 l3, l2 l3, l3^2 + ps3}};
> startval = {{l1, .8}, {l2, .7}, {l3, .6}, {ps1, 1}, {ps2, 1}, {ps3, 1}};
> e = {1.7 - l1^2 - ps1, .5 - l1*l2, 1.6 - l2 - ps2, 1.5 - l1^2 - l3, .8 - l2*l3, 1.8 - l3^2 - ps3};
> FindMinimum[Evaluate[e . Inverse[NormalAcov[sigma]]. e], Evaluate[Sequence @@ startval]]
> 
> with
> 
> NormalAcov[matrix_List] := Module[{l1, l, c}, 
> l1 = Length[matrix]; 
> l = Binomial[l1 + 1, 2];
> c = Join @@ Table[{i, j}, {i, l1}, {j, 1, i }];
> Table[matrix[[c[[i, 1]], c[[j, 1]]]]*matrix[[c[[i, 2]], c[[j, 2]]]] + matrix[[c[[i, 1]], c[[j, 2]]]]*matrix[[c[[i, 2]], c[[j, 1]]]]
> , {i, l}, {j, l}]];
> 
> Thank you for your help.
> 
> Alberto
> 


  • Prev by Date: Re: 100,000 posts!
  • Next by Date: Re: list manipulation
  • Previous by thread: evaluating functions within Findminimum
  • Next by thread: Re: evaluating functions within Findminimum