# Trying to code the points on a circle [closed]

I am trying to understand this:

I wrote a code for points on a circle of radius 1. Note that the first and last point intentionally coincide.

``````do i=1,imax
X(i,1) = COS(-2*4.0*ATAN(1.0)*(i-1)/(imax-1))
Y(i,1) = SIN(-2*4.0*ATAN(1.0)*(i-1)/(imax-1))
print *, X(i,1)**2 + Y(i,1)**2
end do
``````

The code is supposed to be a circle, but the following figure demonstrates the plot in Mathematica. It looks to me like an ellipse. Am I doing something wrong? Or is this just the way Mathematica plots it? The command for the plot is

``````ListPlot[a, PlotLabel -> "MeshPoints", AxesLabel -> {"x", "y"}, PlotRange -> {{-2, 2}, {-2, 2}}]
``````
• Please upload your picture to a server that doesn't tell me to sign up when I visit it. You can upload directly to this site (it will be hosted on imgur.com), just use the picture button in the toolbar.
– lxop
Apr 18, 2013 at 4:15
• yes please use a non sign in site to view. mathematica is the language? Apr 18, 2013 at 4:30
• yes its mathematica The command for the plot is ListPlot[a, PlotLabel -> "MeshPoints", AxesLabel -> {"x", "y"}, PlotRange -> {{-2, 2}, {-2, 2}}] Apr 18, 2013 at 5:25

It's simply a matter of your two axes not visually being the same size. You can see that they go out to a radius of 1 in all 4 directions, which is 5 marks, but the distance between marks is different between the x axis and y axis. Mathematically, your result is in fact a circle, it's how you're rendering it that is the problem.

When you do ListPlot[] in Mathematica, it uses an "Auto" aspect ratio, which is something like the Golden Mean. You can see that in your plot (the ticks are closer together on the Y axis than on the X axis).

To get what you are looking for, use the option AspectRatio->1, e.g.:

ListPlot[Points, AspectRatio -> 1]

I'd post a picture for you, but stack exchange won't let me.

In any case, if you use AspectRatio in your plot, you'll see that you have a circle.

As far as the expressions you list go, why are you using -2*4.0*ATAN(1.0) rather than 2 * Pi ?

-2*4.0*ATAN(1.0) = - 2 Pi

• Noted. It was my understanding that Pi was not defined for Fortran 90. Thx for that. Apr 18, 2013 at 6:39

Without seeing your plot (see my comment on your question), I would assume that mathematica hasn't given you square axes, so it is distorting the circle. Your parameters do describe a circle.

• Changed servers. Now it should work. It seems to be giving me a square axis. It intersects at (-2,2) , (-2,2) Apr 18, 2013 at 4:30
• Why the downvote, mystery person?
– lxop
Apr 21, 2013 at 3:27