MathGroup Archive 2011

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

Search the Archive

Problem with NMinimize

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119111] Problem with NMinimize
  • From: dim <dimemples at gmail.com>
  • Date: Sun, 22 May 2011 06:54:14 -0400 (EDT)
  • Reply-to: comp.soft-sys.math.mathematica at googlegroups.com

I try to minimize a function but it seems that Mathematica cannot calculate it.
I would appreciate any help provided, because I have already lost 2 days trying to fix it, but  I cannot find any solution... Mathematica either crashes or outputs the nnum error, even though I have defined the 'fob' function to work numerically.


thist = RandomReal[100, 50000];
t1 = RandomReal[100, 50000];
t2 = RandomReal[100, 50000];
t3 = RandomReal[100, 50000];
t4 = RandomReal[100, 50000];


fob[w1_?NumericQ, w2_?NumericQ, w3_?NumericQ, w4_?NumericQ, 
   c_?NumericQ, pow_?NumericQ] :=
  (w1*(c + t1)^pow + w2*(c + t2)^pow + w3*(c + t3)^pow + 
      w4*(c + t4)^pow)^(1/pow) - c;


results = NMinimize[
  {Abs[1000*(Mean[thist] - Mean[fob[w1, w2, w3, w4, c, pow]])^2 +
     Total[(thist - fob[w1, w2, w3, w4, c, pow])^2]/Length[thist]], 
   w1 + w2 + w3 + w4 == 1 && 0 < w1 < 1 && 0 < w2 < 1, 
   0 < w3 < 1 && 0 < w4 < 1 && 0 < c, 0 < pow}, {w1, w2, w3, w4, c, 
   pow}]


  • Prev by Date: Re: Overloading functions
  • Next by Date: Re: Series[log[x], {x, 0, 3}]
  • Previous by thread: Re: get a, b from numbers in the form a+b Pi
  • Next by thread: Re: Problem with NMinimize