Had a look at the 1st quadrant (0 .. 1r2p1 rad).

Worked with a vector "sweep" (origin to perimeter) for these graphs:

   - unit circle
   - square circumscribed unit circle
   - quadric plane function x^4 + y^4= 1 ('real squircle')
   - 'fake squircle'

The 'fake squircle' was constructed by taking the mean of vector length (at the same angle) for square and unit circle.

The figure obtained by this procedure is a bulging square, situated between circle and circumscribed square, with its four corners sitting on the four bisectors of the four quadrants.

That's the region where the 'real squircle' lives; but in contrast, that is a smooth curve.

I tried a couple of different means, notably harmonic, geometric and arithmetic mean.

Using geometric mean, I noticed that the four corners of the 'fake squircle' almost conincide (error below 2%) with the 'real' one (while most of its graph lies *inside* of the 'real squircle'). Maybe these corner positions gave rise to the mention of mean in this context.

I hesitate to include the awkward code I used, but as a starting point I took your circle function (cos j. sin); my mean is different from yours as I stayed on the same 'sweep vector' when comparing different graph's vector lengths.

As RM would probably have written at this point: I hope this makes some sense.

Thanks
-M

At 2022-08-16 18:08, you wrote:

RD>     I want to construct and plot a Squircle in J.   [...]
RD>
RD>     Has anyone a good idea for performing that calculation? Could the J
RD>     function plot then draw the Squircle?

It is easy to "plot" parametric functions in the complex plane.

Here are three parametric functions, to be computed over parameter
inputs for a full circle, say, -pi to pi in 200 tiny steps:

circle =. cos  j.  sin
square =. cos j.&* sin

squircle =. (square + circle) % 2:      NB. your "mean" of the functions.

NB. Show time!

plot (circle , square ,: squircle)  i: 1p1 j. 200

                                                Martin Neitzel

PS:

That * in  cos j.&* sin  is Sign, bulging out the circle to the full
1 _1 (square) borders.

Have some thoughts on what actually happens when the Sign * acts on and
returns a 0, and how that shows up.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to