I want to get the eight points of intersection from the equations 2 Abs[x] + Abs[y] == 1
and Abs[x] + 2 Abs[y] == 1
. To solve these equations, I tried
Solve[{2 Abs[x] + Abs[y] == 1, Abs[x] + 2 Abs[y] == 1}, {x, y}]
but could only get the four points. I then tried
y /. Quiet@Solve[#, y] /.
Abs[x_] -> {x, -x} & /@ {2 Abs[x] + Abs[y] == 1, Abs[x] + 2 Abs[y] == 1}
p = ({x, y} /. Solve[y == #] & /@ {{1 - 2 x, (1 - x)/2}, {(1 - x)/2, (
1 + x)/2}, {(1 + x)/2, 1 + 2 x}, {1 + 2 x, -1 - 2 x}, {-1 - 2 x,
1/2 (-1 - x)}, {1/2 (-1 - x),
1/2 (-1 + x)}, {1/2 (-1 + x), -1 + 2 x}, {-1 + 2 x, 1 - 2 x}})~
Flatten~1
{{1/3, 1/3}, {0, 1/2}, {-(1/3), 1/3}, {-(1/2), 0}, {-(1/3), -(1/3)}, {0, -(1/2)}, {1/3, -(1/3)}, {1/2, 0}}
It works, but I don't like it. Could you recommend a better method?
Answer
Actually, the way I interpret your ContourPlot
, there are only 4 points of intersection (red/blue curves). So I do interpret your question such that you want to include intersection with the coord axes as well. I hope this helps:
eq1 = 2 Abs[x] + Abs[y] == 1;
eq2 = Abs[x] + 2 Abs[y] == 1;
p = {x, y} /.
(Solve[#, {x, y}] & /@
{{eq1, eq2},
{x == 0, eq2},
{eq1, y == 0}})~Flatten~1
Comments
Post a Comment