﻿ SQR Function ---------------------------------------------------------------------------- Action Returns the square root of a numeric expression. Syntax SQR( numeric-expression) Remarks The argument numeric-expression must be greater than or equal to 0. SQR is calculated in single precision if numeric-expression is an integer or single-precision value. If you use any other numeric data type, SQR is calculated in double precision. Example The following example uses the SQR function to plot the graph of y = sqr(abs(x)) for -9 x 9 . SCREEN 1 . COLOR 1 ' Low-resolution color graphics mode. WINDOW (-9,-.25)-(9,3.25) ' Convert screen to Cartesian coordinates. LINE (-9,0)-(9,0) ' Draw x-axis. LINE (0,-.25)-(0,3.25) ' Draw y-axis. FOR x = -9 TO 9 LINE(x,.04)-(x,-.04) ' Put tick marks on x-axis. NEXT x FOR y = .25 TO 3.25 STEP .25 LINE (-.08,y)-(.12,y) ' Put tick marks on y-axis. NEXT y PSET (-9,3) ' Plot the first point of function. FOR x = -9 TO 9 STEP .25 y = SQR(ABS(x)) ' SQR argument cannot be negative. LINE -(x,y),2 ' Draw a line to the next point. NEXT x