If I have a function
$P = \frac{q}{\sqrt{(x_1-x_2)^2 + (y_1+y_2)^2}} + \frac{q}{\sqrt{(x_1-x_3)^2 + (y_1+y_3)^2}} + \frac{q}{\sqrt{(x_3-x_2)^2 + (y_3+y_2)^2}}$
where the points $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ are subject to the constraint that they must lie on an equilateral triangle with side length $1$ and with vertices at $(-\frac{1}{2}, 0)$, $(\frac{1}{2},0)$, $(0, \frac{\sqrt{3}}{2})$, what would the constraints look like if I'm using a Lagrange multiplier? I know for circle with radius $1$ centered around the origin we would get three different constraint functions
$g(x_1, y_1) = x_1^2 + y_1^2 - 1$,
$h(x_2, y_2) = x_2^2 + y_2^2 - 1$,
$j(x_3, y_3) = x_3^2 + y_3^2 - 1$,
but I'm not sure how to set up the constraints for a triangle.
And what about for a square with side length $1$ with vertices at $(-1,0)$, $(-1, 1)$, $(1, 1)$, $(1, 0)$?
Given the points $p_1,p_2,p_3$ characterizing the vertices of an equilateral triangle with known locations, the sides can be described by three parameters $\lambda,\mu,\nu$ such that
$$ \cases{ s_{12}(\lambda)= \lambda p_1+(1-\lambda)p_2,\ \ 0\le\lambda\le 1\\ s_{23}(\mu)= \mu p_2+(1-\mu)p_3\ \ 0\le\mu\le 1\\ s_{31}(\nu)=\nu p_3+(1-\nu)p_1\ \ 0\le\nu\le 1\\ } $$
and the problem could be transformed into
$$ \min(\max)_{\lambda,\mu,\nu}\left(\frac{q}{\|s_{12}(\lambda)\|}+\frac{q}{\|s_{23}(\mu)\|}+\frac{q}{\|s_{31}(\nu)\|}\right)\ \ \text{s. t.}\ \ \cases{0\le\lambda\le 1\\ 0\le\mu\le 1\\ 0\le\nu\le 1} $$
NOTE
The restrictions can be eliminated by doing
$$ \cases{ \lambda = \frac 12(\sin u+1)\\ \mu = \frac 12(\sin v + 1)\\ \nu = \frac 12(\sin w + 1) } $$