Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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}}]
share|improve this question

closed as off topic by Doc Brown, rwong, GlenH7, BЈовић, thorsten müller Apr 23 '13 at 7:16

Questions on Programmers Stack Exchange are expected to relate to software development within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

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, just use the picture button in the toolbar. – lxop Apr 18 '13 at 4:15
yes please use a non sign in site to view. mathematica is the language? – tgkprog Apr 18 '13 at 4:30
yes its mathematica The command for the plot is ListPlot[a, PlotLabel -> "MeshPoints", AxesLabel -> {"x", "y"}, PlotRange -> {{-2, 2}, {-2, 2}}] – l3win Apr 18 '13 at 5:25
up vote 20 down vote accepted

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.

share|improve this answer

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

share|improve this answer
Noted. It was my understanding that Pi was not defined for Fortran 90. Thx for that. – l3win Apr 18 '13 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.

share|improve this answer
Changed servers. Now it should work. It seems to be giving me a square axis. It intersects at (-2,2) , (-2,2) – l3win Apr 18 '13 at 4:30
Why the downvote, mystery person? – lxop Apr 21 '13 at 3:27

Not the answer you're looking for? Browse other questions tagged or ask your own question.