Wednesday, October 13, 2010

Inequalities

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 lines
color red
m1=int(rand*8-4)/(int(rand*4+1)): c1=int(rand*8-4)
m2=int(rand*8-4)/(int(rand*4+1)): c2=int(rand*8-4)
for x = -5 to 5 step .02
y1 = m1*x+c1
y2 = m2*x+c2
circle 30*x +150, 150 - 30*y1,1
circle 30*x +150, 150 - 30*y2,1
next x
rem generate shade
for n = 1 to 5000
x=rand*10-5
y=rand*10-5
if y > m1*x+c1 and y < m2*x+c2 then
circle 30*x +150, 150 - 30*y,1
end if
next n
input "The area is defined by",a$
print "y>"+m1+"x"+"+"+c1
print
print "y<"+m2+"x"+"+"+c2

No comments:

Post a Comment