# Parabola plotting tangential to x = const, and y= const

  ContourPlot[ pm  Sqrt[x - a] + pm Sqrt[y - b] == Sqrt[c], {x, 0, 2 a}, {y, 0,2 b}]


plots a parabola, but only a part between points of tangency (a, 0) and (0, b).

pm denotes + / -

How to Simplify it so that the full curve can be drawn?

How to specify a condition without squaring/simplification to draw it ?

Also can the PlotStyle -> Thick ( not available in ContourPlot Options ) be implemented any other way?

• You can add ContourStyle->Thick to get a thicker contour. – mickep Nov 10 '14 at 17:13

## 2 Answers

f[x_, y_, c_] /; x > 0 && y > 0 := (#.{Sqrt@x, Sqrt@y} < Sqrt[c]) & /@ Tuples[{-1, 1}, 2]

plot[a_, b_, c_] := RegionPlot[Xor @@ f[x - a, y - b, c], {x, 0, 4 a}, {y, 0, 4 b},
BoundaryStyle -> {Thick, Blue}, PlotStyle -> Transparent,
PlotRange -> {{0, 4 a .9}, {0, 4 b .9}}]

plot[2, 3, 4] You could rationalize the equation.

With[{conjugates =
pm Sqrt[x - a] + pm2 Sqrt[y - b] == Sqrt[c] /.
{{pm -> 1}, {pm -> -1}} /. {{pm2 -> 1}, {pm2 -> -1}} /. Equal -> Subtract},
eqn = 0 == Times @@ Flatten[conjugates] // Expand // PowerExpand
];
Block[{a = 2, b = 3, c = 4},
Print[eqn];
ContourPlot[Evaluate@eqn, {x, 0, 4 a}, {y, 0, 4 b}]
]

(*  0 == 57-6 x+x^2-10 y-2 x y+y^2 *) Update -- I'm not exactly sure what you seek for an answer to the question, "How to specify a condition...."

If you mean how to derive the equation without using Sqrt, then here's a way:

p[x_, y_] := x^2 - 2 x y + y^2 + p4 x + p5 y + p6
sys = {p[a, b + c], p[a + c, b], D[p[a, y], y] /. y -> b + c,
D[p[x, b], x] /. x -> a + c};

sol = Solve[sys == 0, {p4, p5, p6}]
(*  {{p4 -> -2 (a - b + c), p5 -> 2 (a - b - c),
p6 -> a^2 - 2 a b + b^2 + 2 a c + 2 b c + c^2}}  *)

p[x, y] /. First[sol] /. {a -> 2, b -> 3, c -> 4} // Expand
(*  57 - 6 x + x^2 - 10 y - 2 x y + y^2  *)


Or perhaps you want to change the two plus-minus into plusses and minuses instead of rationalizing:

Block[{a = 2, b = 3, c = 4},
ContourPlot[
pm Sqrt[x - a] + pm2 Sqrt[y - b] == Sqrt[c] /.
{{pm -> 1}, {pm -> -1}} /. {{pm2 -> 1}, {pm2 -> -1}} // Flatten // Evaluate,
{x, 0, 4 a}, {y, 0, 4 b},
ContourStyle -> Thick]
] One can use ContourStyle -> Directive[Thick, Blue] to get the pieces all the same color.