Babylonian spiral: Difference between revisions

→‎{{header|J}}: fix online link
(→‎{{header|Wren}}: Converted to a DOME script so we can use Wren-plot to plot the points.)
(→‎{{header|J}}: fix online link)
Line 76:
</lang>
 
There's an online example of thethese 1e4two casecases [https://jsoftware.github.io/j-playground/bin/htmlhtml2/emj.html#code=require'stats'plot%0D20stats'%0Abspir%3D%3A%20%7B%7B%0D%0A%20%20r%3D.%200%0D%0A%20%20e%3D.%202%3E.%3C.%2B%3A%25%3Ay%0D%0A%20%20for_qd.%0D%0A%20%20%20%20(y%28y-1)%29%7B.(%28%3C%2F.~%20*%3A%40%7C)%29%20(%28%2F%3A%7C)%29%20(%28%23~%20(%28%3D%3C.)%29%40%3A*%3A%40%3A%7C)%29%20j.%2F%221%20(2%282%20comb%20e)%29%2C%2C.~1%2Bi.e%0D%0A%20%20do.%0D%0A%20%20%20%20d%3D.%20~.(%28%2C%2B)(%29%28%2C-)(%29%28%2Cj.)%3Bqd29%0D3Bqd%0A%20%20%20%20ar%3D.%2012%20o.%20-~%2F_2%7B.r%0D%0A%20%20%20%20ad%3D.%20(%28-%202p1%20*%20%3E%3A%26ar)%29%2012%20o.%20d%0D%0A%20%20%20%20-r%3D.%20r%2C%20(%28%7B%3Ar)%29%2Bd%7B~%20(i%28i.%20%3E.%2F)%29%20ad%0D%0A%20%20end.%0D%0A%7D%7D%0D%0A%0D0Aplot%20bspir%2040%0Aplot%20bspir%2010000201e4 here] (follow the link, select the right pane, then hit runcontrol-R or select Edit Run &gt; All Lines from the menu, this might take a couple seconds, depending on your machine, and this url may need to be updated in the future).
 
This could be made significantly faster with a better estimator (or with a better implementation of J compiled to javascript).
6,951

edits