Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
SIN Function Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'This example plots the graph of the polar equation r = 1 + sin(n * Θ). This
'figure is sometimes known as a cardioid, owing to its resemblance to a
'heart when n equals 1.
CLS
CONST PI = 3.141593
SCREEN 1 : COLOR 1,1 'Medium resolution, blue background.
WINDOW (-3,-2)-(3,2) 'Convert screen to Cartesian coordinates.
INPUT "Number of petals = ", N
CLS
PSET (1,0) 'Set initial point.
FOR Angle = 0 TO 2*PI STEP .02
R = 1 + SIN(N*Angle) 'Polar equation for "flower."
X = R * COS(Angle) 'Convert polar coordinates to
Y = R * SIN(Angle) 'Cartesian coordinates.
LINE -(X,Y) 'Draw line from previous point to new point.
NEXT
END