[Question]
  [
Take a look at this chamomile flower:
[![](https://i.stack.imgur.com/VuneQ.png)](https://i.stack.imgur.com/VuneQ.png)
Pretty, isn't it? Well, what if I told you that this wasn't actually one flower?
A lot of flowers (including sunflowers, chamomiles, daisies and others) actually consist of many very small flowers (the black dots on sunflowers) on a flower head. These miniature flowers are called *florets*, and they are arranged in a very special way.
Basically, the nth floret's position on a flower head is (in polar coordinates):
[![](https://i.stack.imgur.com/lgVI1.png)](https://i.stack.imgur.com/lgVI1.png)
[![](https://i.stack.imgur.com/FW3Wx.png)](https://i.stack.imgur.com/FW3Wx.png)
where c = 1 (Note that 137.508 degrees = golden angle. You don't have to use this exact precision.)
This causes the florets to be formed in a spiral called Fermat's Spiral. The positioning of the florets also is connected with Fibonnaci numbers, but that's a tale for another time.
So, here's the challenge. Given an integer n as input, calculate the positions of the first n florets and **plot them**. This is [graphical-output](/questions/tagged/graphical-output "show questions tagged 'graphical-output'"), so I do actually want you to display the points in either a window of some sort or outputted as data in some common image format to STDOUT or a file. Other than that, this challenge should be fairly straightforward. It's [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code wins. GLHF!
Here is a sample picture of what an output might look like:
[![](https://i.stack.imgur.com/xQk4x.png)](https://i.stack.imgur.com/xQk4x.png)
  
[Answer]
# TI-BASIC, 34 bytes
For the TI-83+/84+ series of calculators.
```
Input N
2πe^(-2sinh⁻¹(.5→θstep
AnsN→θmax
"√(θ→r₁
Polar                      ;Displays polar mode graphs to graph screen
Dot                        ;Prevents lines from connecting points
DispGraph                  ;Displays graph screen
```
This considers the dot at the origin to be the 0th dot.
Thanks to the one-byte `sinh⁻¹(` token, `2πe^(-2sinh⁻¹(.5` is a short way of getting the golden angle in radians. This is derived from the fact that `e^(sinh⁻¹(.5` is the golden ratio.
Here are screenshots for N=50.
(Yes, that's a [96x64 monochrome display](https://xkcd.com/768/) on a TI-84+. The newer color calculators have a resolution upgrade, but still have only 3.7% the pixels of an iPhone.)
[![Without coordinates displayed](https://i.stack.imgur.com/N7H20.png)](https://i.stack.imgur.com/N7H20.png)
Press `TRACE` to step through each point.
[![With coordinates](https://i.stack.imgur.com/Uql7F.png)](https://i.stack.imgur.com/Uql7F.png)
[Answer]
# Python 2, ~~85~~ ~~82~~ 81 bytes
```
from pylab import*
for i in arange(0,input(),2.39996):polar(i,sqrt(i),'o')
show()
```
Shortened by one byte by marinus.
Using the golden angle in radians. Byte length is the same if I used 137.508 instead, but somehow doesn't look as good. Generates a polar plot using pylab. Below is when 300 (for the older version) is the input and 7000 (for the newer version) is the input. Could round the angle up to 2.4 to lower the number of bytes to 77.
[![Older version when input is 300](https://i.stack.imgur.com/fbodi.png)](https://i.stack.imgur.com/fbodi.png)
[![Newer version when input is 7000](https://i.stack.imgur.com/Pj77A.png)](https://i.stack.imgur.com/Pj77A.png)
Here's a longer version that produces a cleaner look by removing the grid and axis:
```
from pylab import *
def florets(n):
    for i in arange(0, n, 2.39996):polar(i, sqrt(i), 'o')
    grid(0)#turn off grid
    xticks([])#turn off angle axis
    yticks([])#turn off radius axis
    show()
```
The reason for the different colors is because each point is plotted separately and treated as its own set of data. If the angles and radii were passed as lists, then they would be treated as one set and be of one color.
[Answer]
## [Blitz 2D/3D](http://www.blitzbasic.com/), 102 bytes
(The very FIRST EVER Blitz 2D/3D answer on this site!)
```
Graphics 180,180
Origin 90,90
n=Input()
For i=1To n
t#=i*137.508
r#=Sqr(t)
Plot r*Cos(t),r*Sin(t)
Next
```
An input of `50` fills the window. (Yes, I could shave off two bytes by doing `Graphics 99,99`, but that's not nearly so visually interesting or useful.)
[![50 florets](https://i.stack.imgur.com/vqPUM.png)](https://i.stack.imgur.com/vqPUM.png)
Prettier version (and exits more nicely):
```
Graphics 400,400
Origin 200,200
n=Input("How many florets? ")
For i = 1 To n
    t# = i * 137.508
    r# = Sqr(t)
    Oval r*Cos(t)-3,r*Sin(t)-3,7,7,1
Next
WaitKey
End
```
[![200 florets example](https://i.stack.imgur.com/j1HKh.png)](https://i.stack.imgur.com/j1HKh.png)
[Answer]
# Mathematica, ~~43~~ 42 bytes
```
ListPolarPlot@Array[(2.39996#)^{1,.5}&,#]&
```
This is an unnamed function taking an integer argument, e.g.
[![enter image description here](https://i.stack.imgur.com/d0Qfq.png)](https://i.stack.imgur.com/d0Qfq.png)  
The screenshot uses an older version, but the output looks the same.
Mathematica actually has a built-in `GoldenAngle` for even more accurate results, but that's longer than `2.39996`.
[Answer]
# MATLAB, 42 bytes
```
t=2.39996*(1:input(''));polar(t,t.^.5,'.')
```
Gets the input number, creates a range from 1 to that number.
Multiplies the range by the golden angle in radians (the value used is closer to the true value than 137.508 degrees to 6 s.f.).
Then simply plots **theta** vs. **r** on a polar coordinates chart using dots. Here shown with 2000 points
[![Polar](https://i.stack.imgur.com/DT9P0.png)](https://i.stack.imgur.com/DT9P0.png)
A slightly prettier looking graph (no grid lines) would be this code:
```
t=2.39996*(1:input(''));[x,y]=pol2cart(t,t.^.5);plot(x,y,'.');axis equal
```
Though that is at the expense of 31 bytes. Again here is it shown with 2000 points
[![Plot](https://i.stack.imgur.com/F825k.png)](https://i.stack.imgur.com/F825k.png)
[Answer]
# R, ~~58~~ ~~55~~ 54 bytes
```
x=2.39996*1:scan();plotrix::radial.plot(x^.5,x,rp="s")
```
This requires the `plotrix` package to be installed, but the package doesn't have to be imported because we're referencing the namespace explicitly.
Ungolfed:
```
# Read a number of STDIN
n <- scan()
x <- 2.39996*(1:n)
# The rp.type = "s" option specifies that we want to plot points rather
# than lines (the default)
plotrix::radial.plot(lengths = sqrt(x), radial.pos = x, rp.type = "s")
```
Example output for *n* = 1500:
[![enter image description here](https://i.stack.imgur.com/VvIsD.png)](https://i.stack.imgur.com/VvIsD.png)
Saved 3 bytes thanks to plannapus!
[Answer]
# R, ~~55~~ 54 bytes
```
t=1:scan()*2.39996;r=t^.5;plot(r*cos(t),r*sin(t),as=1)
```
Here is the result for n=1000:
[![enter image description here](https://i.stack.imgur.com/jIbLI.png)](https://i.stack.imgur.com/jIbLI.png)
Edit: Saved 1 byte using partial matching of arguments (`as` instead of `asp`) thanks to @AlexA.!
[Answer]
# R, ~~48~~ 47 bytes
I think this is sufficiently different from the other R solutions so far. This one uses complex vectors to construct the coordinates. the sqrt of t and t are put into the modulus and argument parameters and the x, y are taking from the real and imaginary.
Thanks to @AlexA. for the byte.
```
plot(complex(,,,t^.5,t<-1:scan()*2.39996),as=1)
```
[![enter image description here](https://i.stack.imgur.com/UPNOK.png)](https://i.stack.imgur.com/UPNOK.png)
[Answer]
# Html+JavaScript 179
```
<canvas id=C></canvas><script>n=1500,C.width=C.height=400,T=C.getContext('2d');for(n=prompt(M=Math);n--;)r=M.sqrt(t=n*2.4)*9,T.fillRect(M.cos(t)*r+200,M.sin(t)*r+200,2,2)</script>
```
[Answer]
# Jolf, 25 bytes
```
yG@@KyoΜzXDyOUH*Hm°yT'.}
```
[![enter image description here](https://i.stack.imgur.com/qUecQ.png)](https://i.stack.imgur.com/qUecQ.png)
(output for n = 5000)
[Try it online. (note that the resulting spiral is small)](http://conorobrien-foxx.github.io/Jolf/#code=eUdAwpZAS3lvzpx6WER5T1VIKkhtwrB5VCcufQ)
Non-competing since Jolf was created after this challenge. This is 25 bytes when encoded with ISO-8859-7, and it contains one unprintable (here's a hexdump):
```
0000000: 7947 4096 404b 796f cc7a 5844 794f 5548  yG@[[email protected]](/cdn-cgi/l/email-protection)
0000010: 2a48 6db0 7954 272e 7d                   *Hm.yT'.}
```
## Explanation
```
yG@@KyoΜzXDyOUH*Hm°yT'.}
yG@@K                      goto (150,75) (center of the canvas)
     yo                    set current location as the origin
       MzX                 map over range 1...input
          D                start of function
           yO              goto polar coordinates ....
             UH            radius: square root of argument
               *Hm°        angle: argument times golden angle
                   yT'.    draw a dot there
                       }
```
[Answer]
# [K (oK) + `iKe`](https://github.com/JohnEarnest/ok), 37 bytes
```
{(80+(%t)*(cos;sin)@\:t:x*2.4;;1)}'!:
```
[Try it online!](https://johnearnest.github.io/ok/ike/ike.html?key=FBTqO-Y_)
a function which takes n on the right. Uses the approximate 2.4 radian measure.
-8 bytes from JohnE.
## Explanation
```
{draw::{(80+(%t)*(cos;sin)@\:t:x*2.4;;1)}'!x}
 draw::                                       globally set draw to:
       {                                }     the following function
                                         '!x  run on range 0..input-1
        (                              )      create an array:
                             t:x*2.4          multiply right arg by 2.4, set to t
                 (cos;sin)@\:                 apply cos and sin on each
            (%t)*                             multiply by sqrt(t)
         80+                                  add 80 (for compatibility with any size, change to ((w;h)%2)+)
```
[Answer]
# Python 2, 74 bytes
```
from pylab import*
i=arange(1,input(),2.39996)
polar(i,sqrt(i),'o')
show()
```
[Answer]
# Tcl/Tk, 114
```
grid [canvas .c]
proc P n {time {incr i
.c cr o [lmap h {cos sin cos sin} {expr sqrt($i*2.4)*$h\($i*2.4)+99}]} $n}
```
Example of usage:
```
P 1024
```
and outputs the window
[![enter image description here](https://i.stack.imgur.com/I4sgg.png)](https://i.stack.imgur.com/I4sgg.png)
[Answer]
# [MATL](https://github.com/lmendo/MATL), 20 bytes
```
:2.4*tX^wJ*Ze*'.'&XG
```
Try it at [**MATL Online!**](http://matl.io/?code=%3A2.4%2atX%5EwJ%2aZe%2a%27.%27%26XG&inputs=250&version=20.4.2)
The golden angle, `137.708`deg = `pi*(3-sqrt(5))`rad = `2.39996...`rad is approximated as `2.4`rad.
The following version (**25 bytes**) uses the exact value, up to `double` floating-point precision:
```
:YPI5X^-**tX^wJ*Ze*'.'&XG
```
Try it at [**MATL Online!**](http://matl.io/?code=%3AYPI5X%5E-%2a%2atX%5EwJ%2aZe%2a%27.%27%26XG&inputs=250&version=20.4.2)
]