Download or view ArchimedeanSpiral.frink in plain text format
use Plot2D.frink
/** Program to graph an Archimedean spiral in Cartesian coordinates
from a single equation.
In polar and parametric form, an Archimedean spiral can be described
in a few equations:
r = b theta
x = r cos[theta]
y = r sin[theta]
The challenge here though is to turn those 3 equations in 5 variables
{x,y,r,b,theta} into a single implicit equation in 3 variables {x,y,b}
that can be graphed with Frink's interval arithmetic plotting.
This is hard, especially creating equations that cover multiple spirals and
do not have a lot of divide-by-zero or arctan[y/x] errors where x=0.
Thanks to Grok for deriving the equations! I am impressed!
https://x.com/i/grok/share/pcpdEkE5apACp3RwlnSED4a96
*/
// Simple equation but with lots of divide-by-zeroes
// g = new Plot2D.plot["y/x = tan[sqrt[x^2+y^2]/2]"]
// but a better version without so many divide-by-zero errors is:
// y cos[sqrt[x^2+y^2]/b] = x sin[sqrt[x^2+y^2]/b]
b = 1/5
g = new Plot2D.plot["y cos[sqrt[x^2+y^2]/(" + inputForm[b] + ")] = x sin[sqrt[x^2+y^2]/(" + inputForm[b] + ")]"]
g.show[]
Download or view ArchimedeanSpiral.frink in plain text format
This is a program written in the programming language Frink.
For more information, view the Frink
Documentation or see More Sample Frink Programs.
Alan Eliasen, eliasen@mindspring.com