﻿ SIN Function ---------------------------------------------------------------------------- Action Returns the sine of an angle given in radians. Syntax SIN( x) Remarks The argument x can be of any numeric type. The sine of an angle in a right triangle is the ratio between the length of the side opposite the angle and the length of the hypotenuse. SIN is calculated in single precision if x# is an integer or single-precision value. If you use any other numeric data type, SIN is calculated in double precision. To convert values from degrees to radians, multiply the angle (in degrees) times --180 (or .0174532925199433). To convert a radian value to degrees, multiply it by 180-- (or 57.2957795130824). In both cases, - - 3.141593. See Also ATN, COS, TAN Example The following 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