Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2592
| From | dim <dimemples@gmail.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Problem with NMinimize |
| Date | 2011-05-22 10:55 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <iraq2s$lno$1@smc.vnet.net> (permalink) |
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}]
Back to comp.soft-sys.math.mathematica | Previous | Next — Next in thread | Find similar | Unroll thread
Problem with NMinimize dim <dimemples@gmail.com> - 2011-05-22 10:55 +0000 Re: Problem with NMinimize Ray Koopman <koopman@sfu.ca> - 2011-05-23 10:26 +0000
csiph-web