# Using PLOT to graph two functions

I'm trying to graph 2 functions,y=x^2&y=sinx,on the same coordinate axes.The Set Windows command was: -2,10.-2,4. Then, I used PLOT LINES and 2 for/next loops to graph the functions.The first for/next loop was for y=sinx and its limits were:-2 to 10, The second for/next loop was for y=x^2 and its limits were -2 to 2. After running the program, I got the graphs of the 2 function but I also got an extraneous line that ran from the left endpoint of the parabola to the right endpoint of the sine function. Is there any way to correct this problem? Any help would be appreciated.

### re: using PLOT

I think you need to post some (or all) of the code here. I know you certainly can plot the two functions on the same axes--need to see in more detail what you are doing.

rwt

### Program Code for Plotting 2 Functions

LIBRARY "GraphLib.tru"
SET MODE "GRAPHICS"
SET WINDOW -2,10,-2,4
CALL Ticks(1,1)
FOR x=-2 to 10 step 0.1
LET y=sin(x)
PLOT LINES:x.y;
NEXT x
FOR x= -2 to 2 step 0.1
LET y = x*x
PLOT LINES:x,y;
NEXT x
END

### re:plot

I'm sure the typo in the first PLOT LINES '.' instead of ',' is just that, a typo.

The problem is the ';' at the end of the PLOT LINES statement. It tells the program to keep connecting the next line segment to the last. You need to stop that process. [In your version you also needed your last limits to go to 2.1 to complete the parabola.] Manually plotting the last point works--see below. Not sure if there is a more elegant solution. I would have used much smaller steps and just done a PLOT x,y instead of the PLOT LINES. rwt

LIBRARY "GraphLib.trc"
SET MODE "GRAPHICS"
SET WINDOW -2,10,-2,4
CALL Ticks(1,1)
FOR x=-2 to 9.9 step 0.1
LET y=sin(x)
PLOT LINES:x,y;
NEXT x

LET y=sin(10)
PLOT LINES:x,y

FOR x= -2 to 1.9 step 0.1
LET y = x*x
PLOT LINES:x,y;
NEXT x

let x = 2
LET y = x*x
PLOT LINES:x,y

END