Is there an equation to describe regular polygons?












48












$begingroup$


For example, the square can be described with the equation $|x| + |y| = 1$. So is there a general equation that can describe a regular polygon (in the 2D Cartesian plane?), given the number of sides required?



Using the Wolfram Alpha site, this input gave an almost-square:
PolarPlot(0.75 + ArcSin(Sin(2x+Pi/2))/(Sin(2x+Pi/2)*(Pi/4))) (x from 0 to 2Pi)



This input gave an almost-octagon:
PolarPlot(0.75 + ArcSin(Sin(4x+Pi/2))/(Sin(4x+Pi/2)*Pi^2)) (x from 0 to 2Pi)



The idea is that as the number of sides in a regular polygon goes to infinity, the regular polygon approaches a circle. Since a circle can be described by an equation, can a regular polygon be described by one too? For our purposes, this is a regular convex polygon (triangle, square, pentagon, hexagon and so on).



It can be assumed that the centre of the regular polygon is at the origin $(0,0)$, and the radius is $1$ unit.



If there's no such equation, can the non-existence be proven? If there are equations, but only for certain polygons (for example, only for $n < 7$ or something), can those equations be provided?










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    This was actually asked by a blog reader. He read this blog post of mine and wondered about generalising the question to include regular polygons.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 11:48








  • 1




    $begingroup$
    The answer depends on what kind of functions you're allowing in such an equation.
    $endgroup$
    – Qiaochu Yuan
    May 29 '11 at 12:08










  • $begingroup$
    If you can use rotation matrices then I would assume its possible...
    $endgroup$
    – soandos
    May 29 '11 at 12:17










  • $begingroup$
    Qiaochu, any function can be used. As long as the resulting polygon is continuous (no breaks) and defined using that one equation.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:13
















48












$begingroup$


For example, the square can be described with the equation $|x| + |y| = 1$. So is there a general equation that can describe a regular polygon (in the 2D Cartesian plane?), given the number of sides required?



Using the Wolfram Alpha site, this input gave an almost-square:
PolarPlot(0.75 + ArcSin(Sin(2x+Pi/2))/(Sin(2x+Pi/2)*(Pi/4))) (x from 0 to 2Pi)



This input gave an almost-octagon:
PolarPlot(0.75 + ArcSin(Sin(4x+Pi/2))/(Sin(4x+Pi/2)*Pi^2)) (x from 0 to 2Pi)



The idea is that as the number of sides in a regular polygon goes to infinity, the regular polygon approaches a circle. Since a circle can be described by an equation, can a regular polygon be described by one too? For our purposes, this is a regular convex polygon (triangle, square, pentagon, hexagon and so on).



It can be assumed that the centre of the regular polygon is at the origin $(0,0)$, and the radius is $1$ unit.



If there's no such equation, can the non-existence be proven? If there are equations, but only for certain polygons (for example, only for $n < 7$ or something), can those equations be provided?










share|cite|improve this question











$endgroup$








  • 1




    $begingroup$
    This was actually asked by a blog reader. He read this blog post of mine and wondered about generalising the question to include regular polygons.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 11:48








  • 1




    $begingroup$
    The answer depends on what kind of functions you're allowing in such an equation.
    $endgroup$
    – Qiaochu Yuan
    May 29 '11 at 12:08










  • $begingroup$
    If you can use rotation matrices then I would assume its possible...
    $endgroup$
    – soandos
    May 29 '11 at 12:17










  • $begingroup$
    Qiaochu, any function can be used. As long as the resulting polygon is continuous (no breaks) and defined using that one equation.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:13














48












48








48


35



$begingroup$


For example, the square can be described with the equation $|x| + |y| = 1$. So is there a general equation that can describe a regular polygon (in the 2D Cartesian plane?), given the number of sides required?



Using the Wolfram Alpha site, this input gave an almost-square:
PolarPlot(0.75 + ArcSin(Sin(2x+Pi/2))/(Sin(2x+Pi/2)*(Pi/4))) (x from 0 to 2Pi)



This input gave an almost-octagon:
PolarPlot(0.75 + ArcSin(Sin(4x+Pi/2))/(Sin(4x+Pi/2)*Pi^2)) (x from 0 to 2Pi)



The idea is that as the number of sides in a regular polygon goes to infinity, the regular polygon approaches a circle. Since a circle can be described by an equation, can a regular polygon be described by one too? For our purposes, this is a regular convex polygon (triangle, square, pentagon, hexagon and so on).



It can be assumed that the centre of the regular polygon is at the origin $(0,0)$, and the radius is $1$ unit.



If there's no such equation, can the non-existence be proven? If there are equations, but only for certain polygons (for example, only for $n < 7$ or something), can those equations be provided?










share|cite|improve this question











$endgroup$




For example, the square can be described with the equation $|x| + |y| = 1$. So is there a general equation that can describe a regular polygon (in the 2D Cartesian plane?), given the number of sides required?



Using the Wolfram Alpha site, this input gave an almost-square:
PolarPlot(0.75 + ArcSin(Sin(2x+Pi/2))/(Sin(2x+Pi/2)*(Pi/4))) (x from 0 to 2Pi)



This input gave an almost-octagon:
PolarPlot(0.75 + ArcSin(Sin(4x+Pi/2))/(Sin(4x+Pi/2)*Pi^2)) (x from 0 to 2Pi)



The idea is that as the number of sides in a regular polygon goes to infinity, the regular polygon approaches a circle. Since a circle can be described by an equation, can a regular polygon be described by one too? For our purposes, this is a regular convex polygon (triangle, square, pentagon, hexagon and so on).



It can be assumed that the centre of the regular polygon is at the origin $(0,0)$, and the radius is $1$ unit.



If there's no such equation, can the non-existence be proven? If there are equations, but only for certain polygons (for example, only for $n < 7$ or something), can those equations be provided?







geometry analytic-geometry






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Oct 4 '11 at 22:25









J. M. is not a mathematician

61.2k5152290




61.2k5152290










asked May 29 '11 at 11:45









Vincent TanVincent Tan

343145




343145








  • 1




    $begingroup$
    This was actually asked by a blog reader. He read this blog post of mine and wondered about generalising the question to include regular polygons.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 11:48








  • 1




    $begingroup$
    The answer depends on what kind of functions you're allowing in such an equation.
    $endgroup$
    – Qiaochu Yuan
    May 29 '11 at 12:08










  • $begingroup$
    If you can use rotation matrices then I would assume its possible...
    $endgroup$
    – soandos
    May 29 '11 at 12:17










  • $begingroup$
    Qiaochu, any function can be used. As long as the resulting polygon is continuous (no breaks) and defined using that one equation.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:13














  • 1




    $begingroup$
    This was actually asked by a blog reader. He read this blog post of mine and wondered about generalising the question to include regular polygons.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 11:48








  • 1




    $begingroup$
    The answer depends on what kind of functions you're allowing in such an equation.
    $endgroup$
    – Qiaochu Yuan
    May 29 '11 at 12:08










  • $begingroup$
    If you can use rotation matrices then I would assume its possible...
    $endgroup$
    – soandos
    May 29 '11 at 12:17










  • $begingroup$
    Qiaochu, any function can be used. As long as the resulting polygon is continuous (no breaks) and defined using that one equation.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:13








1




1




$begingroup$
This was actually asked by a blog reader. He read this blog post of mine and wondered about generalising the question to include regular polygons.
$endgroup$
– Vincent Tan
May 29 '11 at 11:48






$begingroup$
This was actually asked by a blog reader. He read this blog post of mine and wondered about generalising the question to include regular polygons.
$endgroup$
– Vincent Tan
May 29 '11 at 11:48






1




1




$begingroup$
The answer depends on what kind of functions you're allowing in such an equation.
$endgroup$
– Qiaochu Yuan
May 29 '11 at 12:08




$begingroup$
The answer depends on what kind of functions you're allowing in such an equation.
$endgroup$
– Qiaochu Yuan
May 29 '11 at 12:08












$begingroup$
If you can use rotation matrices then I would assume its possible...
$endgroup$
– soandos
May 29 '11 at 12:17




$begingroup$
If you can use rotation matrices then I would assume its possible...
$endgroup$
– soandos
May 29 '11 at 12:17












$begingroup$
Qiaochu, any function can be used. As long as the resulting polygon is continuous (no breaks) and defined using that one equation.
$endgroup$
– Vincent Tan
May 29 '11 at 15:13




$begingroup$
Qiaochu, any function can be used. As long as the resulting polygon is continuous (no breaks) and defined using that one equation.
$endgroup$
– Vincent Tan
May 29 '11 at 15:13










11 Answers
11






active

oldest

votes


















40












$begingroup$

Any polygon (regular or not) can be described by an equation involving only absolute values and polynomials. Here is a small explanation of how to do that.



Let's say that a curve $C$ is given by the equation $f$ if we have $C = {(x,y) in mathbb{R}^2, , f(x,y) = 0}$.




  • If $C_1$ and $C_2$ are given by $f_1$ and $f_2$ respectively, then $C_1 cup C_2$ is given by $f_1 . f_2$ and $C_1 cap C_2$ is given by $f_1^2 + f_2^2$ (or $|f_1| + |f_2|$). So if $C_1$ and $C_2$ can be described by an equation involving absolute values and polynomials, then so do $C_1 cup C_2$ and $C_1 cap C_2$.


  • If $C = {(x,y) in mathbb{R}^2, , f(x,y) ge 0}$, then $C$ is given by the equation $|f|-f$.



Now, any segment $S$ can be described as $S = {(x,y) in mathbb{R}^2, , a x + b y = c, , x_0 le x le x_1, , y_0 le y le y_1}$, which is given by a single equation by the above principles. And since union of segments also are given by an equation, you get the result.



EDIT : For the specific case of the octagon of radius $r$, if you denote $s = sin(pi/8)$, $c = cos(pi/8)$, then one segment is given by $|y| le rs$ and $x = rc$, for which an equation is



$$f(x, y) = left||rs - |y|| - (rs - |y|)right| + |x-rc| = 0$$



So I think the octagon is given by



$$f(|x|,|y|) f(|y|,|x|) fleft(frac{|x|+|y|}{sqrt{2}}, frac{|x|-|y|}{sqrt{2}}right) = 0$$



To get a general formula for a regular polygon of radius $r$ with $n$ sides, denote $c_n = cos(pi/n)$, $s_n = sin(pi/n)$ and



$$f_n(x+iy) = left||rs_n - |y|| - (rs_n - |y|)right| + |x-rc_n|$$



then your polygon is given by



$$prod_{k = 0}^{n-1} f_nleft(e^{-frac{2 i k pi}{n}} (x+iy)right) = 0$$



Depending on $n$, you can use symmetries to lower the degree a bit (as was done with $n = 8$).






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Hi Joel, can this result be used to generate some equations for regular polygons? tx
    $endgroup$
    – Arjang
    May 29 '11 at 12:40








  • 3




    $begingroup$
    @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
    $endgroup$
    – Joel Cohen
    May 29 '11 at 12:54












  • $begingroup$
    Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:11






  • 1




    $begingroup$
    @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
    $endgroup$
    – Joel Cohen
    May 29 '11 at 16:06










  • $begingroup$
    For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
    $endgroup$
    – lhf
    May 29 '11 at 20:06





















28












$begingroup$

Here's a parametric equation I have made for a regular $n$-gon, coded in R:



n=5;
theta=(0:999)/1000;
r=cos(pi/n)/cos(2*pi*(n*theta)%%1/n-pi/n);
plot(r*cos(2*pi*theta),r*sin(2*pi*theta),asp=1,xlab="X",ylab="Y",
main=paste("Regular ",n,"-gon",sep=""));


And picture:



5-gon



The formula I used is



$$displaystyle r=frac{cosleft(frac{pi}{n}right)}{cosleft(left(theta mod frac{2pi}{n}right) -frac{pi}{n}right)} ; .$$



This equation is actually just the polar equation for the line through the point $(1,0)$ and $(cos(2pi/n),sin(2pi/n))$ which contains one of the edges. By restricting the range of the variable $theta$ to the interval $[0,2pi/n[$, you will in fact just get that edge. Now, we want to replicate that edge by rotating it repeatedly through an angle $2pi/n$ to get the full polygon. But this can also be achieved by using the modulus function and reducing all angles to the interval $[0,2pi/n[$. This way, you get the polar equation I propose.



So, using polar plots and the modulo function, it's pretty easy to make regular $n$-gons.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Hi Raskolnikov, can you explain how you got (or derived) that formula?
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:15










  • $begingroup$
    @Vincent Tan: I added a short explanation.
    $endgroup$
    – Raskolnikov
    May 29 '11 at 15:39










  • $begingroup$
    I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
    $endgroup$
    – J. M. is not a mathematician
    Jul 29 '11 at 4:35






  • 1




    $begingroup$
    Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
    $endgroup$
    – murkle
    Sep 22 '14 at 9:06





















11












$begingroup$

Here is another parametric equation for a regular $n$-gon with unit radius:



$$begin{align*}x&=cosleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)-(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\y&=cosleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)+(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{align*}$$



for $0 leq u leq n$.



The provenance of this set is a bit more transparent if we switch to matrix-vector notation:



$$begin{pmatrix}cosleft(frac{pi}{n}(2lfloor urfloor+1)right)&-sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\sinleft(frac{pi}{n}(2lfloor urfloor+1)right)&cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{pmatrix}begin{pmatrix}cosleft(frac{pi}{n}right)\(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)end{pmatrix}$$



and we see that the construction involves rotating and copying the line segment joining the points $(cosleft(frac{pi}{n}right),pmsinleft(frac{pi}{n}right))$ $n$ times around a circle.





Here's sundry Mathematica code:



GraphicsGrid[Partition[Table[
ParametricPlot[Through[{Re, Im}[
(Cos[Pi/n] + I (2u - 2 Floor[u] - 1)Sin[Pi/n])*
Exp[(I Pi/n) (2 Floor[u] + 1)]],
{u, 0, n}], {n, 3, 11}], 3]]


regular polygons, 3-11






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Do you have a citation for equation? (How you got in this equation?)
    $endgroup$
    – Wagner Jorge
    May 22 '16 at 17:49










  • $begingroup$
    No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
    $endgroup$
    – J. M. is not a mathematician
    May 22 '16 at 17:52






  • 1




    $begingroup$
    I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
    $endgroup$
    – Wagner Jorge
    May 22 '16 at 18:06






  • 2




    $begingroup$
    Sure, as long as you give attribution of course (per SE rules). :)
    $endgroup$
    – J. M. is not a mathematician
    May 22 '16 at 18:38










  • $begingroup$
    BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
    $endgroup$
    – J. M. is not a mathematician
    Jul 30 '16 at 12:57



















8












$begingroup$

The following is probably not in the spirit of the game, but what about a parametric equation? If we are willing to use complex numbers to represent points in the plane, we could use
$$z=texp(2pi ik/n) +(1-t)exp(2pi i(k+1)/n),qquad 0 le t<1,quad k=0, 1, dots, n-1$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
    $endgroup$
    – Vincent Tan
    May 29 '11 at 15:21



















1












$begingroup$

Simply enough:



r(θ) = sec(θ%(π/n')-π/n)



When n' = n/2 and % is the modulus operator.



It would work just as well with cosecant as with secant.



Also the apothem would be 1 and the radius sec(-π/n).






share|cite|improve this answer









$endgroup$













  • $begingroup$
    What is the difference between this and Raskolnikov's answer?
    $endgroup$
    – J. M. is not a mathematician
    Aug 17 '15 at 7:53



















1












$begingroup$

$arcsin left(sin left(left[sin left(60cdot frac{pi }{180}right)left(frac{sqrt{3}}{3}cdot x+yright),xright]right)right)+left(frac{1}{3}right)cdot arcsin left(sin left(left[cos left(30cdot frac{pi }{180}right)left(x-frac{sqrt{3}}{3}yright),yright]cdot sqrt{3}right)right)=0$



https://www.desmos.com/calculator/yptmqucuwl



I came up with this to plot a hexagon tessellation in desmos....the [list] funct "hides" the overlay ...so it isn't really a single EQ.....actually there was very little info on this.....took me weeks....enjoy






share|cite|improve this answer









$endgroup$













  • $begingroup$
    Very clever! (+1)
    $endgroup$
    – hypergeometric
    Jan 10 at 18:03



















0












$begingroup$

Reposted from PolymathProgrammer.com, my answer to my own initial query. Generated mostly on my own after some initial help from a friend (Jason Schmurr) and my dad (Russell Gmirkin)





I believe I've solved my own inquiry. The following are functions that, when graphed in polar coordinates render lovely polygons.



In fact, I’ve got 3 versions (6 if you consider rotation a factor; to either align a vertex or the midpoint of a side with $theta=0$). One with circumradius = 1 (as vertices $to infty$, polygons expand outward toward the circumscribed circle), one with apothem = 1 (as vertices $to infty$, polygons collapse inward toward the inscribed circle) and one with the midpoint between circumradius & apothem = 1 (as vertices $to infty$, both the maxima and minima, thus the circumscribed and inscribed circles, collapse toward that ‘midpoint radius’).



I’d be interested to know whether this approach, describing the radius of a polygon as a periodic function, has any precedent (has anyone else done this, or am I the first)? I’ve been working on this idea for some time (on and off for years), but just recently overcame some stumbling blocks with a little help from a friend and my dad. Most of the legwork was my own, though.



The relatively final form(s) appear to be:



(n-gon, circumradius=1, unrotated)
1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



(n-gon, circumradius=1, rotated $-pi/4$)
1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



(n-gon, function centered around unit circle, unrotated)
((Sec[Pi/v]+1)/2)/(((Sec[Pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



(n-gon, function centered around unit circle, rotated $-pi/4$)
((Sec[Pi/v]+1)/2)/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



(n-gon, apothem=1, unrotated)
Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



(n-gon, apothem=1, rotated $-pi/4$)
Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



Don’t know whether they simplify at all to something less complicated… Even if not, they’re beauties!



Examples:



3-gon: here



4-gon: here



5-gon: here



If it's a unique solution and I'm first to it, I submit these as the Gmirkin Polygon Radius Function(s) (or some suitably nifty sounding name that’s not too cumbersome). *Smile* Heh.



I may write them up formally for publication at some point, once a few previous engagements clear up, assuming they’ve not previously been published or some directly correlated function has already been published elsewhere. (If so, I’d like to know when, where and by whom; for academic curiosity’s sake.)



It is my belief that a similar function exists for describing 3D Polyhedrons of some description(s). Though, I have not yet even attempted such a case and will probably stick to 2D cases for now. I can also tell you that if you vary the phase shift of the denominator [Abs[Cos]] terms by differing amounts (though not both by some multiple of $pi/4$, $pi/2$, etc.), you can also reproduce rectangles, isosceles triangles, etc. In some cases you can also generate diamond shapes by varying some other parameters. It's s surprisingly robust solution, as I'd hoped. Lord knows it's taken me a few years of false starts to get at the correct combination of functions. Though, I learned plenty along the way, much of which helped me generalize to all polygons from the square case a friend solved at my behest a week or two ago.



Here's hoping this is an interesting, unique new solution that's viable and notable. (One can hope!)



Sorry the post is a bit lengthy... ;)



Best,

~Michael Gmirkin





Edit:



Sorry. Jumped the gun slightly.



I retract the above equations. At the behest of someone on another site, I checked in Wolfram Alpha at a few data points. While it appears to work for the Square case (where the coefficients and corrective term basically cancel out), it doesn't work for other cases, but is slightly off. I think I've got the coefficients wrong. Will have to poke around a bit more in the maths to see if it's possible to get a technically correct exact solution.



The graphs were so close as to fool me into thinking they were exact for all cases. Will get back to you if/when I get a technically correct solution. 'Til then... I still believe there is a valid function, since the Square case is technically correct @ 1/(Abs[Sin(x)]+Abs[Cos[x]]) or 1/(Abs[Cos[x]]+[Abs[Cos[x-(Pi/2)]]]). Just need the technically correct coefficient... will work on it as I've got some time. But, for now, the incorrect versions are darned close! ;o) Enough to fool most people (including me, apparently).






share|cite|improve this answer











$endgroup$





















    0












    $begingroup$

    Depends what you accept as "a general equation" and what is "a plot". For example, under the $l_1$ metric, the equation of what is perceived as a circle ( points having the same distance to a center) ends up looking like a square. Now would that count as genuine plot? Or, are we only allowed the Euclidean metric for plotting? Also, is an answer containing a limit acceptable? For example $$x^{2n}+y^{2n}=r^{2n} lim_{n to +infty}$$ is a square ( or is it? ) see this for $n=18$



    Also is the equation implicit in x and y or polar and parametric plots are also allowed?






    share|cite|improve this answer











    $endgroup$





















      0












      $begingroup$

      How's this (Mathematica code)? It gives the n-gons inscribed in the unit circle, with vertices at the nth roots of unity.



      Manipulate[PolarPlot[Cos[Pi/n] Sec[(2/n) ArcTan[Cot[(n t/2)]]], {t, 0, 2 Pi}], {n, 3, 40, 1}]






      share|cite|improve this answer









      $endgroup$













      • $begingroup$
        I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
        $endgroup$
        – Vincent Tan
        Feb 18 '14 at 11:12












      • $begingroup$
        You're basically using $arctan cot x$ here as your sawtooth… :)
        $endgroup$
        – J. M. is not a mathematician
        Aug 17 '15 at 7:54



















      0












      $begingroup$

      A cheap trick: Take an equation that represents the union of the extensions of the polygon’s sides and add a domain-limiting term to both sides.



      For example, the equation $$(x-C)(x+y-sqrt2C)(y-C)(x-y+sqrt2C)(x+C)(x+y+sqrt2C)(y+C)(x-y-sqrt2C)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}$$ with $C=cos{fracpi8}$ describes a regular octagon. For a regular polygon with an even number of sides, you can pair up opposite sides to halve the number of terms: $$(x^2-C^2)((x+y)^2-2C^2)(y^2-C^2)(x-y+sqrt2C)((x-y)^2-2C^2)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}.$$



      This obviously generalizes to polygons that are affine images of cyclic polygons, i.e., one whose vertices all lie on an ellipse.






      share|cite|improve this answer









      $endgroup$





















        0












        $begingroup$

        In the context of this question you may define for a given number $n$ some (Fourier) coefficients by these sensible equations (as you have asked for):



        $a^{(n)}_k sim begin{cases}
        +k^{-2} & text{ for } k equiv 1 pmod n\
        +k^{-2} & text{ for } k equiv (n-1) pmod n\
        0 & text{ otherwise }
        end{cases}$



        $b^{(n)}_k sim begin{cases}
        +k^{-2} & text{ for } k equiv 1 pmod n\
        -k^{-2} & text{ for } k equiv (n-1) pmod n\
        0 & text{ otherwise }
        end{cases}$



        Then you calculate the functions $a^{(n)}(t)$ and $b^{(n)}(t)$ like this:



        $a^{(n)}(t) sim sum_{k=0}^infty a^{(n)}_kcos(kt)$



        $b^{(n)}(t) sim sum_{k=0}^infty b^{(n)}_ksin(kt)$



        Finally you draw the curve $t mapsto a^{(n)}(t) + ib^{(n)}(t)$ in the complex plane – and get your desired regular $n$-gon.



        As an example for $n=4$:



        enter image description here



        See more examples in the gallery here.






        share|cite|improve this answer











        $endgroup$












          protected by Community Jun 3 '15 at 6:07



          Thank you for your interest in this question.
          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



          Would you like to answer one of these unanswered questions instead?














          11 Answers
          11






          active

          oldest

          votes








          11 Answers
          11






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          40












          $begingroup$

          Any polygon (regular or not) can be described by an equation involving only absolute values and polynomials. Here is a small explanation of how to do that.



          Let's say that a curve $C$ is given by the equation $f$ if we have $C = {(x,y) in mathbb{R}^2, , f(x,y) = 0}$.




          • If $C_1$ and $C_2$ are given by $f_1$ and $f_2$ respectively, then $C_1 cup C_2$ is given by $f_1 . f_2$ and $C_1 cap C_2$ is given by $f_1^2 + f_2^2$ (or $|f_1| + |f_2|$). So if $C_1$ and $C_2$ can be described by an equation involving absolute values and polynomials, then so do $C_1 cup C_2$ and $C_1 cap C_2$.


          • If $C = {(x,y) in mathbb{R}^2, , f(x,y) ge 0}$, then $C$ is given by the equation $|f|-f$.



          Now, any segment $S$ can be described as $S = {(x,y) in mathbb{R}^2, , a x + b y = c, , x_0 le x le x_1, , y_0 le y le y_1}$, which is given by a single equation by the above principles. And since union of segments also are given by an equation, you get the result.



          EDIT : For the specific case of the octagon of radius $r$, if you denote $s = sin(pi/8)$, $c = cos(pi/8)$, then one segment is given by $|y| le rs$ and $x = rc$, for which an equation is



          $$f(x, y) = left||rs - |y|| - (rs - |y|)right| + |x-rc| = 0$$



          So I think the octagon is given by



          $$f(|x|,|y|) f(|y|,|x|) fleft(frac{|x|+|y|}{sqrt{2}}, frac{|x|-|y|}{sqrt{2}}right) = 0$$



          To get a general formula for a regular polygon of radius $r$ with $n$ sides, denote $c_n = cos(pi/n)$, $s_n = sin(pi/n)$ and



          $$f_n(x+iy) = left||rs_n - |y|| - (rs_n - |y|)right| + |x-rc_n|$$



          then your polygon is given by



          $$prod_{k = 0}^{n-1} f_nleft(e^{-frac{2 i k pi}{n}} (x+iy)right) = 0$$



          Depending on $n$, you can use symmetries to lower the degree a bit (as was done with $n = 8$).






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Hi Joel, can this result be used to generate some equations for regular polygons? tx
            $endgroup$
            – Arjang
            May 29 '11 at 12:40








          • 3




            $begingroup$
            @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
            $endgroup$
            – Joel Cohen
            May 29 '11 at 12:54












          • $begingroup$
            Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:11






          • 1




            $begingroup$
            @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
            $endgroup$
            – Joel Cohen
            May 29 '11 at 16:06










          • $begingroup$
            For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
            $endgroup$
            – lhf
            May 29 '11 at 20:06


















          40












          $begingroup$

          Any polygon (regular or not) can be described by an equation involving only absolute values and polynomials. Here is a small explanation of how to do that.



          Let's say that a curve $C$ is given by the equation $f$ if we have $C = {(x,y) in mathbb{R}^2, , f(x,y) = 0}$.




          • If $C_1$ and $C_2$ are given by $f_1$ and $f_2$ respectively, then $C_1 cup C_2$ is given by $f_1 . f_2$ and $C_1 cap C_2$ is given by $f_1^2 + f_2^2$ (or $|f_1| + |f_2|$). So if $C_1$ and $C_2$ can be described by an equation involving absolute values and polynomials, then so do $C_1 cup C_2$ and $C_1 cap C_2$.


          • If $C = {(x,y) in mathbb{R}^2, , f(x,y) ge 0}$, then $C$ is given by the equation $|f|-f$.



          Now, any segment $S$ can be described as $S = {(x,y) in mathbb{R}^2, , a x + b y = c, , x_0 le x le x_1, , y_0 le y le y_1}$, which is given by a single equation by the above principles. And since union of segments also are given by an equation, you get the result.



          EDIT : For the specific case of the octagon of radius $r$, if you denote $s = sin(pi/8)$, $c = cos(pi/8)$, then one segment is given by $|y| le rs$ and $x = rc$, for which an equation is



          $$f(x, y) = left||rs - |y|| - (rs - |y|)right| + |x-rc| = 0$$



          So I think the octagon is given by



          $$f(|x|,|y|) f(|y|,|x|) fleft(frac{|x|+|y|}{sqrt{2}}, frac{|x|-|y|}{sqrt{2}}right) = 0$$



          To get a general formula for a regular polygon of radius $r$ with $n$ sides, denote $c_n = cos(pi/n)$, $s_n = sin(pi/n)$ and



          $$f_n(x+iy) = left||rs_n - |y|| - (rs_n - |y|)right| + |x-rc_n|$$



          then your polygon is given by



          $$prod_{k = 0}^{n-1} f_nleft(e^{-frac{2 i k pi}{n}} (x+iy)right) = 0$$



          Depending on $n$, you can use symmetries to lower the degree a bit (as was done with $n = 8$).






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Hi Joel, can this result be used to generate some equations for regular polygons? tx
            $endgroup$
            – Arjang
            May 29 '11 at 12:40








          • 3




            $begingroup$
            @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
            $endgroup$
            – Joel Cohen
            May 29 '11 at 12:54












          • $begingroup$
            Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:11






          • 1




            $begingroup$
            @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
            $endgroup$
            – Joel Cohen
            May 29 '11 at 16:06










          • $begingroup$
            For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
            $endgroup$
            – lhf
            May 29 '11 at 20:06
















          40












          40








          40





          $begingroup$

          Any polygon (regular or not) can be described by an equation involving only absolute values and polynomials. Here is a small explanation of how to do that.



          Let's say that a curve $C$ is given by the equation $f$ if we have $C = {(x,y) in mathbb{R}^2, , f(x,y) = 0}$.




          • If $C_1$ and $C_2$ are given by $f_1$ and $f_2$ respectively, then $C_1 cup C_2$ is given by $f_1 . f_2$ and $C_1 cap C_2$ is given by $f_1^2 + f_2^2$ (or $|f_1| + |f_2|$). So if $C_1$ and $C_2$ can be described by an equation involving absolute values and polynomials, then so do $C_1 cup C_2$ and $C_1 cap C_2$.


          • If $C = {(x,y) in mathbb{R}^2, , f(x,y) ge 0}$, then $C$ is given by the equation $|f|-f$.



          Now, any segment $S$ can be described as $S = {(x,y) in mathbb{R}^2, , a x + b y = c, , x_0 le x le x_1, , y_0 le y le y_1}$, which is given by a single equation by the above principles. And since union of segments also are given by an equation, you get the result.



          EDIT : For the specific case of the octagon of radius $r$, if you denote $s = sin(pi/8)$, $c = cos(pi/8)$, then one segment is given by $|y| le rs$ and $x = rc$, for which an equation is



          $$f(x, y) = left||rs - |y|| - (rs - |y|)right| + |x-rc| = 0$$



          So I think the octagon is given by



          $$f(|x|,|y|) f(|y|,|x|) fleft(frac{|x|+|y|}{sqrt{2}}, frac{|x|-|y|}{sqrt{2}}right) = 0$$



          To get a general formula for a regular polygon of radius $r$ with $n$ sides, denote $c_n = cos(pi/n)$, $s_n = sin(pi/n)$ and



          $$f_n(x+iy) = left||rs_n - |y|| - (rs_n - |y|)right| + |x-rc_n|$$



          then your polygon is given by



          $$prod_{k = 0}^{n-1} f_nleft(e^{-frac{2 i k pi}{n}} (x+iy)right) = 0$$



          Depending on $n$, you can use symmetries to lower the degree a bit (as was done with $n = 8$).






          share|cite|improve this answer











          $endgroup$



          Any polygon (regular or not) can be described by an equation involving only absolute values and polynomials. Here is a small explanation of how to do that.



          Let's say that a curve $C$ is given by the equation $f$ if we have $C = {(x,y) in mathbb{R}^2, , f(x,y) = 0}$.




          • If $C_1$ and $C_2$ are given by $f_1$ and $f_2$ respectively, then $C_1 cup C_2$ is given by $f_1 . f_2$ and $C_1 cap C_2$ is given by $f_1^2 + f_2^2$ (or $|f_1| + |f_2|$). So if $C_1$ and $C_2$ can be described by an equation involving absolute values and polynomials, then so do $C_1 cup C_2$ and $C_1 cap C_2$.


          • If $C = {(x,y) in mathbb{R}^2, , f(x,y) ge 0}$, then $C$ is given by the equation $|f|-f$.



          Now, any segment $S$ can be described as $S = {(x,y) in mathbb{R}^2, , a x + b y = c, , x_0 le x le x_1, , y_0 le y le y_1}$, which is given by a single equation by the above principles. And since union of segments also are given by an equation, you get the result.



          EDIT : For the specific case of the octagon of radius $r$, if you denote $s = sin(pi/8)$, $c = cos(pi/8)$, then one segment is given by $|y| le rs$ and $x = rc$, for which an equation is



          $$f(x, y) = left||rs - |y|| - (rs - |y|)right| + |x-rc| = 0$$



          So I think the octagon is given by



          $$f(|x|,|y|) f(|y|,|x|) fleft(frac{|x|+|y|}{sqrt{2}}, frac{|x|-|y|}{sqrt{2}}right) = 0$$



          To get a general formula for a regular polygon of radius $r$ with $n$ sides, denote $c_n = cos(pi/n)$, $s_n = sin(pi/n)$ and



          $$f_n(x+iy) = left||rs_n - |y|| - (rs_n - |y|)right| + |x-rc_n|$$



          then your polygon is given by



          $$prod_{k = 0}^{n-1} f_nleft(e^{-frac{2 i k pi}{n}} (x+iy)right) = 0$$



          Depending on $n$, you can use symmetries to lower the degree a bit (as was done with $n = 8$).







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited May 29 '11 at 17:10

























          answered May 29 '11 at 12:29









          Joel CohenJoel Cohen

          7,44412238




          7,44412238












          • $begingroup$
            Hi Joel, can this result be used to generate some equations for regular polygons? tx
            $endgroup$
            – Arjang
            May 29 '11 at 12:40








          • 3




            $begingroup$
            @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
            $endgroup$
            – Joel Cohen
            May 29 '11 at 12:54












          • $begingroup$
            Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:11






          • 1




            $begingroup$
            @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
            $endgroup$
            – Joel Cohen
            May 29 '11 at 16:06










          • $begingroup$
            For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
            $endgroup$
            – lhf
            May 29 '11 at 20:06




















          • $begingroup$
            Hi Joel, can this result be used to generate some equations for regular polygons? tx
            $endgroup$
            – Arjang
            May 29 '11 at 12:40








          • 3




            $begingroup$
            @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
            $endgroup$
            – Joel Cohen
            May 29 '11 at 12:54












          • $begingroup$
            Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:11






          • 1




            $begingroup$
            @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
            $endgroup$
            – Joel Cohen
            May 29 '11 at 16:06










          • $begingroup$
            For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
            $endgroup$
            – lhf
            May 29 '11 at 20:06


















          $begingroup$
          Hi Joel, can this result be used to generate some equations for regular polygons? tx
          $endgroup$
          – Arjang
          May 29 '11 at 12:40






          $begingroup$
          Hi Joel, can this result be used to generate some equations for regular polygons? tx
          $endgroup$
          – Arjang
          May 29 '11 at 12:40






          3




          3




          $begingroup$
          @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
          $endgroup$
          – Joel Cohen
          May 29 '11 at 12:54






          $begingroup$
          @Arjang : Yes, I think this principle gives you a single equation for polygons. In fact more generally, if you have a set that is described by any number of inequalities, linked by any number of logical "and" and "or", you can write it in a single equation.
          $endgroup$
          – Joel Cohen
          May 29 '11 at 12:54














          $begingroup$
          Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
          $endgroup$
          – Vincent Tan
          May 29 '11 at 15:11




          $begingroup$
          Hi Joel, can an equation be formulated that depends on the number of sides of a polygon? The mathematical formulation is sound. It's just that as the number of sides go up, the equation gets a lot of unions tacked on.
          $endgroup$
          – Vincent Tan
          May 29 '11 at 15:11




          1




          1




          $begingroup$
          @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
          $endgroup$
          – Joel Cohen
          May 29 '11 at 16:06




          $begingroup$
          @ Vincent : I added a general formula for any $n$ in the answer (not sure if that is what you're looking for).
          $endgroup$
          – Joel Cohen
          May 29 '11 at 16:06












          $begingroup$
          For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
          $endgroup$
          – lhf
          May 29 '11 at 20:06






          $begingroup$
          For an algorithm for getting a boolean formula for a polygon, see An efficient algorithm for finding the CSG representation of a simple polygon.
          $endgroup$
          – lhf
          May 29 '11 at 20:06













          28












          $begingroup$

          Here's a parametric equation I have made for a regular $n$-gon, coded in R:



          n=5;
          theta=(0:999)/1000;
          r=cos(pi/n)/cos(2*pi*(n*theta)%%1/n-pi/n);
          plot(r*cos(2*pi*theta),r*sin(2*pi*theta),asp=1,xlab="X",ylab="Y",
          main=paste("Regular ",n,"-gon",sep=""));


          And picture:



          5-gon



          The formula I used is



          $$displaystyle r=frac{cosleft(frac{pi}{n}right)}{cosleft(left(theta mod frac{2pi}{n}right) -frac{pi}{n}right)} ; .$$



          This equation is actually just the polar equation for the line through the point $(1,0)$ and $(cos(2pi/n),sin(2pi/n))$ which contains one of the edges. By restricting the range of the variable $theta$ to the interval $[0,2pi/n[$, you will in fact just get that edge. Now, we want to replicate that edge by rotating it repeatedly through an angle $2pi/n$ to get the full polygon. But this can also be achieved by using the modulus function and reducing all angles to the interval $[0,2pi/n[$. This way, you get the polar equation I propose.



          So, using polar plots and the modulo function, it's pretty easy to make regular $n$-gons.






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Hi Raskolnikov, can you explain how you got (or derived) that formula?
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:15










          • $begingroup$
            @Vincent Tan: I added a short explanation.
            $endgroup$
            – Raskolnikov
            May 29 '11 at 15:39










          • $begingroup$
            I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
            $endgroup$
            – J. M. is not a mathematician
            Jul 29 '11 at 4:35






          • 1




            $begingroup$
            Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
            $endgroup$
            – murkle
            Sep 22 '14 at 9:06


















          28












          $begingroup$

          Here's a parametric equation I have made for a regular $n$-gon, coded in R:



          n=5;
          theta=(0:999)/1000;
          r=cos(pi/n)/cos(2*pi*(n*theta)%%1/n-pi/n);
          plot(r*cos(2*pi*theta),r*sin(2*pi*theta),asp=1,xlab="X",ylab="Y",
          main=paste("Regular ",n,"-gon",sep=""));


          And picture:



          5-gon



          The formula I used is



          $$displaystyle r=frac{cosleft(frac{pi}{n}right)}{cosleft(left(theta mod frac{2pi}{n}right) -frac{pi}{n}right)} ; .$$



          This equation is actually just the polar equation for the line through the point $(1,0)$ and $(cos(2pi/n),sin(2pi/n))$ which contains one of the edges. By restricting the range of the variable $theta$ to the interval $[0,2pi/n[$, you will in fact just get that edge. Now, we want to replicate that edge by rotating it repeatedly through an angle $2pi/n$ to get the full polygon. But this can also be achieved by using the modulus function and reducing all angles to the interval $[0,2pi/n[$. This way, you get the polar equation I propose.



          So, using polar plots and the modulo function, it's pretty easy to make regular $n$-gons.






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Hi Raskolnikov, can you explain how you got (or derived) that formula?
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:15










          • $begingroup$
            @Vincent Tan: I added a short explanation.
            $endgroup$
            – Raskolnikov
            May 29 '11 at 15:39










          • $begingroup$
            I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
            $endgroup$
            – J. M. is not a mathematician
            Jul 29 '11 at 4:35






          • 1




            $begingroup$
            Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
            $endgroup$
            – murkle
            Sep 22 '14 at 9:06
















          28












          28








          28





          $begingroup$

          Here's a parametric equation I have made for a regular $n$-gon, coded in R:



          n=5;
          theta=(0:999)/1000;
          r=cos(pi/n)/cos(2*pi*(n*theta)%%1/n-pi/n);
          plot(r*cos(2*pi*theta),r*sin(2*pi*theta),asp=1,xlab="X",ylab="Y",
          main=paste("Regular ",n,"-gon",sep=""));


          And picture:



          5-gon



          The formula I used is



          $$displaystyle r=frac{cosleft(frac{pi}{n}right)}{cosleft(left(theta mod frac{2pi}{n}right) -frac{pi}{n}right)} ; .$$



          This equation is actually just the polar equation for the line through the point $(1,0)$ and $(cos(2pi/n),sin(2pi/n))$ which contains one of the edges. By restricting the range of the variable $theta$ to the interval $[0,2pi/n[$, you will in fact just get that edge. Now, we want to replicate that edge by rotating it repeatedly through an angle $2pi/n$ to get the full polygon. But this can also be achieved by using the modulus function and reducing all angles to the interval $[0,2pi/n[$. This way, you get the polar equation I propose.



          So, using polar plots and the modulo function, it's pretty easy to make regular $n$-gons.






          share|cite|improve this answer











          $endgroup$



          Here's a parametric equation I have made for a regular $n$-gon, coded in R:



          n=5;
          theta=(0:999)/1000;
          r=cos(pi/n)/cos(2*pi*(n*theta)%%1/n-pi/n);
          plot(r*cos(2*pi*theta),r*sin(2*pi*theta),asp=1,xlab="X",ylab="Y",
          main=paste("Regular ",n,"-gon",sep=""));


          And picture:



          5-gon



          The formula I used is



          $$displaystyle r=frac{cosleft(frac{pi}{n}right)}{cosleft(left(theta mod frac{2pi}{n}right) -frac{pi}{n}right)} ; .$$



          This equation is actually just the polar equation for the line through the point $(1,0)$ and $(cos(2pi/n),sin(2pi/n))$ which contains one of the edges. By restricting the range of the variable $theta$ to the interval $[0,2pi/n[$, you will in fact just get that edge. Now, we want to replicate that edge by rotating it repeatedly through an angle $2pi/n$ to get the full polygon. But this can also be achieved by using the modulus function and reducing all angles to the interval $[0,2pi/n[$. This way, you get the polar equation I propose.



          So, using polar plots and the modulo function, it's pretty easy to make regular $n$-gons.







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Jun 18 '16 at 8:17









          J. M. is not a mathematician

          61.2k5152290




          61.2k5152290










          answered May 29 '11 at 13:26









          RaskolnikovRaskolnikov

          12.6k23571




          12.6k23571












          • $begingroup$
            Hi Raskolnikov, can you explain how you got (or derived) that formula?
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:15










          • $begingroup$
            @Vincent Tan: I added a short explanation.
            $endgroup$
            – Raskolnikov
            May 29 '11 at 15:39










          • $begingroup$
            I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
            $endgroup$
            – J. M. is not a mathematician
            Jul 29 '11 at 4:35






          • 1




            $begingroup$
            Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
            $endgroup$
            – murkle
            Sep 22 '14 at 9:06




















          • $begingroup$
            Hi Raskolnikov, can you explain how you got (or derived) that formula?
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:15










          • $begingroup$
            @Vincent Tan: I added a short explanation.
            $endgroup$
            – Raskolnikov
            May 29 '11 at 15:39










          • $begingroup$
            I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
            $endgroup$
            – J. M. is not a mathematician
            Jul 29 '11 at 4:35






          • 1




            $begingroup$
            Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
            $endgroup$
            – murkle
            Sep 22 '14 at 9:06


















          $begingroup$
          Hi Raskolnikov, can you explain how you got (or derived) that formula?
          $endgroup$
          – Vincent Tan
          May 29 '11 at 15:15




          $begingroup$
          Hi Raskolnikov, can you explain how you got (or derived) that formula?
          $endgroup$
          – Vincent Tan
          May 29 '11 at 15:15












          $begingroup$
          @Vincent Tan: I added a short explanation.
          $endgroup$
          – Raskolnikov
          May 29 '11 at 15:39




          $begingroup$
          @Vincent Tan: I added a short explanation.
          $endgroup$
          – Raskolnikov
          May 29 '11 at 15:39












          $begingroup$
          I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
          $endgroup$
          – J. M. is not a mathematician
          Jul 29 '11 at 4:35




          $begingroup$
          I think this looks neater than Joel's construct. Too bad this isn't the accepted answer...
          $endgroup$
          – J. M. is not a mathematician
          Jul 29 '11 at 4:35




          1




          1




          $begingroup$
          Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
          $endgroup$
          – murkle
          Sep 22 '14 at 9:06






          $begingroup$
          Here's an interactive demo of Raskolnikov's answer: geogebratube.org/student/m157867
          $endgroup$
          – murkle
          Sep 22 '14 at 9:06













          11












          $begingroup$

          Here is another parametric equation for a regular $n$-gon with unit radius:



          $$begin{align*}x&=cosleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)-(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\y&=cosleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)+(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{align*}$$



          for $0 leq u leq n$.



          The provenance of this set is a bit more transparent if we switch to matrix-vector notation:



          $$begin{pmatrix}cosleft(frac{pi}{n}(2lfloor urfloor+1)right)&-sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\sinleft(frac{pi}{n}(2lfloor urfloor+1)right)&cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{pmatrix}begin{pmatrix}cosleft(frac{pi}{n}right)\(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)end{pmatrix}$$



          and we see that the construction involves rotating and copying the line segment joining the points $(cosleft(frac{pi}{n}right),pmsinleft(frac{pi}{n}right))$ $n$ times around a circle.





          Here's sundry Mathematica code:



          GraphicsGrid[Partition[Table[
          ParametricPlot[Through[{Re, Im}[
          (Cos[Pi/n] + I (2u - 2 Floor[u] - 1)Sin[Pi/n])*
          Exp[(I Pi/n) (2 Floor[u] + 1)]],
          {u, 0, n}], {n, 3, 11}], 3]]


          regular polygons, 3-11






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Do you have a citation for equation? (How you got in this equation?)
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 17:49










          • $begingroup$
            No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 17:52






          • 1




            $begingroup$
            I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 18:06






          • 2




            $begingroup$
            Sure, as long as you give attribution of course (per SE rules). :)
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 18:38










          • $begingroup$
            BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
            $endgroup$
            – J. M. is not a mathematician
            Jul 30 '16 at 12:57
















          11












          $begingroup$

          Here is another parametric equation for a regular $n$-gon with unit radius:



          $$begin{align*}x&=cosleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)-(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\y&=cosleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)+(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{align*}$$



          for $0 leq u leq n$.



          The provenance of this set is a bit more transparent if we switch to matrix-vector notation:



          $$begin{pmatrix}cosleft(frac{pi}{n}(2lfloor urfloor+1)right)&-sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\sinleft(frac{pi}{n}(2lfloor urfloor+1)right)&cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{pmatrix}begin{pmatrix}cosleft(frac{pi}{n}right)\(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)end{pmatrix}$$



          and we see that the construction involves rotating and copying the line segment joining the points $(cosleft(frac{pi}{n}right),pmsinleft(frac{pi}{n}right))$ $n$ times around a circle.





          Here's sundry Mathematica code:



          GraphicsGrid[Partition[Table[
          ParametricPlot[Through[{Re, Im}[
          (Cos[Pi/n] + I (2u - 2 Floor[u] - 1)Sin[Pi/n])*
          Exp[(I Pi/n) (2 Floor[u] + 1)]],
          {u, 0, n}], {n, 3, 11}], 3]]


          regular polygons, 3-11






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Do you have a citation for equation? (How you got in this equation?)
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 17:49










          • $begingroup$
            No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 17:52






          • 1




            $begingroup$
            I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 18:06






          • 2




            $begingroup$
            Sure, as long as you give attribution of course (per SE rules). :)
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 18:38










          • $begingroup$
            BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
            $endgroup$
            – J. M. is not a mathematician
            Jul 30 '16 at 12:57














          11












          11








          11





          $begingroup$

          Here is another parametric equation for a regular $n$-gon with unit radius:



          $$begin{align*}x&=cosleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)-(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\y&=cosleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)+(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{align*}$$



          for $0 leq u leq n$.



          The provenance of this set is a bit more transparent if we switch to matrix-vector notation:



          $$begin{pmatrix}cosleft(frac{pi}{n}(2lfloor urfloor+1)right)&-sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\sinleft(frac{pi}{n}(2lfloor urfloor+1)right)&cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{pmatrix}begin{pmatrix}cosleft(frac{pi}{n}right)\(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)end{pmatrix}$$



          and we see that the construction involves rotating and copying the line segment joining the points $(cosleft(frac{pi}{n}right),pmsinleft(frac{pi}{n}right))$ $n$ times around a circle.





          Here's sundry Mathematica code:



          GraphicsGrid[Partition[Table[
          ParametricPlot[Through[{Re, Im}[
          (Cos[Pi/n] + I (2u - 2 Floor[u] - 1)Sin[Pi/n])*
          Exp[(I Pi/n) (2 Floor[u] + 1)]],
          {u, 0, n}], {n, 3, 11}], 3]]


          regular polygons, 3-11






          share|cite|improve this answer









          $endgroup$



          Here is another parametric equation for a regular $n$-gon with unit radius:



          $$begin{align*}x&=cosleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)-(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\y&=cosleft(frac{pi}{n}right)sinleft(frac{pi}{n}(2lfloor urfloor+1)right)+(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{align*}$$



          for $0 leq u leq n$.



          The provenance of this set is a bit more transparent if we switch to matrix-vector notation:



          $$begin{pmatrix}cosleft(frac{pi}{n}(2lfloor urfloor+1)right)&-sinleft(frac{pi}{n}(2lfloor urfloor+1)right)\sinleft(frac{pi}{n}(2lfloor urfloor+1)right)&cosleft(frac{pi}{n}(2lfloor urfloor+1)right)end{pmatrix}begin{pmatrix}cosleft(frac{pi}{n}right)\(2u-2lfloor urfloor-1)sinleft(frac{pi}{n}right)end{pmatrix}$$



          and we see that the construction involves rotating and copying the line segment joining the points $(cosleft(frac{pi}{n}right),pmsinleft(frac{pi}{n}right))$ $n$ times around a circle.





          Here's sundry Mathematica code:



          GraphicsGrid[Partition[Table[
          ParametricPlot[Through[{Re, Im}[
          (Cos[Pi/n] + I (2u - 2 Floor[u] - 1)Sin[Pi/n])*
          Exp[(I Pi/n) (2 Floor[u] + 1)]],
          {u, 0, n}], {n, 3, 11}], 3]]


          regular polygons, 3-11







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Oct 4 '11 at 16:08









          J. M. is not a mathematicianJ. M. is not a mathematician

          61.2k5152290




          61.2k5152290












          • $begingroup$
            Do you have a citation for equation? (How you got in this equation?)
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 17:49










          • $begingroup$
            No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 17:52






          • 1




            $begingroup$
            I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 18:06






          • 2




            $begingroup$
            Sure, as long as you give attribution of course (per SE rules). :)
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 18:38










          • $begingroup$
            BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
            $endgroup$
            – J. M. is not a mathematician
            Jul 30 '16 at 12:57


















          • $begingroup$
            Do you have a citation for equation? (How you got in this equation?)
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 17:49










          • $begingroup$
            No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 17:52






          • 1




            $begingroup$
            I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
            $endgroup$
            – Wagner Jorge
            May 22 '16 at 18:06






          • 2




            $begingroup$
            Sure, as long as you give attribution of course (per SE rules). :)
            $endgroup$
            – J. M. is not a mathematician
            May 22 '16 at 18:38










          • $begingroup$
            BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
            $endgroup$
            – J. M. is not a mathematician
            Jul 30 '16 at 12:57
















          $begingroup$
          Do you have a citation for equation? (How you got in this equation?)
          $endgroup$
          – Wagner Jorge
          May 22 '16 at 17:49




          $begingroup$
          Do you have a citation for equation? (How you got in this equation?)
          $endgroup$
          – Wagner Jorge
          May 22 '16 at 17:49












          $begingroup$
          No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
          $endgroup$
          – J. M. is not a mathematician
          May 22 '16 at 17:52




          $begingroup$
          No citation, @Wagner; I derived it myself. I believe I already explained how I obtained it.
          $endgroup$
          – J. M. is not a mathematician
          May 22 '16 at 17:52




          1




          1




          $begingroup$
          I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
          $endgroup$
          – Wagner Jorge
          May 22 '16 at 18:06




          $begingroup$
          I am writing a dissertation and your equation help me so much, but not is my. Can I use it?
          $endgroup$
          – Wagner Jorge
          May 22 '16 at 18:06




          2




          2




          $begingroup$
          Sure, as long as you give attribution of course (per SE rules). :)
          $endgroup$
          – J. M. is not a mathematician
          May 22 '16 at 18:38




          $begingroup$
          Sure, as long as you give attribution of course (per SE rules). :)
          $endgroup$
          – J. M. is not a mathematician
          May 22 '16 at 18:38












          $begingroup$
          BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
          $endgroup$
          – J. M. is not a mathematician
          Jul 30 '16 at 12:57




          $begingroup$
          BTW, if it was truly helpful, I'd appreciate seeing the dissertation myself.
          $endgroup$
          – J. M. is not a mathematician
          Jul 30 '16 at 12:57











          8












          $begingroup$

          The following is probably not in the spirit of the game, but what about a parametric equation? If we are willing to use complex numbers to represent points in the plane, we could use
          $$z=texp(2pi ik/n) +(1-t)exp(2pi i(k+1)/n),qquad 0 le t<1,quad k=0, 1, dots, n-1$$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:21
















          8












          $begingroup$

          The following is probably not in the spirit of the game, but what about a parametric equation? If we are willing to use complex numbers to represent points in the plane, we could use
          $$z=texp(2pi ik/n) +(1-t)exp(2pi i(k+1)/n),qquad 0 le t<1,quad k=0, 1, dots, n-1$$






          share|cite|improve this answer











          $endgroup$













          • $begingroup$
            Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:21














          8












          8








          8





          $begingroup$

          The following is probably not in the spirit of the game, but what about a parametric equation? If we are willing to use complex numbers to represent points in the plane, we could use
          $$z=texp(2pi ik/n) +(1-t)exp(2pi i(k+1)/n),qquad 0 le t<1,quad k=0, 1, dots, n-1$$






          share|cite|improve this answer











          $endgroup$



          The following is probably not in the spirit of the game, but what about a parametric equation? If we are willing to use complex numbers to represent points in the plane, we could use
          $$z=texp(2pi ik/n) +(1-t)exp(2pi i(k+1)/n),qquad 0 le t<1,quad k=0, 1, dots, n-1$$







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited May 29 '11 at 15:07

























          answered May 29 '11 at 14:52









          André NicolasAndré Nicolas

          455k36432821




          455k36432821












          • $begingroup$
            Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:21


















          • $begingroup$
            Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
            $endgroup$
            – Vincent Tan
            May 29 '11 at 15:21
















          $begingroup$
          Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
          $endgroup$
          – Vincent Tan
          May 29 '11 at 15:21




          $begingroup$
          Parametric equations are fine. We can broaden the scope so that if a few equations are needed, that's still fine. But only as many as needed. For example, in 2D Cartesian, if 2 equations can completely represent a polygon (probably corresponding to x and y), then it's still usable.
          $endgroup$
          – Vincent Tan
          May 29 '11 at 15:21











          1












          $begingroup$

          Simply enough:



          r(θ) = sec(θ%(π/n')-π/n)



          When n' = n/2 and % is the modulus operator.



          It would work just as well with cosecant as with secant.



          Also the apothem would be 1 and the radius sec(-π/n).






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            What is the difference between this and Raskolnikov's answer?
            $endgroup$
            – J. M. is not a mathematician
            Aug 17 '15 at 7:53
















          1












          $begingroup$

          Simply enough:



          r(θ) = sec(θ%(π/n')-π/n)



          When n' = n/2 and % is the modulus operator.



          It would work just as well with cosecant as with secant.



          Also the apothem would be 1 and the radius sec(-π/n).






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            What is the difference between this and Raskolnikov's answer?
            $endgroup$
            – J. M. is not a mathematician
            Aug 17 '15 at 7:53














          1












          1








          1





          $begingroup$

          Simply enough:



          r(θ) = sec(θ%(π/n')-π/n)



          When n' = n/2 and % is the modulus operator.



          It would work just as well with cosecant as with secant.



          Also the apothem would be 1 and the radius sec(-π/n).






          share|cite|improve this answer









          $endgroup$



          Simply enough:



          r(θ) = sec(θ%(π/n')-π/n)



          When n' = n/2 and % is the modulus operator.



          It would work just as well with cosecant as with secant.



          Also the apothem would be 1 and the radius sec(-π/n).







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Mar 25 '14 at 19:10









          that one guythat one guy

          111




          111












          • $begingroup$
            What is the difference between this and Raskolnikov's answer?
            $endgroup$
            – J. M. is not a mathematician
            Aug 17 '15 at 7:53


















          • $begingroup$
            What is the difference between this and Raskolnikov's answer?
            $endgroup$
            – J. M. is not a mathematician
            Aug 17 '15 at 7:53
















          $begingroup$
          What is the difference between this and Raskolnikov's answer?
          $endgroup$
          – J. M. is not a mathematician
          Aug 17 '15 at 7:53




          $begingroup$
          What is the difference between this and Raskolnikov's answer?
          $endgroup$
          – J. M. is not a mathematician
          Aug 17 '15 at 7:53











          1












          $begingroup$

          $arcsin left(sin left(left[sin left(60cdot frac{pi }{180}right)left(frac{sqrt{3}}{3}cdot x+yright),xright]right)right)+left(frac{1}{3}right)cdot arcsin left(sin left(left[cos left(30cdot frac{pi }{180}right)left(x-frac{sqrt{3}}{3}yright),yright]cdot sqrt{3}right)right)=0$



          https://www.desmos.com/calculator/yptmqucuwl



          I came up with this to plot a hexagon tessellation in desmos....the [list] funct "hides" the overlay ...so it isn't really a single EQ.....actually there was very little info on this.....took me weeks....enjoy






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Very clever! (+1)
            $endgroup$
            – hypergeometric
            Jan 10 at 18:03
















          1












          $begingroup$

          $arcsin left(sin left(left[sin left(60cdot frac{pi }{180}right)left(frac{sqrt{3}}{3}cdot x+yright),xright]right)right)+left(frac{1}{3}right)cdot arcsin left(sin left(left[cos left(30cdot frac{pi }{180}right)left(x-frac{sqrt{3}}{3}yright),yright]cdot sqrt{3}right)right)=0$



          https://www.desmos.com/calculator/yptmqucuwl



          I came up with this to plot a hexagon tessellation in desmos....the [list] funct "hides" the overlay ...so it isn't really a single EQ.....actually there was very little info on this.....took me weeks....enjoy






          share|cite|improve this answer









          $endgroup$













          • $begingroup$
            Very clever! (+1)
            $endgroup$
            – hypergeometric
            Jan 10 at 18:03














          1












          1








          1





          $begingroup$

          $arcsin left(sin left(left[sin left(60cdot frac{pi }{180}right)left(frac{sqrt{3}}{3}cdot x+yright),xright]right)right)+left(frac{1}{3}right)cdot arcsin left(sin left(left[cos left(30cdot frac{pi }{180}right)left(x-frac{sqrt{3}}{3}yright),yright]cdot sqrt{3}right)right)=0$



          https://www.desmos.com/calculator/yptmqucuwl



          I came up with this to plot a hexagon tessellation in desmos....the [list] funct "hides" the overlay ...so it isn't really a single EQ.....actually there was very little info on this.....took me weeks....enjoy






          share|cite|improve this answer









          $endgroup$



          $arcsin left(sin left(left[sin left(60cdot frac{pi }{180}right)left(frac{sqrt{3}}{3}cdot x+yright),xright]right)right)+left(frac{1}{3}right)cdot arcsin left(sin left(left[cos left(30cdot frac{pi }{180}right)left(x-frac{sqrt{3}}{3}yright),yright]cdot sqrt{3}right)right)=0$



          https://www.desmos.com/calculator/yptmqucuwl



          I came up with this to plot a hexagon tessellation in desmos....the [list] funct "hides" the overlay ...so it isn't really a single EQ.....actually there was very little info on this.....took me weeks....enjoy







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered May 27 '15 at 3:16









          JoeBJoeB

          111




          111












          • $begingroup$
            Very clever! (+1)
            $endgroup$
            – hypergeometric
            Jan 10 at 18:03


















          • $begingroup$
            Very clever! (+1)
            $endgroup$
            – hypergeometric
            Jan 10 at 18:03
















          $begingroup$
          Very clever! (+1)
          $endgroup$
          – hypergeometric
          Jan 10 at 18:03




          $begingroup$
          Very clever! (+1)
          $endgroup$
          – hypergeometric
          Jan 10 at 18:03











          0












          $begingroup$

          Reposted from PolymathProgrammer.com, my answer to my own initial query. Generated mostly on my own after some initial help from a friend (Jason Schmurr) and my dad (Russell Gmirkin)





          I believe I've solved my own inquiry. The following are functions that, when graphed in polar coordinates render lovely polygons.



          In fact, I’ve got 3 versions (6 if you consider rotation a factor; to either align a vertex or the midpoint of a side with $theta=0$). One with circumradius = 1 (as vertices $to infty$, polygons expand outward toward the circumscribed circle), one with apothem = 1 (as vertices $to infty$, polygons collapse inward toward the inscribed circle) and one with the midpoint between circumradius & apothem = 1 (as vertices $to infty$, both the maxima and minima, thus the circumscribed and inscribed circles, collapse toward that ‘midpoint radius’).



          I’d be interested to know whether this approach, describing the radius of a polygon as a periodic function, has any precedent (has anyone else done this, or am I the first)? I’ve been working on this idea for some time (on and off for years), but just recently overcame some stumbling blocks with a little help from a friend and my dad. Most of the legwork was my own, though.



          The relatively final form(s) appear to be:



          (n-gon, circumradius=1, unrotated)
          1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



          (n-gon, circumradius=1, rotated $-pi/4$)
          1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



          (n-gon, function centered around unit circle, unrotated)
          ((Sec[Pi/v]+1)/2)/(((Sec[Pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



          (n-gon, function centered around unit circle, rotated $-pi/4$)
          ((Sec[Pi/v]+1)/2)/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



          (n-gon, apothem=1, unrotated)
          Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



          (n-gon, apothem=1, rotated $-pi/4$)
          Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



          Don’t know whether they simplify at all to something less complicated… Even if not, they’re beauties!



          Examples:



          3-gon: here



          4-gon: here



          5-gon: here



          If it's a unique solution and I'm first to it, I submit these as the Gmirkin Polygon Radius Function(s) (or some suitably nifty sounding name that’s not too cumbersome). *Smile* Heh.



          I may write them up formally for publication at some point, once a few previous engagements clear up, assuming they’ve not previously been published or some directly correlated function has already been published elsewhere. (If so, I’d like to know when, where and by whom; for academic curiosity’s sake.)



          It is my belief that a similar function exists for describing 3D Polyhedrons of some description(s). Though, I have not yet even attempted such a case and will probably stick to 2D cases for now. I can also tell you that if you vary the phase shift of the denominator [Abs[Cos]] terms by differing amounts (though not both by some multiple of $pi/4$, $pi/2$, etc.), you can also reproduce rectangles, isosceles triangles, etc. In some cases you can also generate diamond shapes by varying some other parameters. It's s surprisingly robust solution, as I'd hoped. Lord knows it's taken me a few years of false starts to get at the correct combination of functions. Though, I learned plenty along the way, much of which helped me generalize to all polygons from the square case a friend solved at my behest a week or two ago.



          Here's hoping this is an interesting, unique new solution that's viable and notable. (One can hope!)



          Sorry the post is a bit lengthy... ;)



          Best,

          ~Michael Gmirkin





          Edit:



          Sorry. Jumped the gun slightly.



          I retract the above equations. At the behest of someone on another site, I checked in Wolfram Alpha at a few data points. While it appears to work for the Square case (where the coefficients and corrective term basically cancel out), it doesn't work for other cases, but is slightly off. I think I've got the coefficients wrong. Will have to poke around a bit more in the maths to see if it's possible to get a technically correct exact solution.



          The graphs were so close as to fool me into thinking they were exact for all cases. Will get back to you if/when I get a technically correct solution. 'Til then... I still believe there is a valid function, since the Square case is technically correct @ 1/(Abs[Sin(x)]+Abs[Cos[x]]) or 1/(Abs[Cos[x]]+[Abs[Cos[x-(Pi/2)]]]). Just need the technically correct coefficient... will work on it as I've got some time. But, for now, the incorrect versions are darned close! ;o) Enough to fool most people (including me, apparently).






          share|cite|improve this answer











          $endgroup$


















            0












            $begingroup$

            Reposted from PolymathProgrammer.com, my answer to my own initial query. Generated mostly on my own after some initial help from a friend (Jason Schmurr) and my dad (Russell Gmirkin)





            I believe I've solved my own inquiry. The following are functions that, when graphed in polar coordinates render lovely polygons.



            In fact, I’ve got 3 versions (6 if you consider rotation a factor; to either align a vertex or the midpoint of a side with $theta=0$). One with circumradius = 1 (as vertices $to infty$, polygons expand outward toward the circumscribed circle), one with apothem = 1 (as vertices $to infty$, polygons collapse inward toward the inscribed circle) and one with the midpoint between circumradius & apothem = 1 (as vertices $to infty$, both the maxima and minima, thus the circumscribed and inscribed circles, collapse toward that ‘midpoint radius’).



            I’d be interested to know whether this approach, describing the radius of a polygon as a periodic function, has any precedent (has anyone else done this, or am I the first)? I’ve been working on this idea for some time (on and off for years), but just recently overcame some stumbling blocks with a little help from a friend and my dad. Most of the legwork was my own, though.



            The relatively final form(s) appear to be:



            (n-gon, circumradius=1, unrotated)
            1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



            (n-gon, circumradius=1, rotated $-pi/4$)
            1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



            (n-gon, function centered around unit circle, unrotated)
            ((Sec[Pi/v]+1)/2)/(((Sec[Pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



            (n-gon, function centered around unit circle, rotated $-pi/4$)
            ((Sec[Pi/v]+1)/2)/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



            (n-gon, apothem=1, unrotated)
            Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



            (n-gon, apothem=1, rotated $-pi/4$)
            Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



            Don’t know whether they simplify at all to something less complicated… Even if not, they’re beauties!



            Examples:



            3-gon: here



            4-gon: here



            5-gon: here



            If it's a unique solution and I'm first to it, I submit these as the Gmirkin Polygon Radius Function(s) (or some suitably nifty sounding name that’s not too cumbersome). *Smile* Heh.



            I may write them up formally for publication at some point, once a few previous engagements clear up, assuming they’ve not previously been published or some directly correlated function has already been published elsewhere. (If so, I’d like to know when, where and by whom; for academic curiosity’s sake.)



            It is my belief that a similar function exists for describing 3D Polyhedrons of some description(s). Though, I have not yet even attempted such a case and will probably stick to 2D cases for now. I can also tell you that if you vary the phase shift of the denominator [Abs[Cos]] terms by differing amounts (though not both by some multiple of $pi/4$, $pi/2$, etc.), you can also reproduce rectangles, isosceles triangles, etc. In some cases you can also generate diamond shapes by varying some other parameters. It's s surprisingly robust solution, as I'd hoped. Lord knows it's taken me a few years of false starts to get at the correct combination of functions. Though, I learned plenty along the way, much of which helped me generalize to all polygons from the square case a friend solved at my behest a week or two ago.



            Here's hoping this is an interesting, unique new solution that's viable and notable. (One can hope!)



            Sorry the post is a bit lengthy... ;)



            Best,

            ~Michael Gmirkin





            Edit:



            Sorry. Jumped the gun slightly.



            I retract the above equations. At the behest of someone on another site, I checked in Wolfram Alpha at a few data points. While it appears to work for the Square case (where the coefficients and corrective term basically cancel out), it doesn't work for other cases, but is slightly off. I think I've got the coefficients wrong. Will have to poke around a bit more in the maths to see if it's possible to get a technically correct exact solution.



            The graphs were so close as to fool me into thinking they were exact for all cases. Will get back to you if/when I get a technically correct solution. 'Til then... I still believe there is a valid function, since the Square case is technically correct @ 1/(Abs[Sin(x)]+Abs[Cos[x]]) or 1/(Abs[Cos[x]]+[Abs[Cos[x-(Pi/2)]]]). Just need the technically correct coefficient... will work on it as I've got some time. But, for now, the incorrect versions are darned close! ;o) Enough to fool most people (including me, apparently).






            share|cite|improve this answer











            $endgroup$
















              0












              0








              0





              $begingroup$

              Reposted from PolymathProgrammer.com, my answer to my own initial query. Generated mostly on my own after some initial help from a friend (Jason Schmurr) and my dad (Russell Gmirkin)





              I believe I've solved my own inquiry. The following are functions that, when graphed in polar coordinates render lovely polygons.



              In fact, I’ve got 3 versions (6 if you consider rotation a factor; to either align a vertex or the midpoint of a side with $theta=0$). One with circumradius = 1 (as vertices $to infty$, polygons expand outward toward the circumscribed circle), one with apothem = 1 (as vertices $to infty$, polygons collapse inward toward the inscribed circle) and one with the midpoint between circumradius & apothem = 1 (as vertices $to infty$, both the maxima and minima, thus the circumscribed and inscribed circles, collapse toward that ‘midpoint radius’).



              I’d be interested to know whether this approach, describing the radius of a polygon as a periodic function, has any precedent (has anyone else done this, or am I the first)? I’ve been working on this idea for some time (on and off for years), but just recently overcame some stumbling blocks with a little help from a friend and my dad. Most of the legwork was my own, though.



              The relatively final form(s) appear to be:



              (n-gon, circumradius=1, unrotated)
              1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, circumradius=1, rotated $-pi/4$)
              1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, function centered around unit circle, unrotated)
              ((Sec[Pi/v]+1)/2)/(((Sec[Pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, function centered around unit circle, rotated $-pi/4$)
              ((Sec[Pi/v]+1)/2)/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, apothem=1, unrotated)
              Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, apothem=1, rotated $-pi/4$)
              Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              Don’t know whether they simplify at all to something less complicated… Even if not, they’re beauties!



              Examples:



              3-gon: here



              4-gon: here



              5-gon: here



              If it's a unique solution and I'm first to it, I submit these as the Gmirkin Polygon Radius Function(s) (or some suitably nifty sounding name that’s not too cumbersome). *Smile* Heh.



              I may write them up formally for publication at some point, once a few previous engagements clear up, assuming they’ve not previously been published or some directly correlated function has already been published elsewhere. (If so, I’d like to know when, where and by whom; for academic curiosity’s sake.)



              It is my belief that a similar function exists for describing 3D Polyhedrons of some description(s). Though, I have not yet even attempted such a case and will probably stick to 2D cases for now. I can also tell you that if you vary the phase shift of the denominator [Abs[Cos]] terms by differing amounts (though not both by some multiple of $pi/4$, $pi/2$, etc.), you can also reproduce rectangles, isosceles triangles, etc. In some cases you can also generate diamond shapes by varying some other parameters. It's s surprisingly robust solution, as I'd hoped. Lord knows it's taken me a few years of false starts to get at the correct combination of functions. Though, I learned plenty along the way, much of which helped me generalize to all polygons from the square case a friend solved at my behest a week or two ago.



              Here's hoping this is an interesting, unique new solution that's viable and notable. (One can hope!)



              Sorry the post is a bit lengthy... ;)



              Best,

              ~Michael Gmirkin





              Edit:



              Sorry. Jumped the gun slightly.



              I retract the above equations. At the behest of someone on another site, I checked in Wolfram Alpha at a few data points. While it appears to work for the Square case (where the coefficients and corrective term basically cancel out), it doesn't work for other cases, but is slightly off. I think I've got the coefficients wrong. Will have to poke around a bit more in the maths to see if it's possible to get a technically correct exact solution.



              The graphs were so close as to fool me into thinking they were exact for all cases. Will get back to you if/when I get a technically correct solution. 'Til then... I still believe there is a valid function, since the Square case is technically correct @ 1/(Abs[Sin(x)]+Abs[Cos[x]]) or 1/(Abs[Cos[x]]+[Abs[Cos[x-(Pi/2)]]]). Just need the technically correct coefficient... will work on it as I've got some time. But, for now, the incorrect versions are darned close! ;o) Enough to fool most people (including me, apparently).






              share|cite|improve this answer











              $endgroup$



              Reposted from PolymathProgrammer.com, my answer to my own initial query. Generated mostly on my own after some initial help from a friend (Jason Schmurr) and my dad (Russell Gmirkin)





              I believe I've solved my own inquiry. The following are functions that, when graphed in polar coordinates render lovely polygons.



              In fact, I’ve got 3 versions (6 if you consider rotation a factor; to either align a vertex or the midpoint of a side with $theta=0$). One with circumradius = 1 (as vertices $to infty$, polygons expand outward toward the circumscribed circle), one with apothem = 1 (as vertices $to infty$, polygons collapse inward toward the inscribed circle) and one with the midpoint between circumradius & apothem = 1 (as vertices $to infty$, both the maxima and minima, thus the circumscribed and inscribed circles, collapse toward that ‘midpoint radius’).



              I’d be interested to know whether this approach, describing the radius of a polygon as a periodic function, has any precedent (has anyone else done this, or am I the first)? I’ve been working on this idea for some time (on and off for years), but just recently overcame some stumbling blocks with a little help from a friend and my dad. Most of the legwork was my own, though.



              The relatively final form(s) appear to be:



              (n-gon, circumradius=1, unrotated)
              1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, circumradius=1, rotated $-pi/4$)
              1/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, function centered around unit circle, unrotated)
              ((Sec[Pi/v]+1)/2)/(((Sec[Pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, function centered around unit circle, rotated $-pi/4$)
              ((Sec[Pi/v]+1)/2)/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, apothem=1, unrotated)
              Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[(v*x)/4]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/2)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              (n-gon, apothem=1, rotated $-pi/4$)
              Sec[Pi/v]/(((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(Pi/4)]]+((Sec[pi/v]-1)/(Sec[Pi/4]-1))Abs[Cos[((v*x)/4)-(3Pi/4)]]-((Sec[pi/v]-1)/(Sec[Pi/4]-1))+1)



              Don’t know whether they simplify at all to something less complicated… Even if not, they’re beauties!



              Examples:



              3-gon: here



              4-gon: here



              5-gon: here



              If it's a unique solution and I'm first to it, I submit these as the Gmirkin Polygon Radius Function(s) (or some suitably nifty sounding name that’s not too cumbersome). *Smile* Heh.



              I may write them up formally for publication at some point, once a few previous engagements clear up, assuming they’ve not previously been published or some directly correlated function has already been published elsewhere. (If so, I’d like to know when, where and by whom; for academic curiosity’s sake.)



              It is my belief that a similar function exists for describing 3D Polyhedrons of some description(s). Though, I have not yet even attempted such a case and will probably stick to 2D cases for now. I can also tell you that if you vary the phase shift of the denominator [Abs[Cos]] terms by differing amounts (though not both by some multiple of $pi/4$, $pi/2$, etc.), you can also reproduce rectangles, isosceles triangles, etc. In some cases you can also generate diamond shapes by varying some other parameters. It's s surprisingly robust solution, as I'd hoped. Lord knows it's taken me a few years of false starts to get at the correct combination of functions. Though, I learned plenty along the way, much of which helped me generalize to all polygons from the square case a friend solved at my behest a week or two ago.



              Here's hoping this is an interesting, unique new solution that's viable and notable. (One can hope!)



              Sorry the post is a bit lengthy... ;)



              Best,

              ~Michael Gmirkin





              Edit:



              Sorry. Jumped the gun slightly.



              I retract the above equations. At the behest of someone on another site, I checked in Wolfram Alpha at a few data points. While it appears to work for the Square case (where the coefficients and corrective term basically cancel out), it doesn't work for other cases, but is slightly off. I think I've got the coefficients wrong. Will have to poke around a bit more in the maths to see if it's possible to get a technically correct exact solution.



              The graphs were so close as to fool me into thinking they were exact for all cases. Will get back to you if/when I get a technically correct solution. 'Til then... I still believe there is a valid function, since the Square case is technically correct @ 1/(Abs[Sin(x)]+Abs[Cos[x]]) or 1/(Abs[Cos[x]]+[Abs[Cos[x-(Pi/2)]]]). Just need the technically correct coefficient... will work on it as I've got some time. But, for now, the incorrect versions are darned close! ;o) Enough to fool most people (including me, apparently).







              share|cite|improve this answer














              share|cite|improve this answer



              share|cite|improve this answer








              edited Oct 6 '11 at 7:27









              J. M. is not a mathematician

              61.2k5152290




              61.2k5152290










              answered Jun 15 '11 at 8:45









              Michael GmirkinMichael Gmirkin

              11




              11























                  0












                  $begingroup$

                  Depends what you accept as "a general equation" and what is "a plot". For example, under the $l_1$ metric, the equation of what is perceived as a circle ( points having the same distance to a center) ends up looking like a square. Now would that count as genuine plot? Or, are we only allowed the Euclidean metric for plotting? Also, is an answer containing a limit acceptable? For example $$x^{2n}+y^{2n}=r^{2n} lim_{n to +infty}$$ is a square ( or is it? ) see this for $n=18$



                  Also is the equation implicit in x and y or polar and parametric plots are also allowed?






                  share|cite|improve this answer











                  $endgroup$


















                    0












                    $begingroup$

                    Depends what you accept as "a general equation" and what is "a plot". For example, under the $l_1$ metric, the equation of what is perceived as a circle ( points having the same distance to a center) ends up looking like a square. Now would that count as genuine plot? Or, are we only allowed the Euclidean metric for plotting? Also, is an answer containing a limit acceptable? For example $$x^{2n}+y^{2n}=r^{2n} lim_{n to +infty}$$ is a square ( or is it? ) see this for $n=18$



                    Also is the equation implicit in x and y or polar and parametric plots are also allowed?






                    share|cite|improve this answer











                    $endgroup$
















                      0












                      0








                      0





                      $begingroup$

                      Depends what you accept as "a general equation" and what is "a plot". For example, under the $l_1$ metric, the equation of what is perceived as a circle ( points having the same distance to a center) ends up looking like a square. Now would that count as genuine plot? Or, are we only allowed the Euclidean metric for plotting? Also, is an answer containing a limit acceptable? For example $$x^{2n}+y^{2n}=r^{2n} lim_{n to +infty}$$ is a square ( or is it? ) see this for $n=18$



                      Also is the equation implicit in x and y or polar and parametric plots are also allowed?






                      share|cite|improve this answer











                      $endgroup$



                      Depends what you accept as "a general equation" and what is "a plot". For example, under the $l_1$ metric, the equation of what is perceived as a circle ( points having the same distance to a center) ends up looking like a square. Now would that count as genuine plot? Or, are we only allowed the Euclidean metric for plotting? Also, is an answer containing a limit acceptable? For example $$x^{2n}+y^{2n}=r^{2n} lim_{n to +infty}$$ is a square ( or is it? ) see this for $n=18$



                      Also is the equation implicit in x and y or polar and parametric plots are also allowed?







                      share|cite|improve this answer














                      share|cite|improve this answer



                      share|cite|improve this answer








                      edited Mar 24 '12 at 11:40









                      J. M. is not a mathematician

                      61.2k5152290




                      61.2k5152290










                      answered May 29 '11 at 12:29









                      ArjangArjang

                      5,66062364




                      5,66062364























                          0












                          $begingroup$

                          How's this (Mathematica code)? It gives the n-gons inscribed in the unit circle, with vertices at the nth roots of unity.



                          Manipulate[PolarPlot[Cos[Pi/n] Sec[(2/n) ArcTan[Cot[(n t/2)]]], {t, 0, 2 Pi}], {n, 3, 40, 1}]






                          share|cite|improve this answer









                          $endgroup$













                          • $begingroup$
                            I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
                            $endgroup$
                            – Vincent Tan
                            Feb 18 '14 at 11:12












                          • $begingroup$
                            You're basically using $arctan cot x$ here as your sawtooth… :)
                            $endgroup$
                            – J. M. is not a mathematician
                            Aug 17 '15 at 7:54
















                          0












                          $begingroup$

                          How's this (Mathematica code)? It gives the n-gons inscribed in the unit circle, with vertices at the nth roots of unity.



                          Manipulate[PolarPlot[Cos[Pi/n] Sec[(2/n) ArcTan[Cot[(n t/2)]]], {t, 0, 2 Pi}], {n, 3, 40, 1}]






                          share|cite|improve this answer









                          $endgroup$













                          • $begingroup$
                            I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
                            $endgroup$
                            – Vincent Tan
                            Feb 18 '14 at 11:12












                          • $begingroup$
                            You're basically using $arctan cot x$ here as your sawtooth… :)
                            $endgroup$
                            – J. M. is not a mathematician
                            Aug 17 '15 at 7:54














                          0












                          0








                          0





                          $begingroup$

                          How's this (Mathematica code)? It gives the n-gons inscribed in the unit circle, with vertices at the nth roots of unity.



                          Manipulate[PolarPlot[Cos[Pi/n] Sec[(2/n) ArcTan[Cot[(n t/2)]]], {t, 0, 2 Pi}], {n, 3, 40, 1}]






                          share|cite|improve this answer









                          $endgroup$



                          How's this (Mathematica code)? It gives the n-gons inscribed in the unit circle, with vertices at the nth roots of unity.



                          Manipulate[PolarPlot[Cos[Pi/n] Sec[(2/n) ArcTan[Cot[(n t/2)]]], {t, 0, 2 Pi}], {n, 3, 40, 1}]







                          share|cite|improve this answer












                          share|cite|improve this answer



                          share|cite|improve this answer










                          answered Feb 18 '14 at 4:29









                          NJSNJS

                          1




                          1












                          • $begingroup$
                            I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
                            $endgroup$
                            – Vincent Tan
                            Feb 18 '14 at 11:12












                          • $begingroup$
                            You're basically using $arctan cot x$ here as your sawtooth… :)
                            $endgroup$
                            – J. M. is not a mathematician
                            Aug 17 '15 at 7:54


















                          • $begingroup$
                            I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
                            $endgroup$
                            – Vincent Tan
                            Feb 18 '14 at 11:12












                          • $begingroup$
                            You're basically using $arctan cot x$ here as your sawtooth… :)
                            $endgroup$
                            – J. M. is not a mathematician
                            Aug 17 '15 at 7:54
















                          $begingroup$
                          I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
                          $endgroup$
                          – Vincent Tan
                          Feb 18 '14 at 11:12






                          $begingroup$
                          I finally got this to work: polarplot [ cos(Pi/7)/cos( | (t mod (2Pi/7)) - (2Pi/(2*7)) | ) , {t,0,2Pi}] Replace "7" with the number of sides you want. Read the explanations of how I got that equation here: polymathprogrammer.com/2014/01/29/…
                          $endgroup$
                          – Vincent Tan
                          Feb 18 '14 at 11:12














                          $begingroup$
                          You're basically using $arctan cot x$ here as your sawtooth… :)
                          $endgroup$
                          – J. M. is not a mathematician
                          Aug 17 '15 at 7:54




                          $begingroup$
                          You're basically using $arctan cot x$ here as your sawtooth… :)
                          $endgroup$
                          – J. M. is not a mathematician
                          Aug 17 '15 at 7:54











                          0












                          $begingroup$

                          A cheap trick: Take an equation that represents the union of the extensions of the polygon’s sides and add a domain-limiting term to both sides.



                          For example, the equation $$(x-C)(x+y-sqrt2C)(y-C)(x-y+sqrt2C)(x+C)(x+y+sqrt2C)(y+C)(x-y-sqrt2C)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}$$ with $C=cos{fracpi8}$ describes a regular octagon. For a regular polygon with an even number of sides, you can pair up opposite sides to halve the number of terms: $$(x^2-C^2)((x+y)^2-2C^2)(y^2-C^2)(x-y+sqrt2C)((x-y)^2-2C^2)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}.$$



                          This obviously generalizes to polygons that are affine images of cyclic polygons, i.e., one whose vertices all lie on an ellipse.






                          share|cite|improve this answer









                          $endgroup$


















                            0












                            $begingroup$

                            A cheap trick: Take an equation that represents the union of the extensions of the polygon’s sides and add a domain-limiting term to both sides.



                            For example, the equation $$(x-C)(x+y-sqrt2C)(y-C)(x-y+sqrt2C)(x+C)(x+y+sqrt2C)(y+C)(x-y-sqrt2C)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}$$ with $C=cos{fracpi8}$ describes a regular octagon. For a regular polygon with an even number of sides, you can pair up opposite sides to halve the number of terms: $$(x^2-C^2)((x+y)^2-2C^2)(y^2-C^2)(x-y+sqrt2C)((x-y)^2-2C^2)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}.$$



                            This obviously generalizes to polygons that are affine images of cyclic polygons, i.e., one whose vertices all lie on an ellipse.






                            share|cite|improve this answer









                            $endgroup$
















                              0












                              0








                              0





                              $begingroup$

                              A cheap trick: Take an equation that represents the union of the extensions of the polygon’s sides and add a domain-limiting term to both sides.



                              For example, the equation $$(x-C)(x+y-sqrt2C)(y-C)(x-y+sqrt2C)(x+C)(x+y+sqrt2C)(y+C)(x-y-sqrt2C)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}$$ with $C=cos{fracpi8}$ describes a regular octagon. For a regular polygon with an even number of sides, you can pair up opposite sides to halve the number of terms: $$(x^2-C^2)((x+y)^2-2C^2)(y^2-C^2)(x-y+sqrt2C)((x-y)^2-2C^2)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}.$$



                              This obviously generalizes to polygons that are affine images of cyclic polygons, i.e., one whose vertices all lie on an ellipse.






                              share|cite|improve this answer









                              $endgroup$



                              A cheap trick: Take an equation that represents the union of the extensions of the polygon’s sides and add a domain-limiting term to both sides.



                              For example, the equation $$(x-C)(x+y-sqrt2C)(y-C)(x-y+sqrt2C)(x+C)(x+y+sqrt2C)(y+C)(x-y-sqrt2C)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}$$ with $C=cos{fracpi8}$ describes a regular octagon. For a regular polygon with an even number of sides, you can pair up opposite sides to halve the number of terms: $$(x^2-C^2)((x+y)^2-2C^2)(y^2-C^2)(x-y+sqrt2C)((x-y)^2-2C^2)+sqrt{1-x^2-y^2}=sqrt{1-x^2-y^2}.$$



                              This obviously generalizes to polygons that are affine images of cyclic polygons, i.e., one whose vertices all lie on an ellipse.







                              share|cite|improve this answer












                              share|cite|improve this answer



                              share|cite|improve this answer










                              answered Jan 11 at 9:10









                              amdamd

                              31.7k21052




                              31.7k21052























                                  0












                                  $begingroup$

                                  In the context of this question you may define for a given number $n$ some (Fourier) coefficients by these sensible equations (as you have asked for):



                                  $a^{(n)}_k sim begin{cases}
                                  +k^{-2} & text{ for } k equiv 1 pmod n\
                                  +k^{-2} & text{ for } k equiv (n-1) pmod n\
                                  0 & text{ otherwise }
                                  end{cases}$



                                  $b^{(n)}_k sim begin{cases}
                                  +k^{-2} & text{ for } k equiv 1 pmod n\
                                  -k^{-2} & text{ for } k equiv (n-1) pmod n\
                                  0 & text{ otherwise }
                                  end{cases}$



                                  Then you calculate the functions $a^{(n)}(t)$ and $b^{(n)}(t)$ like this:



                                  $a^{(n)}(t) sim sum_{k=0}^infty a^{(n)}_kcos(kt)$



                                  $b^{(n)}(t) sim sum_{k=0}^infty b^{(n)}_ksin(kt)$



                                  Finally you draw the curve $t mapsto a^{(n)}(t) + ib^{(n)}(t)$ in the complex plane – and get your desired regular $n$-gon.



                                  As an example for $n=4$:



                                  enter image description here



                                  See more examples in the gallery here.






                                  share|cite|improve this answer











                                  $endgroup$


















                                    0












                                    $begingroup$

                                    In the context of this question you may define for a given number $n$ some (Fourier) coefficients by these sensible equations (as you have asked for):



                                    $a^{(n)}_k sim begin{cases}
                                    +k^{-2} & text{ for } k equiv 1 pmod n\
                                    +k^{-2} & text{ for } k equiv (n-1) pmod n\
                                    0 & text{ otherwise }
                                    end{cases}$



                                    $b^{(n)}_k sim begin{cases}
                                    +k^{-2} & text{ for } k equiv 1 pmod n\
                                    -k^{-2} & text{ for } k equiv (n-1) pmod n\
                                    0 & text{ otherwise }
                                    end{cases}$



                                    Then you calculate the functions $a^{(n)}(t)$ and $b^{(n)}(t)$ like this:



                                    $a^{(n)}(t) sim sum_{k=0}^infty a^{(n)}_kcos(kt)$



                                    $b^{(n)}(t) sim sum_{k=0}^infty b^{(n)}_ksin(kt)$



                                    Finally you draw the curve $t mapsto a^{(n)}(t) + ib^{(n)}(t)$ in the complex plane – and get your desired regular $n$-gon.



                                    As an example for $n=4$:



                                    enter image description here



                                    See more examples in the gallery here.






                                    share|cite|improve this answer











                                    $endgroup$
















                                      0












                                      0








                                      0





                                      $begingroup$

                                      In the context of this question you may define for a given number $n$ some (Fourier) coefficients by these sensible equations (as you have asked for):



                                      $a^{(n)}_k sim begin{cases}
                                      +k^{-2} & text{ for } k equiv 1 pmod n\
                                      +k^{-2} & text{ for } k equiv (n-1) pmod n\
                                      0 & text{ otherwise }
                                      end{cases}$



                                      $b^{(n)}_k sim begin{cases}
                                      +k^{-2} & text{ for } k equiv 1 pmod n\
                                      -k^{-2} & text{ for } k equiv (n-1) pmod n\
                                      0 & text{ otherwise }
                                      end{cases}$



                                      Then you calculate the functions $a^{(n)}(t)$ and $b^{(n)}(t)$ like this:



                                      $a^{(n)}(t) sim sum_{k=0}^infty a^{(n)}_kcos(kt)$



                                      $b^{(n)}(t) sim sum_{k=0}^infty b^{(n)}_ksin(kt)$



                                      Finally you draw the curve $t mapsto a^{(n)}(t) + ib^{(n)}(t)$ in the complex plane – and get your desired regular $n$-gon.



                                      As an example for $n=4$:



                                      enter image description here



                                      See more examples in the gallery here.






                                      share|cite|improve this answer











                                      $endgroup$



                                      In the context of this question you may define for a given number $n$ some (Fourier) coefficients by these sensible equations (as you have asked for):



                                      $a^{(n)}_k sim begin{cases}
                                      +k^{-2} & text{ for } k equiv 1 pmod n\
                                      +k^{-2} & text{ for } k equiv (n-1) pmod n\
                                      0 & text{ otherwise }
                                      end{cases}$



                                      $b^{(n)}_k sim begin{cases}
                                      +k^{-2} & text{ for } k equiv 1 pmod n\
                                      -k^{-2} & text{ for } k equiv (n-1) pmod n\
                                      0 & text{ otherwise }
                                      end{cases}$



                                      Then you calculate the functions $a^{(n)}(t)$ and $b^{(n)}(t)$ like this:



                                      $a^{(n)}(t) sim sum_{k=0}^infty a^{(n)}_kcos(kt)$



                                      $b^{(n)}(t) sim sum_{k=0}^infty b^{(n)}_ksin(kt)$



                                      Finally you draw the curve $t mapsto a^{(n)}(t) + ib^{(n)}(t)$ in the complex plane – and get your desired regular $n$-gon.



                                      As an example for $n=4$:



                                      enter image description here



                                      See more examples in the gallery here.







                                      share|cite|improve this answer














                                      share|cite|improve this answer



                                      share|cite|improve this answer








                                      edited Apr 4 at 14:46

























                                      answered Apr 4 at 14:11









                                      Hans-Peter StrickerHans-Peter Stricker

                                      6,75743997




                                      6,75743997

















                                          protected by Community Jun 3 '15 at 6:07



                                          Thank you for your interest in this question.
                                          Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                                          Would you like to answer one of these unanswered questions instead?



                                          Popular posts from this blog

                                          Bressuire

                                          Cabo Verde

                                          Gyllenstierna