<s>[INST] Fast/smart way to write polar curve in cartesian Is there a fast way to write the curve:
$$r=\frac{a}{1-\frac{1}{\sqrt{2}}\cos(\theta)}$$
as a cartesian curve $f(x,y)=0$?
It seems I can take 
$$r(1-\frac{1}{\sqrt{2}}\cos(\theta)) = a$$
$$r-\frac{x}{\sqrt{2}}=a$$
$$\sqrt{x^2+y^2}-\frac{x}{\sqrt{2}}=a$$
$$x^2+y^2=(a+\frac{x}{\sqrt{2}})^2$$
and then expand out, and complete the square. But I seem to get an error. Perhaps there is a smart way to do this?
 [/INST] HINT: we get
$$\sqrt{x^2+y^2}=\frac{a}{1-\frac{1}{\sqrt{2}}\frac{x}{\sqrt{x^2+y^2}}}$$
and we get by squaring
$$2(x^2+y^2)=2a^2+x^2+2\sqrt{2}ax$$
and then we have $$(x-\sqrt{2}a)^2+2y^2=2a^2$$
</s>