| Author |
Comment/Response |
Peter Pein
|
10/11/12 12:46pm
Hi Vadim,
the condition for t is redundant and might complicate things for Mathematica:
ForAll[{c1, c2},
0 <= c1 <= 1 >= c2 >= 0,
-1 <= c1 Sqrt[1 - c2^2] - c2 Sqrt[1 - c1^2] <= 1
] // Resolve
-->True
When using Maximize (in contrast to NMaximize) I strongly recommend to use exact input (no floating points):
result = Maximize[
{n - (1 - n) - q (n .5 c1^2 - (1 - n) .7 c2^2 + (n (1 - .5) - (1 - n) (1 - .7))/2) *
(n .5 c1^2 + (1 - n) .7 c2^2 + (n (1 - .5) + (1 - n) (1 - .7))/2) // Rationalize,
0 <= c1 <= 1 && 0 <= c2 <= 1 && 0 <= n <= 1 && 0 <= q <= 1},
{c1, c2}];
takes a few seconds and with PiecewiseExpand and FullSimplify the result becomes clearly represented:
Assuming[And @@ Thread[0 <= {c1, c2, q, n} <= 1],
FullSimplify[result // PiecewiseExpand]
]
gives:
Piecewise[
{{{-1 + 2*n, {c1 -> 1/2, c2 -> 1/2}}, q == 0},
{{1 - q/16, {c1 -> 0, c2 -> 1/2}}, q > 0 && n == 1},
{{-1 + (289*q)/400, {c1 -> 1/2, c2 -> 1}}, q > 0 && n == 0}},
{-1 + 2*n + (1/400)*(-17 + 12*n)*(-17 + 22*n)*q, {c1 -> 0, c2 -> 1}}
]
Peter
URL: , |
|