4
$\begingroup$

I want to find values of ${a,b,c}$ such that the equation has real solutions for $x , y ∈ [0, 1000]$. I tried to implement:

   Reduce[(Abs[a - b]*x*y + Abs[a - c]*(1000*x - x^2 - x*y) 
+ Abs[b - c]*(1000*y - x*y - y^2))/(1000*(a*x + b*y + 1000*c - c*x - c*y)) == 0.4, {x, y}]

where $a,b,c>0$.

but it gives me no solutions. Is there a way I can calculate that?

$\endgroup$
1
  • $\begingroup$ I would try FindMinimum of the function, which is more efficient than Solve. $\endgroup$
    – Ed 209
    Jul 5, 2018 at 15:29

2 Answers 2

3
$\begingroup$

ContourPlot3D allows you to see there are surfaces in parameter space where solutions exist. Unfortunately there isn't a 5D version, but you can keep varying the values of $a$ and $b$.

plot3d = ContourPlot3D[(f /. a -> 1 /. b -> 1) == 0, {c, 0, 1}, {x, 0,
    1000}, {y, 0, 1000}, AxesLabel -> {"c", "x", "y"}]

enter image description here

Another option is to use FindInstance, which returns a single solution immediately, but doesn't seem to want to give me multiple solutions when I request them via the additional options

FindInstance[f == 0 && a > 0 && b > 0 && c > 0 && 0 <= x <= 1000 && 
  0 <= y <= 1000, {a, b, c, x, y}]

(* {{a -> 1, b -> 1, c -> 599/400599, x -> 0, y -> 1}} *)

FindMinimum is very good at finding a point though:

FindMinimum[{f^2, a > 0, b > 0, c > 0, 0 <= x <= 1000,    0 <= y <= 1000}, {a, b, c, x, y}]

and if we repeated call this with different random initial conditions we can start to build up a 3D parameter plane:

tabb = Monitor[
   Table[FindMinimum[{f^2, a > 0, b > 0, c > 0, 0 <= x <= 1000, 
        0 <= y <= 
         1000}, {{a, #1}, {b, #2}, {c, #3}, {x, #4}, {y, #5}}, 
       AccuracyGoal -> 10] &@(Sequence @@ 
       RandomReal[{0, 1000}, 5]), {i, 1000}], i];
pts= {a, b, c, x, y} /. Pick[tabb[[All, 2]], Thread[tabb[[All, 1]] < 10^-10]]

This looks somewhat random, but there is some clear structure:

ListPlot[pts[[All, {1, 3}]], AxesLabel -> {"a", "c"}]

enter image description here

Limiting the range of the RandomReal or fixing $x$ and $y$ may well help.

$\endgroup$
4
$\begingroup$

A good strategy is to use SolveAlways[eqns,vars] that gives values of parameters that make the equations eqns valid for all values of the variables vars.

In particular, by defining:

f = (Abs[a - b] x y + Abs[a - c] (1000 x - x^2 - x y) + Abs[b - c]
    (1000 y - x y - y^2))/(1000 (a x + b y + 1000 c - c x - c y)) - 2/5;

writing:

SolveAlways[f == 0, {x, y}]

we get:

{{a -> 0, b -> 0, c -> 0}}

while writing:

SolveAlways[f == 0, x]

we get:

{{a -> 0, c -> 0, y -> 0}, {a -> 0, c -> 0, y -> 600}, {a -> 0, c -> 0, y -> 1400}, {a -> c, b -> 0, y -> -400}, {a -> c, b -> 0, y -> 400}, {a -> 0, b -> 0, c -> 0, y -> 100 (5 - Sqrt[41])}, {a -> 0, b -> 0, c -> 0, y -> 100 (5 + Sqrt[41])}, {a -> c, b -> c/6, y -> 600}, {a -> c, b -> (9 c)/14, y -> 1400}, {a -> c, b -> (14 c)/9, y -> -400}, {a -> c, b -> 6 c, y -> 400}, {a -> 0, b -> 0, c -> 0}, {a -> c, b -> (c (400000 - 1400 y + y^2))/((-1400 + y) y)}, {a -> c, b -> (c (-400000 - 600 y + y^2))/((-600 + y) y)}}

and similarly, writing:

SolveAlways[f == 0, y]

we get:

{{a -> 0, b -> c, x -> -400}, {a -> 0, b -> c, x -> 400}, {b -> 0, c -> 0, x -> 0}, {b -> 0, c -> 0, x -> 600}, {b -> 0, c -> 0, x -> 1400}, {a -> 0, b -> 0, c -> 0, x -> 100 (5 - Sqrt[41])}, {a -> 0, b -> 0, c -> 0, x -> 100 (5 + Sqrt[41])}, {a -> c/6, b -> c, x -> 600}, {a -> (9 c)/14, b -> c, x -> 1400}, {a -> (14 c)/9, b -> c, x -> -400}, {a -> 6 c, b -> c, x -> 400}, {a -> 0, b -> 0, c -> 0}, {a -> (c (400000 - 1400 x + x^2))/((-1400 + x) x), b -> c}, {a -> (c (-400000 - 600 x + x^2))/((-600 + x) x), b -> c}}

All that remains is to select the solutions of interest.

$\endgroup$
1
  • 1
    $\begingroup$ Thank you very much, that's super helpful!! $\endgroup$
    – Martina
    Jul 5, 2018 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.