Group Abstract Group Abstract

Message Boards Message Boards

0
|
928 Views
|
11 Replies
|
4 Total Likes
View groups...
Share
Share this post:

FunctionRange with unit circle and fixed angle constraints takes long time

Posted 1 month ago

This code runs for a long time without results in Mathematica. What is the reason?

FunctionRange[{Abs[x1 + y1 - 1]/Sqrt[2] + Abs[x2 + y2 - 1]/Sqrt[2], 
      x1^2 + y1^2 == 1, x2^2 + y2^2 == 1, x1 x2 + y1 y2 == 1/2}, {x1, y1, 
      x2, y2}, k]
POSTED BY: Wen Dao
11 Replies

You can get Reduce[] to break down the Abs[] like Bill Nelson, although it will produce seven cases instead of four. You also have to set up the function range system yourself.

LogicalExpand@ Reduce[ (* break down function *)
     {k == Abs[x1 + y1 - 1]/Sqrt[2] + Abs[x2 + y2 - 1]/Sqrt[2]},
     {x1, y1, x2, y2}, Reals
     ] //
   Map[
    Reduce[ (* add constraints; eliminate {x1, y1, x2, y2} *)
      {#, x1^2 + y1^2 == 1, x2^2 + y2^2 == 1, x1 x2 + y1 y2 == 1/2},
      {k}, {x1, y1, x2, y2}, Reals] &
    ] // FullSimplify // (* simplify the many intervals *)
 Reduce[#, k] & (* optional output as a compound inequality *)
(*  1/4 (-Sqrt[2] + Sqrt[6]) <= k <= Sqrt[2] + Sqrt[3]  *)
POSTED BY: Michael Rogers

If you combine all four results as Bill said to do, you get 1/4 (-Sqrt[2] + Sqrt[6]) <= k <= Sqrt[2] + Sqrt[3]. Is that not correct?

POSTED BY: Michael Rogers

I would switch to polar coordinates:

original = {RealAbs[x1 + y1 - 1]/Sqrt[2] +
    RealAbs[x2 + y2 - 1]/Sqrt[2],
   x1^2 + y1^2 == 1, x2^2 + y2^2 == 1,
   x1 x2 + y1 y2 == 1/2};
polar = {x1 -> Cos[t], y1 -> Sin[t],
   x2 -> Cos[u], y2 -> Sin[u]};
new = Join[original /. polar // Simplify,
  {0 <= t <= 2 Pi, 0 <= u <= 2 Pi}]
f[t_] = Piecewise[new[[1]] /.
    Solve[Rest[new], u, Reals] /.
   ConditionalExpression -> List]
Plot[f[t], {t, 0, 2 Pi}]
FunctionRange[{f[t], 0 <= t <= 2 Pi}, t, k]
Map[Simplify, %]
%% // N
POSTED BY: Gianluca Gorni
Posted 1 month ago

Problems that include Abs or Conjugate often seem more difficult to solve.

If you could find a way to express the problem in a form similar to

FunctionRange[{(x1 + y1 - 1)/Sqrt[2] +(x2 + y2 - 1)/Sqrt[2], 
  x1^2 + y1^2 == 1, x2^2 + y2^2 == 1,x1 x2 + y1 y2 == 1/2,
  x1+y1-1>=0, x2+y2-1>=0}, {x1, y1, x2, y2}, k]

then you can instantly get a solution. Then you will need to handle the other three cases and combine those results to try to get a complete solution.

POSTED BY: Bill Nelson
Posted 26 days ago

Awesome, the question is now crystal clear. Thank you so much!

POSTED BY: Wen Dao
Posted 1 month ago

Even though the correct maximum value was obtained by modifying the code, the entire range of k is still incorrect.

POSTED BY: Wen Dao
Posted 1 month ago

Based on the symmetry of the circle, modifying the code as follows will yield the correct answer.

FunctionRange[{-(x1 + y1 - 1)/Sqrt[2] - (x2 + y2 - 1)/Sqrt[2], 
  x1^2 + y1^2 == 1, x2^2 + y2^2 == 1, x1 x2 + y1 y2 == 1/2, 
  x1 + y1 - 1 <= 0, x2 + y2 - 1 <= 0}, {x1, y1, x2, y2}, k]
POSTED BY: Wen Dao
Posted 1 month ago

There's an error in the maximum value obtained from the code. The correct maximum value is √2 + √3.

POSTED BY: Wen Dao
Posted 1 month ago

Your method was brilliant; it perfectly solved the problem and even plotted the function graph. The parametric equation approach was very clever. Thank you so much!

POSTED BY: Wen Dao

You say it's incorrect, but it looks fine to me. Could you clarify what seems wrong?

You also mention a "single transformation," but Bill discussed four transformations.

POSTED BY: Michael Rogers
Posted 1 month ago

That's a clever approach, but relying on this single transformation alone leads to an incorrect result.

POSTED BY: Wen Dao
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard