Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2639 > unrolled thread
| Started by | Themis Matsoukas <tmatsoukas@me.com> |
|---|---|
| First post | 2011-05-23 10:27 +0000 |
| Last post | 2011-05-23 10:27 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: Problem with NMinimize Themis Matsoukas <tmatsoukas@me.com> - 2011-05-23 10:27 +0000
| From | Themis Matsoukas <tmatsoukas@me.com> |
|---|---|
| Date | 2011-05-23 10:27 +0000 |
| Subject | Re: Problem with NMinimize |
| Message-ID | <irdcpv$3q6$1@smc.vnet.net> |
Hi Dimos,
Define fob without ?NumericQ. For example:
nmax = 5;
thist = RandomReal[100, nmax];
t1 = RandomReal[100, nmax];
t2 = RandomReal[100, nmax];
t3 = RandomReal[100, nmax];
t4 = RandomReal[100, nmax];
fob[w1_, w2_, w3_, w4_, c_,
pow_] := (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}]
{1197.03, {w1 -> 0.81389, w2 -> 1.91257*10^-10, w3 -> 0.122859,
w4 -> 0.0632512, c -> 6.82525*10^-7, pow -> 1.98958*10^-8}}
Themis
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web