Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Random value in a unit circle' topicStudent Support Forum > General > Archives > "Random value in a unit circle"

Next Comment >Help | Reply To Topic
Author Comment/Response
John
09/20/07 01:40am

Hi all,

Now I am trying to get the plot having values within an unit circle. The below was what I did.

x := RandomReal[{-1, 1}]
y := RandomReal[{-1, 1}]
t1 = Graphics[Circle[]];
t2 = ListPlot[Table[If[x^2 + y^2 < 1, {x, y}], {2000}]];
Show[t1, t2]

I think this is right, but there are points outside the circle. Does someone know what is wrong?

URL: ,

Subject (listing for 'Random value in a unit circle')
Author Date Posted
Random value in a unit circle John 09/20/07 01:40am
Re: Random value in a unit circle Forum Modera... 09/20/07 07:01am
Re: Re: Random value in a unit circle John 09/20/07 11:33am
Re: Re: Re: Random value in a unit circle Forum Modera... 09/21/07 06:52am
Next Comment >Help | Reply To Topic