The formula for an equilateral polygon in polar coordinates looks very simple
and has the following parameters:
- angle;
- the number of convex vertices;
- determines how many vertices the sides will lie on one straight line. Negative values ββare also permissible for it - the sign will determine in which direction the star will bend;
- rigidity - at we get a circle regardless of other parameters, for - a polygon with straight lines, at intermediate values ββfrom before - intermediate figures between a circle and a polygon.
With this formula, you can draw a star in two ways:
1)
2) ... In this case, you need to make two turns instead of one:
Parameter affects the polygon as follows (here it changes from -1 to 5):
Parameter in animation:
Complex form and modifications
You can rewrite the original formula in a complex form, and, despite the presence of imaginary units in it, the value of the radius will still remain valid:
At first glance, this may seem pointless, since the formula has become a little more cumbersome - but don't jump to conclusions. First, there is no arcsine in it, which completely changes the mathematical meaning of the formula and allows you to look differently at the construction of a stellated polygon. Secondly, it can also be used to obtain compact formulas for special cases, for example... Thirdly (and most interestingly), it can be creatively modified and obtained other, unexpected forms. In order for the appearance of a possible imaginary component in the radius not to cause ambiguity in the calculation, it can be immediately reduced to Cartesian coordinates by multiplying by... Here are examples of some of the modifications:
As you probably noticed, the rotation of the vector has ceased to be uniform - and precisely because of the appearance of the imaginary component in the radius.
Quads and stuff
Our formula has a wonderful special case - a square, the formula for which can be written as
or
(choose which one you like best).
In a slightly more developed case, you can define intermediate figures between a circle and a square through a point on surface
You can also add variation to these shapes while maintaining the condition that they pass through the point - modulating directly the parameter itself depending on the angle so that when passing through the diagonal, its multiplier is equal to one. For example, substituting instead function , we will get an additional parameter with which additional bends can be adjusted. In particular, for you get the following:
In an even more expanded case, you can define not just a square, but a rectangle, and still in polar coordinates:
And even calculate its area (via elliptic integrals):
Note
( ) , .
This will allow making profiles with a transition from a circle to a rectangle with a controlled section area. Here the area is constant:
And here the area expands exponentially:
Go to Cartesian coordinates
Any formula in polar coordinates can be expressed through an equation in Cartesian coordinates, and in at least two ways - depending on which the form of the gradient on the border of the figure will change. To do this, it is enough to calculate the angle through the arctangent of the coordinates and bring the formula to a constant through the radius vector by subtracting
or division
The second option is preferable because it gives straight gradients along the sides of the polygon.
Note
The value of the formula from the right side of the equation (in the 2nd case) will change from before if point gets inside the figure, and from ad infinitum - if not. By choosing different functions to convert it to brightness, you can get different rasterization options. For the exponent ( for the first and for the second option) we get
Classic low pass filter can be used , in which - the order of the filter, which determines the degree of attenuation.
For the first option:
And for the second:
You can also use a piecewise continuous function by explicitly setting the interpolation boundaries.
In addition to rasterization as such, you can also set deformations - for example, squeeze a checkerboard into a circle:
Or even pull it over a sphere:
Formula
Appendix: how the formula was derived
The classical style of storytelling in mathematical texts consists of the alternation of lemmas / theorems and their proofs - as if the provable statements appeared in the author's head by a revelation from above. And although there is some truth in this, more often the appearance of formulas is preceded by some research work, the description of which can give a greater understanding of their meaning than formal proof; and the fidelity of the statements, in turn, can be traced through the fidelity of the steps that led to them.
So here too - if the article began with a formula in a complex form, then its appearance would be non-obvious and counter-intuitive, and the declared properties would require additional proofs. But in the trigonometric form of recording, the history of its appearance is quite possible to trace.
1) we start with the simplest case - the task of drawing a straight line in polar coordinates. To do this, you need to solve the equationwhose solution is obvious ...
2) further, the secant argument needs to be "looped" to provide kinks in a straight line. It is at this stage that other solutions use a "dirty hack" in the form of a division remainder. It also uses sequential taking of the direct and inverse sine function -
This approach allows you to perform standard mathematical operations on the resulting formula,
eg
:
Thanks to the same notation, you can simplify the square function in polar coordinates to a more aesthetic look, using the complex representation of trigonometric functions. In Wolfram Mathematica, this can be done using the TrigToExp and ExpToTrig functions:
The code
β
Sec[1/2 ArcSin[k Sin[2 \[Phi]]]]^2//TrigToExp//ExpToTrig//Sqrt[#]&//FullSimplify
β
Thanks to the same recording, you can get smooth intermediate figures between a circle and a square using an additional multiplier due to which the arcsine argument falls short of one - :
And in order for the function to intersect a given point, you just need to make an equation and recalculate :
The code
β
Solve[(Sqrt[2/(1+Sqrt[1-k Sin[2 \[Phi]]^2])] /. \[Phi]->Pi/4)==x, k] /. x->k
β
3) parameters and were just added in a creative way and their effects were investigated experimentally, in fact.
4) Rectangle is easy to get by going to the parametric view and "stretching" the axes
But after that will no longer mean angle, now Is just a parameter that describes a vector through its projections onto the coordinate axes. To go back to polar coordinates, you need to find the length of the vector (through the root of the sum of squares), the angle (through the arctangent of the ratio), express this angle through and substitute the resulting expression instead ...
The code
β
β
β
With[{r = Sqrt[2/(1 + Sqrt[
1 - Sin[2 t]^2])]}, {Sqrt[(a r Cos[t])^2 + (b r Sin[t])^2],
ArcTan[(b r Sin[t])/(a r Cos[t])]}] // Simplify
β
Solve[ArcTan[(b Tan[t])/a]==\[Phi], t]
β
Sqrt[2] Sqrt[(a^2 Cos[t]^2 + b^2 Sin[t]^2)/(1 + Sqrt[Cos[2 t]^2])]
/. t -> ArcTan[(a Tan[\[Phi]])/b] // Simplify
β
To simplify such a formula is already more difficult, and this will require several stages:
- go to cartesian coordinates by replacing ;
- go to exponential form;
- simplify;
- make a reverse replacement and ;
- go back to exponential form;
- simplify.
As a result, we get the following formula:
The code
β
Sqrt[2] Sqrt[(a^2 b^2 Sec[\[Phi]]^2) /
((1 + Sqrt[Cos[2 ArcTan[(a Tan[\[Phi]])/b]]^2])
(b^2 + a^2 Tan[\[Phi]]^2))] /. \[Phi] -> ArcTan[x, y]
// TrigToExp // Simplify
// # /. {x -> Cos[\[Phi]], y -> Sin[\[Phi]]} &
// TrigToExp // Simplify // FullSimplify
β
Conclusion
As you can see, even in such a simple and banal thing as a polygon, you can find and come up with something new. And the story does not end there - the area formula for the general case remained unknown, the formula for an arbitrary, and not just regular, polygon remained unknown, and the expansion into power and trigonometric series was left without consideration. Also, probably, a similar kind of formula exists for the 3-dimensional case.
Therefore, if you are told that everything in mathematics has already been invented and there are only problems that are beyond the understanding of an ordinary person - do not believe it. There are many purely practical problems that real mathematicians are not aware of, or they are not interested in their solution due to the lack of sufficient hype around them, or because they already have a rough idea of ββways to achieve them for their solution. Do not be afraid to tackle problems whose solutions are not available in Wikipedia, do not be afraid to publish their solutions, and do not be afraid to read the comments under the articles about the uselessness of everything.
PS download the original document for Mathematica here .