Tuesday, October 5, 2010

Line equation

clg

rem generate graph
for y = -5 to 5 : for x = -5 to 5
circle int(30*x)+150, int(30*y)+ 150,3
next x : next y
line 150,0,150,300 : line 0,150,300,150
rem generate line
color red
m=int(rand*8-4)/(int(rand*4+1)): c=int(rand*8-4)
for x = -5 to 5 step .01
y = m*x+c
circle 30*x +150, 150 - 30*y,1
next x
input "What is the equation",r$
Print "y="+m+"x+"+c

No comments:

Post a Comment