Skip to main content

Spray a line!!!

What: Sprinkle points along a 2D line and play Why: The equations and inequlities dealing with lines suddenly make better sense Time To Complete: 6 hours

Alt Text
//do not use the reserved word line, alter e.g. linear;

linear = 3*x+2*y-3;

//points residing on one side of the line;
pts1 = instance [linear < 0 and -5<x<5 and -5<y<5 , 50];

//points residing on the line;
pts2 = instance [linear == 0 and -5<x<5 and -5<y<5 , 50];

//points residing on the other side of the line;
pts3 = instance [linear > 0 and -5<x<5 and -5<y<5 , 50];

//make a list of colors to color the points in each region;
color[{red, black,green}];

//show all points;
pointplot pts1 also pts2 also pts3;

save as trash;

Output

line_less_equal_greater.jpg

Output

line_less_equal_greater2.jpg